@alipay/faas-web-sdk 1.1.12 → 1.1.13-alpha.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/dist/index.js +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).cloud={})}(this,(function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}var n=function(){return n=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},n.apply(this,arguments)};function r(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())}))}function o(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=a.trys,(o=o.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])}}}"function"==typeof SuppressedError&&SuppressedError;var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,c={},s={},l={},p={},f={},d=i&&i.__extends||(u=function(t,e){return(u=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)},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}u(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(f,"__esModule",{value:!0}),f.FaasError=void 0;var y=function(t){function e(n,r){var o=t.call(this,r)||this;return o.name="FaasError",o.error=n,o.errorMessage=r,Object.setPrototypeOf(o,e.prototype),o}return d(e,t),Object.defineProperty(e.prototype,"errCode",{get:function(){return this.error},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errMsg",{get:function(){return this.message},enumerable:!1,configurable:!0}),e.INVALID_PARAM_ERR=function(t,n){return new e(60001,"无效入参,参数 ".concat(t," ").concat(n))},e.NOT_FOUND_ERR=function(t){return new e(60001,t)},e.SERVER_ERR=function(t,n,r,o){var i=new e(t,n);return i.requestID=r,i.httpStatus=o,i},e.STORAGE_ERR=function(t,n,r){var o=new e(t,n);return o.requestID=r,o},e.NETWORK_ERR=function(t,n){var r=new e(-1,t.toString());return r.requestID=n,r},e}(Error);f.FaasError=y;var h=i&&i.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};Object.defineProperty(p,"__esModule",{value:!0}),p.ResponseUtil=p.wrapCallback=void 0;var m=f;p.wrapCallback=function(t,e){return void 0===e&&(e=void 0),function(n){if(!((null==n?void 0:n.complete)||(null==n?void 0:n.success)||(null==n?void 0:n.fail)))return t.call(e,n);var r=n.complete,o=n.success,i=n.fail,a=h(n,["complete","success","fail"]);t.call(e,a).then((function(t){return null==o||o(t),t}),(function(t){return null==i||i(t),t})).then((function(t){null==r||r(t)}))}};var v=function(){function t(){}return t.handleResponse=function(t){if(200!==t.status){var e=t.data||{code:-1,message:"未知异常"},n=e.code,r=e.message;throw m.FaasError.SERVER_ERR(n,r,t.requestID,t.status)}return t.data.data},t}();p.ResponseUtil=v;var g=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},_=i&&i.__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=a.trys,(o=o.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(l,"__esModule",{value:!0}),l.createCallContainer=void 0;var b=p;l.createCallContainer=function(t){return(0,b.wrapCallback)((function(e){return g(void 0,void 0,void 0,(function(){return _(this,(function(n){throw new Error("not implemented in "+t.type+" with "+e)}))}))}))};var w={},O=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},C=i&&i.__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=a.trys,(o=o.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(w,"__esModule",{value:!0}),w.createCallFunction=void 0;var P=f,A=p;w.createCallFunction=function(t){var e=t.httpclient;return(0,A.wrapCallback)((function(t){return O(void 0,void 0,void 0,(function(){var n,r,o,i,a;return C(this,(function(u){switch(u.label){case 0:if(!t.name)throw P.FaasError.INVALID_PARAM_ERR("name","缺失");return n={"x-to-function-name":t.name,"x-alipay-cloud-mode":"function"},"POST","/functions/invokeFunction",[4,e.request({method:"POST",path:"/functions/invokeFunction",data:t.data,headers:n})];case 1:if(200!==(r=u.sent()).status)throw o=-1,i="",(a=r.data)&&(o=a.errCode,i=a.errMsg,a.errDetail&&(i+=",详情:".concat(a.errDetail))),P.FaasError.SERVER_ERR(o,i,r.requestID,r.status);return[2,{requestID:r.requestID,result:r.data}]}}))}))}))};var j={},x={},S={};Object.defineProperty(S,"__esModule",{value:!0});var E,R={},D={},M={},q={},N=i&&i.__extends||(E=function(t,e){return(E=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)},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}E(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(q,"__esModule",{value:!0}),q.AggregateCommand=q.QueryCommand=q.UpdateCommand=q.AbstractCommand=void 0;var I=function(){};q.AbstractCommand=I;var B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(I);q.UpdateCommand=B;var k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(I);q.QueryCommand=k;var T=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(I);q.AggregateCommand=T;var Q,F,U,$={},L={},W=i&&i.__extends||(Q=function(t,e){return(Q=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)},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}Q(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(L,"__esModule",{value:!0}),L.DbBuildError=L.ErrorCode=void 0,(U=F||(L.ErrorCode=F={})).INVALID_PARAM="INVALID_PARAM",U.INVALID_COMMAND="INVALID_COMMAND";var H=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return W(e,t),e.create=function(t,n){var r=new e(n);return r.code=t,r},e.invalidParam=function(t,n){return e.create(F.INVALID_PARAM,'无效入参 "'.concat(t,'", ').concat(n))},e.invalidCommand=function(t){return e.create(F.INVALID_COMMAND,t)},e}(Error);L.DbBuildError=H,Object.defineProperty($,"__esModule",{value:!0}),$.AggregateRequest=void 0;var G=L,z=q,V=function(){function t(t,e){void 0===e&&(e=""),this.data=t,this.prefix=e}return t.prototype.stringify=function(){var n=this;if(this.data instanceof z.AbstractCommand){if(!(this.data instanceof z.AggregateCommand))throw G.DbBuildError.invalidCommand("Command 不是聚合操作");return this.data.stringify()}if(null===this.data)return this.data;if(Array.isArray(this.data))return this.data.map((function(e,r){return new t(e,"".concat(n.prefix,".$.").concat(r)).stringify()}));switch(e(this.data)){case"number":case"boolean":case"string":case"bigint":return this.data;case"function":throw G.DbBuildError.invalidParam(this.prefix,"不支持函数");case"symbol":throw G.DbBuildError.invalidParam(this.prefix,"不支持 symbol");case"undefined":throw G.DbBuildError.invalidParam(this.prefix,"不支持 undefined");default:var r={};for(var o in this.data){var i=this.prefix?"".concat(this.prefix,".").concat(o):o,a=new t(this.data[o],i);r[o]=a.stringify()}return r}},t.prototype.toJSON=function(){return this.stringify()},t}();$.AggregateRequest=V;var J,K=i&&i.__extends||(J=function(t,e){return(J=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)},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}J(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(M,"__esModule",{value:!0}),M.AndAggregateCommand=void 0;var Y=$,X=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map((function(t){return new Y.AggregateRequest(t).toJSON()})),n}return K(e,t),e.prototype.pushCommand=function(t){this.commands.push(new Y.AggregateRequest(t).toJSON())},e.prototype.stringify=function(){return{$and:this.commands}},e}(q.AggregateCommand);M.AndAggregateCommand=X;var Z,tt={},et=i&&i.__extends||(Z=function(t,e){return(Z=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)},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}Z(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(tt,"__esModule",{value:!0}),tt.AvgAggregateCommand=void 0;var nt=$,rt=function(t){function e(e){var n=t.call(this)||this;return n.val=new nt.AggregateRequest(e).toJSON(),n}return et(e,t),e.prototype.stringify=function(){return{$avg:this.val}},e}(q.AggregateCommand);tt.AvgAggregateCommand=rt;var ot={},it=i&&i.__extends||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)}}();Object.defineProperty(ot,"__esModule",{value:!0}),ot.CountAggregateCommand=void 0;var at=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return it(e,t),e.prototype.stringify=function(){return{$count:{}}},e}(q.AggregateCommand);ot.CountAggregateCommand=at;var ut={},ct=i&&i.__extends||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])})(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)}}();Object.defineProperty(ut,"__esModule",{value:!0}),ut.EqAggregateCommand=void 0;var st=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return ct(e,t),e.prototype.stringify=function(){return{$eq:this.val}},e}(q.AggregateCommand);ut.EqAggregateCommand=st;var lt,pt={},ft={},dt={},yt={},ht={};function mt(){if(lt)return ht;lt=1;var t,e=i&&i.__extends||(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)},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)});Object.defineProperty(ht,"__esModule",{value:!0}),ht.AndCommand=void 0;var n=q,r=ae(),o=function(t){function n(e){var n=t.call(this)||this;return n.commands=e.map(r.CommandUtils.stringify),n}return e(n,t),n.prototype.pushCommand=function(t){this.commands.push(r.CommandUtils.stringify(t))},n.prototype.stringify=function(){return{$and:this.commands}},n}(n.QueryCommand);return ht.AndCommand=o,ht}var vt,gt={};function _t(){if(vt)return gt;vt=1;var t=i&&i.__extends||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)}}();Object.defineProperty(gt,"__esModule",{value:!0}),gt.OrCommand=void 0;var e=q,n=ae(),r=function(e){function r(t){var r=e.call(this)||this;return r.commands=t.map(n.CommandUtils.stringify),r}return t(r,e),r.prototype.pushCommand=function(t){this.commands.push(n.CommandUtils.stringify(t))},r.prototype.stringify=function(){return{$or:this.commands}},r}(e.QueryCommand);return gt.OrCommand=r,gt}var bt={},wt=i&&i.__extends||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)}}();Object.defineProperty(bt,"__esModule",{value:!0}),bt.EqCommand=void 0;var Ot=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return wt(e,t),e.prototype.stringify=function(){return{$eq:this.val}},e}(q.QueryCommand);bt.EqCommand=Ot;var Ct={},Pt=i&&i.__extends||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])})(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)}}();Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.NeqCommand=void 0;var At=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Pt(e,t),e.prototype.stringify=function(){return{$ne:this.val}},e}(q.QueryCommand);Ct.NeqCommand=At;var jt={},xt=i&&i.__extends||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)}}();Object.defineProperty(jt,"__esModule",{value:!0}),jt.LtCommand=void 0;var St=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return xt(e,t),e.prototype.stringify=function(){return{$lt:this.val}},e}(q.QueryCommand);jt.LtCommand=St;var Et={},Rt=i&&i.__extends||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)}}();Object.defineProperty(Et,"__esModule",{value:!0}),Et.LteCommand=void 0;var Dt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Rt(e,t),e.prototype.stringify=function(){return{$lte:this.val}},e}(q.QueryCommand);Et.LteCommand=Dt;var Mt={},qt=i&&i.__extends||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)}}();Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.GtCommand=void 0;var Nt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return qt(e,t),e.prototype.stringify=function(){return{$gt:this.val}},e}(q.QueryCommand);Mt.GtCommand=Nt;var It={},Bt=i&&i.__extends||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)}}();Object.defineProperty(It,"__esModule",{value:!0}),It.GteCommand=void 0;var kt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Bt(e,t),e.prototype.stringify=function(){return{$gte:this.val}},e}(q.QueryCommand);It.GteCommand=kt;var Tt={},Qt=i&&i.__extends||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)}}();Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.InCommand=void 0;var Ft=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Qt(e,t),e.prototype.stringify=function(){return{$in:this.val}},e}(q.QueryCommand);Tt.InCommand=Ft;var Ut={},$t=i&&i.__extends||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)}}();Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.NinCommand=void 0;var Lt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return $t(e,t),e.prototype.stringify=function(){return{$nin:this.val}},e}(q.QueryCommand);Ut.NinCommand=Lt;var Wt={},Ht=i&&i.__extends||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)}}();Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.ExistsCommand=void 0;var Gt=function(t){function e(e){var n=t.call(this)||this;return n.exists=e,n}return Ht(e,t),e.prototype.stringify=function(){return{$exists:this.exists}},e}(q.QueryCommand);Wt.ExistsCommand=Gt;var zt={},Vt=i&&i.__extends||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])})(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)}}();Object.defineProperty(zt,"__esModule",{value:!0}),zt.ModCommand=void 0;var Jt=function(t){function e(e,n){var r=t.call(this)||this;return r.divisor=e,r.remainder=n,r}return Vt(e,t),e.prototype.stringify=function(){return{$mod:[this.divisor,this.remainder]}},e}(q.QueryCommand);zt.ModCommand=Jt;var Kt={},Yt=i&&i.__extends||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)}}();Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.AllCommand=void 0;var Xt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Yt(e,t),e.prototype.stringify=function(){return{$all:this.val}},e}(q.QueryCommand);Kt.AllCommand=Xt;var Zt,te,ee,ne,re={};function oe(){if(Zt)return re;Zt=1;var t=i&&i.__extends||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)}}();Object.defineProperty(re,"__esModule",{value:!0}),re.ElemMatchCommand=void 0;var e=q,n=ae(),r=function(e){function r(t){var r=e.call(this)||this;return r.val=n.CommandUtils.stringify(t),r}return t(r,e),r.prototype.stringify=function(){return{$elemMatch:this.val}},r}(e.QueryCommand);return re.ElemMatchCommand=r,re}function ie(){if(te)return yt;te=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.QueryChain=void 0;var t=mt(),e=_t(),n=bt,r=Ct,o=jt,i=Et,a=Mt,u=It,c=Tt,s=Ut,l=Wt,p=zt,f=Kt,d=oe(),y=ae(),h=function(){function h(t){this.lastCmd=t}return h.prototype.appendCommand=function(e){return e=y.CommandUtils.unchain(e),this.lastCmd instanceof t.AndCommand?this.lastCmd.pushCommand(e):this.lastCmd=new t.AndCommand([this.lastCmd,e]),this},h.prototype.and=function(t){return this.appendCommand(t)},h.prototype.or=function(t){return t=y.CommandUtils.unchain(t),this.lastCmd instanceof e.OrCommand?this.lastCmd.pushCommand(t):this.lastCmd=new e.OrCommand([this.lastCmd,t]),this},h.prototype.not=function(t){return this.appendCommand(t)},h.prototype.nor=function(t){return this.appendCommand(t)},h.prototype.eq=function(t){return this.appendCommand(new n.EqCommand(t))},h.prototype.neq=function(t){return this.appendCommand(new r.NeqCommand(t))},h.prototype.lt=function(t){return this.appendCommand(new o.LtCommand(t))},h.prototype.lte=function(t){return this.appendCommand(new i.LteCommand(t))},h.prototype.gt=function(t){return this.appendCommand(new a.GtCommand(t))},h.prototype.gte=function(t){return this.appendCommand(new u.GteCommand(t))},h.prototype.in=function(t){return this.appendCommand(new c.InCommand(t))},h.prototype.nin=function(t){return this.appendCommand(new s.NinCommand(t))},h.prototype.exists=function(t){return this.appendCommand(new l.ExistsCommand(t))},h.prototype.mod=function(t,e){return this.appendCommand(new p.ModCommand(t,e))},h.prototype.all=function(t){return this.appendCommand(new f.AllCommand(t))},h.prototype.elemMatch=function(t){return this.appendCommand(new d.ElemMatchCommand(y.CommandUtils.unchain(t)))},h.prototype.size=function(t){return this.appendCommand(t)},h}();return yt.QueryChain=h,yt}function ae(){if(ee)return dt;ee=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.CommandUtils=void 0;var t=q,e=ue(),n=ie(),r=function(){function r(){}return r.stringify=function(n){return(n=r.unchain(n))instanceof t.QueryCommand?n.stringify():new e.QueryRequest(n).toJSON()},r.unchain=function(t){return t instanceof n.QueryChain?t.lastCmd:t},r}();return dt.CommandUtils=r,dt}function ue(){if(ne)return ft;ne=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.QueryRequest=void 0;var t=q,n=L,r=ae(),o=function(){function o(t,e){void 0===e&&(e=""),this.query=t,this.prefix=e}return o.prototype.stringify=function(){var i=this,a={},u=r.CommandUtils.unchain(this.query),c=e(u);if(u instanceof t.QueryCommand)return u.stringify();if(Array.isArray(u))return u.map((function(t,e){return new o(t,"".concat(i.prefix,".$.").concat(e)).stringify()}));if("number"===c)return u;if("boolean"===c)return u;if("string"===c)return u;if("bigint"===c)return u;if("function"===c)throw n.DbBuildError.invalidParam(this.prefix,"不支持函数");if("symbol"===c)throw n.DbBuildError.invalidParam(this.prefix,"不支持 symbol");if("undefined"===c)throw n.DbBuildError.invalidParam(this.prefix,"不支持 undefined");if(null===u)return u;for(var s in u){var l=this.prefix?"".concat(this.prefix,".").concat(s):s,p=new o(u[s],l);a[s]=p.stringify()}return a},o.prototype.toJSON=function(){return this.stringify()},o}();return ft.QueryRequest=o,ft}var ce,se,le,pe,fe,de={};Object.defineProperty(de,"__esModule",{value:!0}),de.PipelineStageName=de.Target=de.DocumentAction=de.CollectionAction=de.Sort=void 0,function(t){t.DESC="desc",t.ASC="asc"}(ce||(de.Sort=ce={})),function(t){t.update="update",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create"}(se||(de.CollectionAction=se={})),function(t){t.update="update",t.replace="replace",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create",t.batchCreate="batchCreate",t.count="count",t.aggregate="aggregate"}(le||(de.DocumentAction=le={})),function(t){t.collection="collection",t.document="document"}(pe||(de.Target=pe={})),function(t){t.match="$match",t.group="$group",t.sample="$sample",t.lookup="$lookup"}(fe||(de.PipelineStageName=fe={})),Object.defineProperty(pt,"__esModule",{value:!0}),pt.AggregatePipeline=void 0;var ye=$,he=ue(),me=de,ve=L,ge=function(){function t(){this.pipeline=[]}return t.prototype.match=function(t){return this.pushStage(me.PipelineStageName.match,t),this},t.prototype.group=function(t){return this.pushStage(me.PipelineStageName.group,t),this},t.prototype.sample=function(t){return this.pushStage(me.PipelineStageName.sample,t),this},t.prototype.lookup=function(t){return this.pushStage(me.PipelineStageName.lookup,t),this},t.prototype.done=function(){return this.pipeline.map((function(t){var e;switch(t.name){case me.PipelineStageName.match:return{$match:new he.QueryRequest(t.param).toJSON()};case me.PipelineStageName.sample:case me.PipelineStageName.lookup:return(e={})[t.name]=t.param,e;case me.PipelineStageName.group:return{$group:new ye.AggregateRequest(t.param).toJSON()};default:var n=t.name;throw ve.DbBuildError.invalidParam(n,"不支持的 aggregate 操作")}}))},t.prototype.pushStage=function(t,e){this.pipeline.push({name:t,param:e})},t}();pt.AggregatePipeline=ge;var _e={},be=i&&i.__extends||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)}}();Object.defineProperty(_e,"__esModule",{value:!0}),_e.ExprCommand=void 0;var we=$,Oe=function(t){function e(e){var n=t.call(this)||this;return n.commands=new we.AggregateRequest(e).toJSON(),n}return be(e,t),e.prototype.stringify=function(){return{$expr:this.commands}},e}(q.QueryCommand);_e.ExprCommand=Oe;var Ce={},Pe=i&&i.__extends||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)}}();Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.GtAggregateCommand=void 0;var Ae=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Pe(e,t),e.prototype.stringify=function(){return{$gt:this.val}},e}(q.AggregateCommand);Ce.GtAggregateCommand=Ae;var je={},xe=i&&i.__extends||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])})(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)}}();Object.defineProperty(je,"__esModule",{value:!0}),je.GteAggregateCommand=void 0;var Se=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return xe(e,t),e.prototype.stringify=function(){return{$gte:this.val}},e}(q.AggregateCommand);je.GteAggregateCommand=Se;var Ee={},Re=i&&i.__extends||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)}}();Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.LtAggregateCommand=void 0;var De=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Re(e,t),e.prototype.stringify=function(){return{$lt:this.val}},e}(q.AggregateCommand);Ee.LtAggregateCommand=De;var Me={},qe=i&&i.__extends||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])})(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)}}();Object.defineProperty(Me,"__esModule",{value:!0}),Me.LteAggregateCommand=void 0;var Ne=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return qe(e,t),e.prototype.stringify=function(){return{$lte:this.val}},e}(q.AggregateCommand);Me.LteAggregateCommand=Ne;var Ie={},Be=i&&i.__extends||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])})(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)}}();Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.MaxAggregateCommand=void 0;var ke=$,Te=function(t){function e(e){var n=t.call(this)||this;return n.val=new ke.AggregateRequest(e).toJSON(),n}return Be(e,t),e.prototype.stringify=function(){return{$max:this.val}},e}(q.AggregateCommand);Ie.MaxAggregateCommand=Te;var Qe={},Fe=i&&i.__extends||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])})(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)}}();Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.MinAggregateCommand=void 0;var Ue=$,$e=function(t){function e(e){var n=t.call(this)||this;return n.val=new Ue.AggregateRequest(e).toJSON(),n}return Fe(e,t),e.prototype.stringify=function(){return{$min:this.val}},e}(q.AggregateCommand);Qe.MinAggregateCommand=$e;var Le={},We=i&&i.__extends||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])})(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)}}();Object.defineProperty(Le,"__esModule",{value:!0}),Le.NeqAggregateCommand=void 0;var He=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return We(e,t),e.prototype.stringify=function(){return{$ne:this.val}},e}(q.AggregateCommand);Le.NeqAggregateCommand=He;var Ge={},ze=i&&i.__extends||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])})(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)}}();Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.OrAggregateCommand=void 0;var Ve=$,Je=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map((function(t){return new Ve.AggregateRequest(t).toJSON()})),n}return ze(e,t),e.prototype.pushCommand=function(t){this.commands.push(new Ve.AggregateRequest(t).toJSON())},e.prototype.stringify=function(){return{$or:this.commands}},e}(q.AggregateCommand);Ge.OrAggregateCommand=Je;var Ke={},Ye=i&&i.__extends||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])})(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)}}();Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.SumAggregateCommand=void 0;var Xe=$,Ze=function(t){function e(e){var n=t.call(this)||this;return n.val=new Xe.AggregateRequest(e).toJSON(),n}return Ye(e,t),e.prototype.stringify=function(){return{$sum:this.val}},e}(q.AggregateCommand);Ke.SumAggregateCommand=Ze;var tn={},en=i&&i.__extends||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])})(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)}}();Object.defineProperty(tn,"__esModule",{value:!0}),tn.SetCommand=void 0;var nn=function(t){function e(e){var n=t.call(this)||this;return n.data=e,n}return en(e,t),Object.defineProperty(e.prototype,"operator",{get:function(){return"$set"},enumerable:!1,configurable:!0}),e.prototype.stringify=function(){return this.data},e}(q.UpdateCommand);tn.SetCommand=nn;var rn={},on=i&&i.__extends||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])})(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)}}();Object.defineProperty(rn,"__esModule",{value:!0}),rn.IncCommand=void 0;var an=function(t){function e(e){var n=t.call(this)||this;return n.num=e,n}return on(e,t),Object.defineProperty(e.prototype,"operator",{get:function(){return"$inc"},enumerable:!1,configurable:!0}),e.prototype.stringify=function(){return this.num},e}(q.UpdateCommand);rn.IncCommand=an;var un,cn={},sn=i&&i.__extends||(un=function(t,e){return un=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])},un(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}un(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(cn,"__esModule",{value:!0}),cn.NotCommand=void 0;var ln=q,pn=ae(),fn=function(t){function e(e){var n=t.call(this)||this;return n.command=pn.CommandUtils.stringify(e),n}return sn(e,t),e.prototype.stringify=function(){return{$not:this.command.stringify()}},e}(ln.QueryCommand);cn.NotCommand=fn;var dn={},yn=i&&i.__extends||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)}}();Object.defineProperty(dn,"__esModule",{value:!0}),dn.NorCommand=void 0;var hn=q,mn=ae(),vn=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map(mn.CommandUtils.stringify),n}return yn(e,t),e.prototype.pushCommand=function(t){this.commands.push(mn.CommandUtils.stringify(t))},e.prototype.stringify=function(){return{$nor:this.commands}},e}(hn.QueryCommand);dn.NorCommand=vn;var gn={},_n=i&&i.__extends||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)}}();Object.defineProperty(gn,"__esModule",{value:!0}),gn.SizeCommand=void 0;var bn=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return _n(e,t),e.prototype.stringify=function(){return{$size:this.val}},e}(q.QueryCommand);gn.SizeCommand=bn,Object.defineProperty(D,"__esModule",{value:!0}),D.Command=D.AggregateCommandFactory=void 0;var wn=M,On=tt,Cn=ot,Pn=ut,An=pt,jn=_e,xn=Ce,Sn=je,En=Ee,Rn=Me,Dn=Ie,Mn=Qe,qn=Le,Nn=Ge,In=Ke,Bn=tn,kn=rn,Tn=ie(),Qn=_t(),Fn=mt(),Un=ae(),$n=cn,Ln=dn,Wn=bt,Hn=Ct,Gn=jt,zn=Et,Vn=Mt,Jn=It,Kn=Tt,Yn=Ut,Xn=Wt,Zn=zt,tr=Kt,er=oe(),nr=gn,rr=function(){function t(){}return t.prototype.pipeline=function(){return new An.AggregatePipeline},t.prototype.avg=function(t){return new On.AvgAggregateCommand(t)},t.prototype.count=function(){return new Cn.CountAggregateCommand},t.prototype.max=function(t){return new Dn.MaxAggregateCommand(t)},t.prototype.min=function(t){return new Mn.MinAggregateCommand(t)},t.prototype.sum=function(t){return new In.SumAggregateCommand(t)},t.prototype.and=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=Array.isArray(t[0])?t[0]:t,new wn.AndAggregateCommand(t)},t.prototype.or=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=Array.isArray(t[0])?t[0]:t,new Nn.OrAggregateCommand(t)},t.prototype.eq=function(t){return new Pn.EqAggregateCommand(t)},t.prototype.neq=function(t){return new qn.NeqAggregateCommand(t)},t.prototype.lt=function(t){return new En.LtAggregateCommand(t)},t.prototype.lte=function(t){return new Rn.LteAggregateCommand(t)},t.prototype.gt=function(t){return new xn.GtAggregateCommand(t)},t.prototype.gte=function(t){return new Sn.GteAggregateCommand(t)},t}();D.AggregateCommandFactory=rr;var or=function(){function t(){this.aggregate=new rr}return t.prototype.set=function(t){return new Bn.SetCommand(t)},t.prototype.inc=function(t){return new kn.IncCommand(t)},t.prototype.expr=function(t){return new jn.ExprCommand(t)},t.prototype.and=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t=Array.isArray(t[0])?t[0]:t;var n=new Fn.AndCommand(t.map(Un.CommandUtils.unchain));return new Tn.QueryChain(n)},t.prototype.or=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t=Array.isArray(t[0])?t[0]:t;var n=new Qn.OrCommand(t.map(Un.CommandUtils.unchain));return new Tn.QueryChain(n)},t.prototype.not=function(t){var e=new $n.NotCommand(Un.CommandUtils.unchain(t));return new Tn.QueryChain(e)},t.prototype.nor=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t=Array.isArray(t[0])?t[0]:t;var n=new Ln.NorCommand(t.map(Un.CommandUtils.unchain));return new Tn.QueryChain(n)},t.prototype.eq=function(t){return new Tn.QueryChain(new Wn.EqCommand(t))},t.prototype.neq=function(t){return new Tn.QueryChain(new Hn.NeqCommand(t))},t.prototype.lt=function(t){return new Tn.QueryChain(new Gn.LtCommand(t))},t.prototype.lte=function(t){return new Tn.QueryChain(new zn.LteCommand(t))},t.prototype.gt=function(t){return new Tn.QueryChain(new Vn.GtCommand(t))},t.prototype.gte=function(t){return new Tn.QueryChain(new Jn.GteCommand(t))},t.prototype.in=function(t){return new Tn.QueryChain(new Kn.InCommand(t))},t.prototype.nin=function(t){return new Tn.QueryChain(new Yn.NinCommand(t))},t.prototype.exists=function(t){return new Tn.QueryChain(new Xn.ExistsCommand(t))},t.prototype.mod=function(t,e){return new Tn.QueryChain(new Zn.ModCommand(t,e))},t.prototype.all=function(t){return new Tn.QueryChain(new tr.AllCommand(t))},t.prototype.elemMatch=function(t){return new Tn.QueryChain(new er.ElemMatchCommand(Un.CommandUtils.unchain(t)))},t.prototype.size=function(t){return new Tn.QueryChain(new nr.SizeCommand(t))},t}();D.Command=or;var ir={};Object.defineProperty(ir,"__esModule",{value:!0}),ir.ActionBuilder=void 0;var ar=de,ur=function(){function t(){}return t.buildCollectionAction=function(t,e){return{target:ar.Target.collection,action:t,collectionName:e}},t.buildCollectionListQueryAction=function(t){return{target:ar.Target.collection,action:ar.CollectionAction.queryList,options:t}},t.buildDocumentAction=function(t,e,n){return{target:ar.Target.document,action:t,collectionName:e,options:n}},t}();ir.ActionBuilder=ur;var cr={},sr={},lr=i&&i.__extends||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])})(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)}}();Object.defineProperty(sr,"__esModule",{value:!0}),sr.AggregateBuilder=void 0;var pr=de,fr=ir,dr=function(t){function e(e){var n=t.call(this)||this;return n.collectionName=e,n}return lr(e,t),e.prototype.end=function(){var t={$aggregate:this.done()};return fr.ActionBuilder.buildDocumentAction(pr.DocumentAction.aggregate,this.collectionName,t)},e}(pt.AggregatePipeline);sr.AggregateBuilder=dr;var yr={},hr={},mr={},vr={};Object.defineProperty(vr,"__esModule",{value:!0}),vr.Operator=void 0;var gr=function(){function t(){this.res={}}return t.prototype.set=function(t,e){this.res.$set=this.res.$set||{},this.res.$set[t]=e},t.prototype.applyOperator=function(t,e,n){this.res[t]=this.res[t]||{},this.res[t][e]=n},t.prototype.emit=function(){return this.res},t}();vr.Operator=gr,Object.defineProperty(mr,"__esModule",{value:!0}),mr.UpdateRequest=void 0;var _r=L,br=q,wr=vr,Or=function(){function t(t,e){void 0===e&&(e=""),this.data=t,this.prefix=e}return t.prototype.stringify=function(n){for(var r in n=n||new wr.Operator,this.data){var o=this.prefix?"".concat(this.prefix,".").concat(r):r,i=this.data[r],a=e(i);if(i instanceof br.AbstractCommand){if(!(i instanceof br.UpdateCommand))throw _r.DbBuildError.invalidCommand("Command 不是更新操作");n.applyOperator(i.operator,o,i.stringify())}else if("number"===a)n.set(o,i);else if("boolean"===a)n.set(o,i);else if("string"===a)n.set(o,i);else if("bigint"===a)n.set(o,i);else{if("function"===a)throw _r.DbBuildError.invalidParam(o,"不支持函数");if("symbol"===a)throw _r.DbBuildError.invalidParam(o,"不支持 symbol");if("undefined"===a)throw _r.DbBuildError.invalidParam(o,"不支持 undefined");if(null===i)n.set(o,i);else if(Array.isArray(i))n.set(o,i);else{new t(i,o).stringify(n)}}}return n},t.prototype.toJSON=function(){return this.stringify().emit()},t}();mr.UpdateRequest=Or;var Cr=i&&i.__assign||function(){return Cr=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},Cr.apply(this,arguments)};Object.defineProperty(hr,"__esModule",{value:!0}),hr.QueryBuilder=void 0;var Pr=ue(),Ar=mr,jr=de,xr=ir,Sr=function(){function t(t){this.collectionName=t,this.criteria={sort:[]}}return t.prototype.limit=function(t){return this.criteria.limit=t,this},t.prototype.skip=function(t){return this.criteria.skip=t,this},t.prototype.where=function(t){return this.criteria.match=t,this},t.prototype.projection=function(t){for(var n in t)t[n]?"object"!==e(t[n])&&(t[n]=1):t[n]=0;return this.criteria.projection=t,this},t.prototype.orderBy=function(t,e){return this.criteria.sort.push({field:t,sort:e}),this},t.prototype.update=function(t){return this.build(jr.DocumentAction.update,Cr(Cr({},this.baseOptions()),{$update:new Ar.UpdateRequest(t.data).toJSON()}))},t.prototype.set=function(t){return this.build(jr.DocumentAction.replace,Cr(Cr({},this.baseOptions()),{$replace:t.data}))},t.prototype.remove=function(){return this.build(jr.DocumentAction.delete,this.baseOptions())},t.prototype.get=function(){return this.build(jr.DocumentAction.queryList,Cr({$limit:100},this.findOptions()))},t.prototype.count=function(){return this.build(jr.DocumentAction.count,this.baseOptions())},t.prototype.baseOptions=function(){var t={};if(void 0!==this.criteria.match){var e=new Pr.QueryRequest(this.criteria.match);t.$match=e.toJSON()}return void 0!==this.criteria.limit&&(t.$limit=this.criteria.limit),t},t.prototype.findOptions=function(){var t=this.baseOptions();if(void 0!==this.criteria.projection&&(t.$project=this.criteria.projection),void 0!==this.criteria.sort){t.$sort={};for(var e=0,n=this.criteria.sort;e<n.length;e++){var r=n[e];t.$sort[r.field]=r.sort===jr.Sort.DESC?-1:1}}return void 0!==this.criteria.skip&&(t.$skip=this.criteria.skip),t},t.prototype.build=function(t,e){return xr.ActionBuilder.buildDocumentAction(t,this.collectionName,e)},t}();hr.QueryBuilder=Sr,Object.defineProperty(yr,"__esModule",{value:!0}),yr.DocumentBuilder=void 0;var Er=de,Rr=hr,Dr=function(){function t(t,e){this.collectionName=t,this.id=e}return t.prototype.update=function(t){return new Rr.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).update(t)},t.prototype.set=function(t){return new Rr.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).set(t)},t.prototype.remove=function(){return new Rr.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).remove()},t.prototype.get=function(){var t=new Rr.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).get();return t.action=Er.DocumentAction.query,t},t}();yr.DocumentBuilder=Dr,Object.defineProperty(cr,"__esModule",{value:!0}),cr.CollectionBuilder=void 0;var Mr=de,qr=L,Nr=ir,Ir=sr,Br=yr,kr=hr,Tr=function(){function t(t){this.collectionName=t}return t.prototype.add=function(t){return Array.isArray(t.data)?this.batchAdd(t):Nr.ActionBuilder.buildDocumentAction(Mr.DocumentAction.create,this.collectionName,t.data)},t.prototype.batchAdd=function(t){if(t.data.length>200)throw qr.DbBuildError.invalidParam("data","最大长度 200");var e={$create:t.data};return"boolean"==typeof t.ordered&&(e.$ordered=t.ordered),Nr.ActionBuilder.buildDocumentAction(Mr.DocumentAction.batchCreate,this.collectionName,e)},t.prototype.doc=function(t){return new Br.DocumentBuilder(this.collectionName,t)},t.prototype.limit=function(t){return new kr.QueryBuilder(this.collectionName).limit(t)},t.prototype.skip=function(t){return new kr.QueryBuilder(this.collectionName).skip(t)},t.prototype.where=function(t){return new kr.QueryBuilder(this.collectionName).where(t)},t.prototype.projection=function(t){return new kr.QueryBuilder(this.collectionName).projection(t)},t.prototype.orderBy=function(t,e){return new kr.QueryBuilder(this.collectionName).orderBy(t,e)},t.prototype.aggregate=function(){return new Ir.AggregateBuilder(this.collectionName)},t.prototype.get=function(){return new kr.QueryBuilder(this.collectionName).get()},t.prototype.count=function(){return new kr.QueryBuilder(this.collectionName).count()},t}();cr.CollectionBuilder=Tr,Object.defineProperty(R,"__esModule",{value:!0}),R.MongoBuilder=void 0;var Qr=D,Fr=de,Ur=ir,$r=cr,Lr=function(){function t(){this.command=new Qr.Command}return t.prototype.collection=function(t){return new $r.CollectionBuilder(t)},t.prototype.createCollection=function(t){return Ur.ActionBuilder.buildCollectionAction(Fr.CollectionAction.create,t)},t.prototype.getCollection=function(t){return Ur.ActionBuilder.buildCollectionAction(Fr.CollectionAction.query,t)},t.prototype.listCollection=function(t,e){return Ur.ActionBuilder.buildCollectionListQueryAction({$limit:null!=t?t:10,$skip:null!=e?e:0})},t.prototype.deleteCollection=function(t){return Ur.ActionBuilder.buildCollectionAction(Fr.CollectionAction.delete,t)},t}();R.MongoBuilder=Lr,function(t){var e=i&&i.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),n=i&&i.__exportStar||function(t,n){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||e(n,t,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.DbBuildError=t.CommandUtils=t.Command=t.AggregateRequest=t.UpdateRequest=t.QueryRequest=t.AggregateBuilder=t.QueryBuilder=t.DocumentBuilder=t.CollectionBuilder=t.MongoBuilder=void 0,n(S,t);var r=R;Object.defineProperty(t,"MongoBuilder",{enumerable:!0,get:function(){return r.MongoBuilder}});var o=cr;Object.defineProperty(t,"CollectionBuilder",{enumerable:!0,get:function(){return o.CollectionBuilder}});var a=yr;Object.defineProperty(t,"DocumentBuilder",{enumerable:!0,get:function(){return a.DocumentBuilder}});var u=hr;Object.defineProperty(t,"QueryBuilder",{enumerable:!0,get:function(){return u.QueryBuilder}});var c=sr;Object.defineProperty(t,"AggregateBuilder",{enumerable:!0,get:function(){return c.AggregateBuilder}});var s=ue();Object.defineProperty(t,"QueryRequest",{enumerable:!0,get:function(){return s.QueryRequest}});var l=mr;Object.defineProperty(t,"UpdateRequest",{enumerable:!0,get:function(){return l.UpdateRequest}});var p=$;Object.defineProperty(t,"AggregateRequest",{enumerable:!0,get:function(){return p.AggregateRequest}});var f=D;Object.defineProperty(t,"Command",{enumerable:!0,get:function(){return f.Command}});var d=ae();Object.defineProperty(t,"CommandUtils",{enumerable:!0,get:function(){return d.CommandUtils}});var y=L;Object.defineProperty(t,"DbBuildError",{enumerable:!0,get:function(){return y.DbBuildError}}),n(de,t)}(x);var Wr={},Hr={},Gr=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},zr=i&&i.__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=a.trys,(o=o.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(Hr,"__esModule",{value:!0}),Hr.WrapCallback=void 0;var Vr=p;Hr.WrapCallback=function(){return function(t,e,n){var r=n.value;n.value=function(t){return Gr(this,void 0,void 0,(function(){return zr(this,(function(e){return[2,(0,Vr.wrapCallback)(r,this)(t)]}))}))}}};var Jr={},Kr=i&&i.__decorate||function(t,n,r,o){var i,a=arguments.length,u=a<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,n,r,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(u=(a<3?i(u):a>3?i(n,r,u):i(n,r))||u);return a>3&&u&&Object.defineProperty(n,r,u),u},Yr=i&&i.__metadata||function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},Xr=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Zr=i&&i.__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=a.trys,(o=o.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(Jr,"__esModule",{value:!0}),Jr.Aggregate=void 0;var to=x,eo=Hr,no=p;Jr.Aggregate=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new to.AggregateBuilder(t)}return t.prototype.match=function(t){return this.builder.match(t),this},t.prototype.group=function(t){return this.builder.group(t),this},t.prototype.sample=function(t){return this.builder.sample(t),this},t.prototype.lookup=function(t){return this.builder.lookup(t),this},t.prototype.end=function(){return Xr(this,void 0,void 0,(function(){var t,e,n;return Zr(this,(function(r){switch(r.label){case 0:return t=this.builder.end().options,"POST",e="".concat(this.getCollectionPath(),"?aggregate"),[4,this.options.httpclient.request({method:"POST",path:e,data:t})];case 1:return n=r.sent(),[2,no.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},Kr([(0,eo.WrapCallback)(),Yr("design:type",Function),Yr("design:paramtypes",[]),Yr("design:returntype",Promise)],t.prototype,"end",null),t}();var ro={},oo={},io=i&&i.__decorate||function(t,n,r,o){var i,a=arguments.length,u=a<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,n,r,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(u=(a<3?i(u):a>3?i(n,r,u):i(n,r))||u);return a>3&&u&&Object.defineProperty(n,r,u),u},ao=i&&i.__metadata||function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},uo=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},co=i&&i.__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=a.trys,(o=o.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(oo,"__esModule",{value:!0}),oo.Query=void 0;var so=x,lo=Hr,po=p;oo.Query=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new so.QueryBuilder(t)}return t.prototype.limit=function(t){return this.builder.limit(t),this},t.prototype.skip=function(t){return this.builder.skip(t),this},t.prototype.where=function(t){return this.builder.where(t),this},t.prototype.projection=function(t){return this.builder.projection(t),this},t.prototype.field=function(t){return this.builder.projection(t),this},t.prototype.orderBy=function(t,e){return this.builder.orderBy(t,e),this},t.prototype.update=function(t){return uo(this,void 0,void 0,(function(){var e,n,r;return co(this,(function(o){switch(o.label){case 0:return"POST",e="".concat(this.getCollectionPath(),"?update"),n=this.builder.update(t).options,[4,this.options.httpclient.request({method:"POST",path:e,data:n})];case 1:return r=o.sent(),[2,po.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.set=function(t){return uo(this,void 0,void 0,(function(){var e,n,r;return co(this,(function(o){switch(o.label){case 0:return"POST",e="".concat(this.getCollectionPath(),"?replace"),n=this.builder.set(t).options,[4,this.options.httpclient.request({method:"POST",path:e,data:n})];case 1:return r=o.sent(),[2,po.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.remove=function(){return uo(this,void 0,void 0,(function(){var t,e,n;return co(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?delete"),e=this.builder.remove().options,[4,this.options.httpclient.request({method:"POST",path:t,data:e})];case 1:return n=r.sent(),[2,po.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.get=function(){return uo(this,void 0,void 0,(function(){var t,e,n;return co(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?query"),e=this.builder.get().options,[4,this.options.httpclient.request({method:"POST",path:t,data:e})];case 1:return n=r.sent(),[2,po.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.count=function(){return uo(this,void 0,void 0,(function(){var t,e,n;return co(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?count"),e=this.builder.count().options,[4,this.options.httpclient.request({method:"POST",path:t,data:e})];case 1:return n=r.sent(),[2,{total:po.ResponseUtil.handleResponse(n).count}]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},io([(0,lo.WrapCallback)(),ao("design:type",Function),ao("design:paramtypes",[Object]),ao("design:returntype",Promise)],t.prototype,"update",null),io([(0,lo.WrapCallback)(),ao("design:type",Function),ao("design:paramtypes",[Object]),ao("design:returntype",Promise)],t.prototype,"set",null),io([(0,lo.WrapCallback)(),ao("design:type",Function),ao("design:paramtypes",[]),ao("design:returntype",Promise)],t.prototype,"remove",null),io([(0,lo.WrapCallback)(),ao("design:type",Function),ao("design:paramtypes",[]),ao("design:returntype",Promise)],t.prototype,"get",null),io([(0,lo.WrapCallback)(),ao("design:type",Function),ao("design:paramtypes",[]),ao("design:returntype",Promise)],t.prototype,"count",null),t}();var fo=i&&i.__decorate||function(t,n,r,o){var i,a=arguments.length,u=a<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,n,r,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(u=(a<3?i(u):a>3?i(n,r,u):i(n,r))||u);return a>3&&u&&Object.defineProperty(n,r,u),u},yo=i&&i.__metadata||function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},ho=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},mo=i&&i.__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=a.trys,(o=o.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(ro,"__esModule",{value:!0}),ro.Document=void 0;var vo=Hr,go=f,_o=oo;ro.Document=function(){function t(t,e,n){this.collectionName=t,this.id=e,this.options=n}return t.prototype.update=function(t){return ho(this,void 0,void 0,(function(){return mo(this,(function(e){switch(e.label){case 0:return[4,this.query.update(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.set=function(t){return ho(this,void 0,void 0,(function(){return mo(this,(function(e){switch(e.label){case 0:return[4,this.query.set(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.remove=function(){return ho(this,void 0,void 0,(function(){return mo(this,(function(t){switch(t.label){case 0:return[4,this.query.remove()];case 1:return[2,t.sent()]}}))}))},t.prototype.get=function(){return ho(this,void 0,void 0,(function(){var t,e;return mo(this,(function(n){switch(n.label){case 0:return[4,this.query.get()];case 1:if(t=n.sent(),!(e=t[0])){if(this.options.throwOnNotFound)throw go.FaasError.NOT_FOUND_ERR("不存在_id 为 ".concat(this.id," 的文档"));return[2,null]}return[2,e]}}))}))},Object.defineProperty(t.prototype,"query",{get:function(){return new _o.Query(this.collectionName,this.options).where({_id:String(this.id)}).limit(1)},enumerable:!1,configurable:!0}),fo([(0,vo.WrapCallback)(),yo("design:type",Function),yo("design:paramtypes",[Object]),yo("design:returntype",Promise)],t.prototype,"update",null),fo([(0,vo.WrapCallback)(),yo("design:type",Function),yo("design:paramtypes",[Object]),yo("design:returntype",Promise)],t.prototype,"set",null),fo([(0,vo.WrapCallback)(),yo("design:type",Function),yo("design:paramtypes",[]),yo("design:returntype",Promise)],t.prototype,"remove",null),fo([(0,vo.WrapCallback)(),yo("design:type",Function),yo("design:paramtypes",[]),yo("design:returntype",Promise)],t.prototype,"get",null),t}();var bo=i&&i.__decorate||function(t,n,r,o){var i,a=arguments.length,u=a<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,n,r,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(u=(a<3?i(u):a>3?i(n,r,u):i(n,r))||u);return a>3&&u&&Object.defineProperty(n,r,u),u},wo=i&&i.__metadata||function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},Oo=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Co=i&&i.__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=a.trys,(o=o.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(Wr,"__esModule",{value:!0}),Wr.Collection=void 0;var Po=x,Ao=Hr,jo=p,xo=Jr,So=ro,Eo=oo;Wr.Collection=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new Po.CollectionBuilder(t)}return t.prototype.add=function(t){return Oo(this,void 0,void 0,(function(){var e,n,r;return Co(this,(function(o){switch(o.label){case 0:return e=this.builder.add(t).options,"POST",n=this.getDocumentPath(t.data._id),[4,this.options.httpclient.request({method:"POST",path:n,data:e})];case 1:return r=o.sent(),[2,jo.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.doc=function(t){return new So.Document(this.collectionName,t,this.options)},t.prototype.limit=function(t){return new Eo.Query(this.collectionName,this.options).limit(t)},t.prototype.skip=function(t){return new Eo.Query(this.collectionName,this.options).skip(t)},t.prototype.where=function(t){return new Eo.Query(this.collectionName,this.options).where(t)},t.prototype.projection=function(t){return new Eo.Query(this.collectionName,this.options).projection(t)},t.prototype.field=function(t){return new Eo.Query(this.collectionName,this.options).field(t)},t.prototype.orderBy=function(t,e){return new Eo.Query(this.collectionName,this.options).orderBy(t,e)},t.prototype.aggregate=function(){return new xo.Aggregate(this.collectionName,this.options)},t.prototype.get=function(){return Oo(this,void 0,void 0,(function(){return Co(this,(function(t){switch(t.label){case 0:return[4,new Eo.Query(this.collectionName,this.options).get()];case 1:return[2,t.sent()]}}))}))},t.prototype.count=function(){return Oo(this,void 0,void 0,(function(){return Co(this,(function(t){switch(t.label){case 0:return[4,new Eo.Query(this.collectionName,this.options).count()];case 1:return[2,t.sent()]}}))}))},t.prototype.getDocumentPath=function(t){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName,"?_id=").concat(t||"")},bo([(0,Ao.WrapCallback)(),wo("design:type",Function),wo("design:paramtypes",[Object]),wo("design:returntype",Promise)],t.prototype,"add",null),bo([(0,Ao.WrapCallback)(),wo("design:type",Function),wo("design:paramtypes",[]),wo("design:returntype",Promise)],t.prototype,"get",null),bo([(0,Ao.WrapCallback)(),wo("design:type",Function),wo("design:paramtypes",[]),wo("design:returntype",Promise)],t.prototype,"count",null),t}();var Ro=i&&i.__assign||function(){return Ro=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},Ro.apply(this,arguments)},Do=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Mo=i&&i.__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=a.trys,(o=o.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(j,"__esModule",{value:!0}),j.Database=void 0;var qo=x,No=f,Io=Wr,Bo=function(){function t(t){this.httpclient=t}return t.prototype.request=function(t){var e=t.method,n=t.path,r=t.data,o=t.headers;return Do(this,void 0,void 0,(function(){return Mo(this,(function(t){switch(t.label){case 0:return[4,this.httpclient.request({method:e,path:n,data:r,headers:Ro({"x-alipay-cloud-mode":"mongo","x-data-api-type":"mongo","x-expire-timestamp":"".concat(Date.now()+6e4)},o)})];case 1:return[2,t.sent()]}}))}))},t}(),ko=function(){function t(t){this.command=new qo.Command,this.options=Ro(Ro({},t),{httpclient:new Bo(t.httpclient)})}return t.prototype.collection=function(t){if(!t)throw No.FaasError.INVALID_PARAM_ERR("collectionName","不能为空");return new Io.Collection(t,this.options)},t}();j.Database=ko;var To={},Qo=i&&i.__assign||function(){return Qo=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},Qo.apply(this,arguments)},Fo=i&&i.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Uo=i&&i.__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=a.trys,(o=o.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(To,"__esModule",{value:!0}),To.Storage=void 0;var $o=f,Lo=p,Wo=function(){function t(t){this.options=t}return t.prototype.getUploadPath=function(t){return"/".concat(t,"?upload_url")},t.prototype.getDownloadPath=function(t){return"/".concat(t,"?download_url&expire=3600")},t.prototype.getBatchDeletePath=function(){return"/?delete"},t.prototype.getBatchDownloadPath=function(){return"/?download_url"},t.prototype.checkCloudPath=function(t){return"string"!=typeof t?"必须为字符串":(t=t.trim())?t.startsWith("/")?"不能以 / 开头":t.includes("//")?"不能包含连续的 /":t.length>850?"长度不能超过 850 字节":void 0:"不能为空字符串"},t.prototype.checkFileID=function(t){return"string"!=typeof t?"必须为字符串":(t=t.trim())?void 0:"不能为空字符串"},t.prototype.formatFileID=function(t){return"cloud://".concat(this.options.toEnvId,"/").concat(t.replace(/^\/+/,""))},t.prototype.getCloudPathFromFileID=function(t){var e=t.trim().replace(/^cloud:\/\//,""),n=e.indexOf("/");if(n<=0)throw $o.FaasError.INVALID_PARAM_ERR("fileID","不合法");var r=e.substring(0,n),o=e.substring(n+1);return r!==this.options.toEnvId&&console.warn("file ".concat(t," does not belong to env ").concat(this.options.toEnvId)),o},t.prototype.uploadFile=function(t){return Fo(this,void 0,void 0,(function(){var e,n,r,o,i,a;return Uo(this,(function(u){switch(u.label){case 0:if(e=this.checkCloudPath(t.cloudPath))throw $o.FaasError.INVALID_PARAM_ERR("cloudPath",e);return n=this.getUploadPath(t.cloudPath.trim()),[4,this.request({method:"GET",path:n})];case 1:return r=u.sent(),o=Lo.ResponseUtil.handleResponse(r),i=this.formatFileID(o.file_id),[4,this.options.fileUploader.upload({fileID:i,uploadURL:o.upload_url,fileContent:t.fileContent})];case 2:if(200!==(a=u.sent()).statusCode)throw $o.FaasError.STORAGE_ERR(-1,"上传文件 ".concat(o.upload_url," 失败"),r.requestID);return[2,{fileID:i,statusCode:a.statusCode}]}}))}))},t.prototype.downloadFile=function(t){return Fo(this,void 0,void 0,(function(){var e,n,r,o,i,a;return Uo(this,(function(u){switch(u.label){case 0:if(e=this.checkFileID(t.fileID))throw $o.FaasError.INVALID_PARAM_ERR("fileID",e);return n=this.getCloudPathFromFileID(t.fileID),r=this.getDownloadPath(n),[4,this.request({method:"GET",path:r})];case 1:return o=u.sent(),i=Lo.ResponseUtil.handleResponse(o),[4,this.options.fileUploader.download({fileID:t.fileID,downloadURL:i.download_url})];case 2:if(200!==(a=u.sent()).statusCode)throw $o.FaasError.STORAGE_ERR(-1,"下载文件 ".concat(i.download_url," 失败"),o.requestID);return[2,a]}}))}))},t.prototype.deleteFile=function(t){return Fo(this,void 0,void 0,(function(){var e,n,r,o,i,a,u,c,s,l=this;return Uo(this,(function(p){switch(p.label){case 0:if(e=Array.isArray(t)?t:t.fileList,!Array.isArray(e)||0===e.length)throw $o.FaasError.INVALID_PARAM_ERR("fileList","不能为空数组");for(n=[],r=0,o=e;r<o.length;r++){if(i=o[r],a=this.checkFileID(i))throw $o.FaasError.INVALID_PARAM_ERR("fileID",a);u=this.getCloudPathFromFileID(i),n.push(u)}return c=this.getBatchDeletePath(),[4,this.request({method:"POST",path:c,data:{file_list:n}})];case 1:return s=p.sent(),[2,{fileList:Lo.ResponseUtil.handleResponse(s).file_list.map((function(t){return{fileID:l.formatFileID(t.file_id),status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.getTempFileURL=function(t){return Fo(this,void 0,void 0,(function(){var e,n,r,o,i,a,u,c,s,l=this;return Uo(this,(function(p){switch(p.label){case 0:if(e=Array.isArray(t)?t:t.fileList,!Array.isArray(e)||0===e.length)throw $o.FaasError.INVALID_PARAM_ERR("fileList","不能为空数组");if(e.length>50)throw $o.FaasError.INVALID_PARAM_ERR("fileList","最大长度 50");for(n=[],r=0,o=e;r<o.length;r++){if(i=o[r],a=this.checkFileID(i))throw $o.FaasError.INVALID_PARAM_ERR("fileID",a);u=this.getCloudPathFromFileID(i),n.push({file_id:u,expire:600})}return c=this.getBatchDownloadPath(),[4,this.request({method:"POST",path:c,data:{file_list:n}})];case 1:return s=p.sent(),[2,{fileList:Lo.ResponseUtil.handleResponse(s).file_list.map((function(t){return{fileID:l.formatFileID(t.file_id),tempFileURL:t.download_url,status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.request=function(t){var e=t.method,n=t.path,r=t.data,o=t.headers;return Fo(this,void 0,void 0,(function(){return Uo(this,(function(t){switch(t.label){case 0:return[4,this.options.httpclient.request({method:e,path:n,data:r,headers:Qo({"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":"".concat(Date.now()+6e4)},o)})];case 1:return[2,t.sent()]}}))}))},t}();To.Storage=Wo,Object.defineProperty(s,"__esModule",{value:!0}),s.WebSDK=void 0;var Ho=l,Go=w,zo=j,Vo=To,Jo=function(){function t(){}return t.createCallFunction=function(t){return(0,Go.createCallFunction)(t)},t.createCallContainer=function(t){return(0,Ho.createCallContainer)(t)},t.createDatabase=function(t){return new zo.Database(t)},t.createStorage=function(t){return new Vo.Storage(t)},t}();s.WebSDK=Jo;var Ko={};Object.defineProperty(Ko,"__esModule",{value:!0}),function(t){var e=i&&i.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),n=i&&i.__exportStar||function(t,n){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||e(n,t,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.ResponseUtil=t.FaasError=t.Query=t.Aggregate=t.Collection=t.Document=t.Database=t.Storage=t.WebSDK=void 0;var r=s;Object.defineProperty(t,"WebSDK",{enumerable:!0,get:function(){return r.WebSDK}});var o=To;Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return o.Storage}});var a=j;Object.defineProperty(t,"Database",{enumerable:!0,get:function(){return a.Database}});var u=ro;Object.defineProperty(t,"Document",{enumerable:!0,get:function(){return u.Document}});var c=Wr;Object.defineProperty(t,"Collection",{enumerable:!0,get:function(){return c.Collection}});var l=Jr;Object.defineProperty(t,"Aggregate",{enumerable:!0,get:function(){return l.Aggregate}});var d=oo;Object.defineProperty(t,"Query",{enumerable:!0,get:function(){return d.Query}});var y=f;Object.defineProperty(t,"FaasError",{enumerable:!0,get:function(){return y.FaasError}});var h=p;Object.defineProperty(t,"ResponseUtil",{enumerable:!0,get:function(){return h.ResponseUtil}}),n(Ko,t)}(c);var Yo={exports:{}};var Xo,Zo={exports:{}};function ti(){return Xo||(Xo=1,function(t,e){var n;t.exports=(n=n||function(t,e){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==i&&i.crypto&&(n=i.crypto),!n)try{n=require("crypto")}catch(t){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(t){var e=o(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=u.WordArray=c.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||p).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var u=0;u<o;u+=4)e[r+u>>>2]=n[u>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(r());return new s.init(e,t)}}),l=a.enc={},p=l.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new s.init(n,e/2)}},f=l.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new s.init(n,e)}},d=l.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},y=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,u=i/(4*a),c=(u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0))*a,l=t.min(4*c,i);if(c){for(var p=0;p<c;p+=a)this._doProcessBlock(o,p);n=o.splice(0,c),r.sigBytes-=l}return new s.init(n,l)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});u.Hasher=y.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new h.HMAC.init(t,n).finalize(e)}}});var h=a.algo={};return a}(Math),n)}(Zo)),Zo.exports}!function(t,e){t.exports=ti().enc.Hex}(Yo);var ei=a(Yo.exports),ni={exports:{}},ri={exports:{}};!function(t,e){var n;t.exports=(n=ti(),function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,a=e.algo,u=[],c=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var r=2,o=0;o<64;)e(r)&&(o<8&&(u[o]=n(t.pow(r,.5))),c[o]=n(t.pow(r,1/3)),o++),r++}();var s=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(u.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],l=n[5],p=n[6],f=n[7],d=0;d<64;d++){if(d<16)s[d]=0|t[e+d];else{var y=s[d-15],h=(y<<25|y>>>7)^(y<<14|y>>>18)^y>>>3,m=s[d-2],v=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;s[d]=h+s[d-7]+v+s[d-16]}var g=r&o^r&i^o&i,_=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),b=f+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&l^~u&p)+c[d]+s[d];f=p,p=l,l=u,u=a+b|0,a=i,i=o,o=r,r=b+(_+g)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0,n[5]=n[5]+l|0,n[6]=n[6]+p|0,n[7]=n[7]+f|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)}(ri);var oi,ii=ri.exports,ai=a(ii),ui={exports:{}};!function(t,e){var n;t.exports=(n=ti(),oi||(oi=1,function(t,e){var n,r,o;t.exports=(r=(n=ti()).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=o.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var i=this._oKey=e.clone(),a=this._iKey=e.clone(),u=i.words,c=a.words,s=0;s<n;s++)u[s]^=1549556828,c[s]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})))}(ui)),n.HmacSHA256)}(ni);var ci,si=a(ni.exports);!function(t){t.WEB="WEB",t.ALIPAY_MINI="ALIPAY_MINI",t.WEICHAT_MINI="WEICHAT_MINI"}(ci||(ci={}));var li=function(){function t(){}return t.sign=function(e){for(var n=e.signedHeaders.join(";"),r="",o=0,i=e.signedHeaders;o<i.length;o++){var a=i[o],u=e.headers[a];r+="".concat(a,":").concat(u,"\n")}var c=t.createHash(e.body||""),s=e.method.toUpperCase()+"\n"+e.path+"\n"+e.query+"\n"+r+"\n"+n+"\n"+c+"\n",l="HMAC-SHA256",p=t.createHash(s),f="".concat(l,"\n").concat(e.timestamp,"\n").concat(p,"\n"),d=t.createSha256(f,e.secretKey);return"".concat(l," Credential=").concat(e.secretId,", SignedHeaders=").concat(n,", Signature=").concat(d)},t.createSha256=function(t,e){return void 0===e&&(e=""),si(t,e).toString(ei)},t.createHash=function(t){return ai(t).toString(ei)},t}(),pi=function(){function t(){}return t.detectRuntime=function(){return window||void 0===("undefined"==typeof my?"undefined":e(my))?window||void 0===("undefined"==typeof wx?"undefined":e(wx))?ci.WEB:ci.WEICHAT_MINI:ci.ALIPAY_MINI},t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},t.parseUrl=function(t,e){if(e===ci.WEB)return new URL(t);var n=t.match(/^(https?):\/\/([^/]+)(\/[^?]+)?(\?[^#]+)?/)||[],r=n[1],o=n[2],i=n[3],a=n[4];return{protocol:r||"",host:o||"",pathname:"".concat(i||""),search:a||""}},t}();var fi=function(){function t(t,e){this.req=t,this.config=e}return Object.defineProperty(t.prototype,"requestId",{get:function(){return this.req.requestOptions.headers["x-trace-id"]},enumerable:!1,configurable:!0}),t}(),di=function(){function t(){}return t.prototype.request=function(t,e){return r(this,void 0,void 0,(function(){var r,i,a;return o(this,(function(o){switch(o.label){case 0:return[4,fetch(t,n({mode:"cors"},e))];case 1:return r=o.sent(),i={},r.headers.forEach((function(t,e){i[e]=t})),a={status:r.status},[4,r.json()];case 2:return[2,(a.data=o.sent(),a.headers=i,a)]}}))}))},t}(),yi=function(){function t(){}return t.prototype.request=function(t,e){return r(this,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,my.request({url:t,method:(null==e?void 0:e.method)||"GET",data:null==e?void 0:e.body,headers:null==e?void 0:e.headers,dataType:"json"})];case 1:return[2,r.sent()];case 2:throw n=r.sent(),console.error(n),new Error("error: ".concat(n.error,", message: ").concat(n.errorMessage));case 3:return[2]}}))}))},t}(),hi=function(){function t(){}return t.prototype.request=function(t,e){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,new Promise((function(n,r){wx.request({url:t,method:(null==e?void 0:e.method)||"GET",data:null==e?void 0:e.body,header:null==e?void 0:e.headers,dataType:"json",success:function(t){n({status:t.statusCode,data:t.data,headers:t.header})},reject:function(t){r(new Error("error: ".concat(t.errno,", message: ").concat(t.errMsg)))}})}))]}))}))},t}(),mi=function(){function t(){}return t.default=function(t){if(!this.singleton)switch(t){case ci.ALIPAY_MINI:this.singleton=new yi;break;case ci.WEB:this.singleton=new di;break;case ci.WEICHAT_MINI:this.singleton=new hi;break;default:throw new Error("未知运行环境".concat(t))}return this.singleton},t}();function vi(t,e){return r(this,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:return[4,e()];case 1:return o.sent(),n=t.config.fetch||mi.default(t.config.runtime),r=t,[4,n.request(t.req.url,t.req.requestOptions)];case 2:return r.res=o.sent(),t.result={status:t.res.status,requestID:t.requestId,headers:t.res.headers,data:t.res.data},[2]}}))}))}function gi(t,e){return r(this,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e()];case 1:return r.sent(),[3,3];case 2:throw n=r.sent(),c.FaasError.NETWORK_ERR(n,t.requestId);case 3:return[2]}}))}))}function _i(t){return function(e,i){return r(this,void 0,void 0,(function(){var r,a,u,c,s;return o(this,(function(o){switch(o.label){case 0:return r=Date.now(),a=pi.parseUrl(e.req.url,e.config.runtime),u={authorization:"","x-from-app-id":e.config.appId,"x-from-env-id":e.config.envId,"x-to-env-id":e.config.envId,"x-from-instance-id":"".concat(r),"x-from-function-name":e.config.functionName,"x-client-timestamp":"".concat(r)},t.length>0&&t.forEach((function(t){var n,r=null===(n=e.req.requestOptions.headers)||void 0===n?void 0:n[t];r&&(u[t]=r)})),c=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))}(["x-from-app-id","x-from-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp","x-to-env-id"],t,!0).sort(),s={path:a.pathname,query:a.search.substring(1),secretId:e.config.secretId,secretKey:e.config.secretKey,method:e.req.requestOptions.method,headers:u,body:e.req.requestOptions.body,timestamp:r,signedHeaders:c},u.authorization=li.sign(s),e.req.requestOptions.headers=n(n({},u),e.req.requestOptions.headers),[4,i()];case 1:return o.sent(),[2]}}))}))}}var bi=function(){function t(t,e){var n;this.config=t,this.handler=(n=e,function(t,e){var r=-1;return function o(i){if(i<=r)return Promise.reject(new Error("next() called multiple times"));r=i;var a=n[i];if(i===n.length&&(a=e),!a)return Promise.resolve();try{return Promise.resolve(a(t,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)})}return t.prototype.request=function(t){var e=t.method,n=t.path,i=t.data,a=t.headers;return r(this,void 0,void 0,(function(){var t,r,u,c;return o(this,(function(o){switch(o.label){case 0:return t=this.config.endpoint+n,r=i?JSON.stringify(i):i,u=pi.generateUUID(),a=Object.assign({"x-alipay-callid":u,"x-request-id":u,"x-alipay-source":"web,web-sdk","content-type":"application/json"},a),c=new fi({url:t,requestOptions:{method:e,body:r,headers:a}},this.config),[4,this.handler(c)];case 1:return o.sent(),[2,c.result]}}))}))},t.createFunctionHttpclient=function(e){return new t(e,[gi,_i(["x-to-function-name"]),vi])},t}(),wi=function(){function t(t){var e=t.resourceEnv||t.envId,n=t.resourceAppid||t.appId;this.config={endpoint:t.endpoint||"https://".concat(e,".api-hz.cloudbasefunction.cn"),secretId:t.secretId,secretKey:t.secretKey,appId:n,envId:e,fetch:t.fetch,runtime:t.runtime||pi.detectRuntime(),functionName:""}}return t.prototype.init=function(){},t.prototype.callFunction=function(t){var e;return r(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return r=n(n({},this.config),{envId:(null===(e=t.config)||void 0===e?void 0:e.env)||this.config.envId,functionName:t.name}),i=bi.createFunctionHttpclient(r),[4,c.WebSDK.createCallFunction({type:"web",httpclient:i})(t)];case 1:return[2,o.sent()]}}))}))},t}();t.Cloud=wi}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).cloud={})}(this,(function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}var n=function(t,e){return n=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])},n(t,e)};var r=function(){return r=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},r.apply(this,arguments)};function o(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())}))}function i(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=a.trys,(o=o.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])}}}"function"==typeof SuppressedError&&SuppressedError;var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c,s={},l={},p={},f={},d={},y=a&&a.__extends||(c=function(t,e){return(c=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)},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}c(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(d,"__esModule",{value:!0}),d.FaasError=void 0;var h=function(t){function e(n,r){var o=t.call(this,r)||this;return o.name="FaasError",o.error=n,o.errorMessage=r,Object.setPrototypeOf(o,e.prototype),o}return y(e,t),Object.defineProperty(e.prototype,"errCode",{get:function(){return this.error},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errMsg",{get:function(){return this.message},enumerable:!1,configurable:!0}),e.INVALID_PARAM_ERR=function(t,n){return new e(60001,"无效入参,参数 ".concat(t," ").concat(n))},e.NOT_FOUND_ERR=function(t){return new e(60001,t)},e.SERVER_ERR=function(t,n,r,o){var i=new e(t,n);return i.requestID=r,i.httpStatus=o,i},e.STORAGE_ERR=function(t,n,r){var o=new e(t,n);return o.requestID=r,o},e.NETWORK_ERR=function(t,n){var r=new e(-1,t.toString());return r.requestID=n,r},e}(Error);d.FaasError=h;var m=a&&a.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};Object.defineProperty(f,"__esModule",{value:!0}),f.ResponseUtil=f.wrapCallback=void 0;var v=d;f.wrapCallback=function(t,e){return void 0===e&&(e=void 0),function(n){if(!((null==n?void 0:n.complete)||(null==n?void 0:n.success)||(null==n?void 0:n.fail)))return t.call(e,n);var r=n.complete,o=n.success,i=n.fail,a=m(n,["complete","success","fail"]);t.call(e,a).then((function(t){return null==o||o(t),t}),(function(t){return null==i||i(t),t})).then((function(t){null==r||r(t)}))}};var g=function(){function t(){}return t.handleResponse=function(t){if(200!==t.status){var e=t.data||{code:-1,message:"未知异常"},n=e.code,r=e.message;throw v.FaasError.SERVER_ERR(n,r,t.requestID,t.status)}return t.data.data},t}();f.ResponseUtil=g;var _=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},b=a&&a.__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=a.trys,(o=o.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(p,"__esModule",{value:!0}),p.createCallContainer=void 0;var w=f;p.createCallContainer=function(t){return(0,w.wrapCallback)((function(e){return _(void 0,void 0,void 0,(function(){return b(this,(function(n){throw new Error("not implemented in "+t.type+" with "+e)}))}))}))};var O={},C=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},P=a&&a.__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=a.trys,(o=o.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(O,"__esModule",{value:!0}),O.createCallFunction=void 0;var A=d,j=f;O.createCallFunction=function(t){var e=t.httpclient;return(0,j.wrapCallback)((function(t){return C(void 0,void 0,void 0,(function(){var n,r,o,i,a;return P(this,(function(u){switch(u.label){case 0:if(!t.name)throw A.FaasError.INVALID_PARAM_ERR("name","缺失");return n={"x-to-function-name":t.name,"x-alipay-cloud-mode":"function"},"POST","/functions/invokeFunction",[4,e.request({method:"POST",path:"/functions/invokeFunction",data:t.data,headers:n})];case 1:if(200!==(r=u.sent()).status)throw o=-1,i="",(a=r.data)&&(o=a.errCode,i=a.errMsg,a.errDetail&&(i+=",详情:".concat(a.errDetail))),A.FaasError.SERVER_ERR(o,i,r.requestID,r.status);return[2,{requestID:r.requestID,result:r.data}]}}))}))}))};var x={},S={},E={};Object.defineProperty(E,"__esModule",{value:!0});var R,D={},M={},I={},N={},q=a&&a.__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])})(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)});Object.defineProperty(N,"__esModule",{value:!0}),N.AggregateCommand=N.QueryCommand=N.UpdateCommand=N.AbstractCommand=void 0;var B=function(){};N.AbstractCommand=B;var T=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return q(e,t),e}(B);N.UpdateCommand=T;var k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return q(e,t),e}(B);N.QueryCommand=k;var U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return q(e,t),e}(B);N.AggregateCommand=U;var F,Q,L,$={},H={},W=a&&a.__extends||(F=function(t,e){return(F=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)},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}F(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(H,"__esModule",{value:!0}),H.DbBuildError=H.ErrorCode=void 0,(L=Q||(H.ErrorCode=Q={})).INVALID_PARAM="INVALID_PARAM",L.INVALID_COMMAND="INVALID_COMMAND";var G=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return W(e,t),e.create=function(t,n){var r=new e(n);return r.code=t,r},e.invalidParam=function(t,n){return e.create(Q.INVALID_PARAM,'无效入参 "'.concat(t,'", ').concat(n))},e.invalidCommand=function(t){return e.create(Q.INVALID_COMMAND,t)},e}(Error);H.DbBuildError=G,Object.defineProperty($,"__esModule",{value:!0}),$.AggregateRequest=void 0;var z=H,V=N,J=function(){function t(t,e){void 0===e&&(e=""),this.data=t,this.prefix=e}return t.prototype.stringify=function(){var n=this;if(this.data instanceof V.AbstractCommand){if(!(this.data instanceof V.AggregateCommand))throw z.DbBuildError.invalidCommand("Command 不是聚合操作");return this.data.stringify()}if(null===this.data)return this.data;if(Array.isArray(this.data))return this.data.map((function(e,r){return new t(e,"".concat(n.prefix,".$.").concat(r)).stringify()}));switch(e(this.data)){case"number":case"boolean":case"string":case"bigint":return this.data;case"function":throw z.DbBuildError.invalidParam(this.prefix,"不支持函数");case"symbol":throw z.DbBuildError.invalidParam(this.prefix,"不支持 symbol");case"undefined":throw z.DbBuildError.invalidParam(this.prefix,"不支持 undefined");default:var r={};for(var o in this.data){var i=this.prefix?"".concat(this.prefix,".").concat(o):o,a=new t(this.data[o],i);r[o]=a.stringify()}return r}},t.prototype.toJSON=function(){return this.stringify()},t}();$.AggregateRequest=J;var K,Y=a&&a.__extends||(K=function(t,e){return(K=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)},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}K(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(I,"__esModule",{value:!0}),I.AndAggregateCommand=void 0;var X=$,Z=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map((function(t){return new X.AggregateRequest(t).toJSON()})),n}return Y(e,t),e.prototype.pushCommand=function(t){this.commands.push(new X.AggregateRequest(t).toJSON())},e.prototype.stringify=function(){return{$and:this.commands}},e}(N.AggregateCommand);I.AndAggregateCommand=Z;var tt,et={},nt=a&&a.__extends||(tt=function(t,e){return(tt=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)},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}tt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(et,"__esModule",{value:!0}),et.AvgAggregateCommand=void 0;var rt=$,ot=function(t){function e(e){var n=t.call(this)||this;return n.val=new rt.AggregateRequest(e).toJSON(),n}return nt(e,t),e.prototype.stringify=function(){return{$avg:this.val}},e}(N.AggregateCommand);et.AvgAggregateCommand=ot;var it={},at=a&&a.__extends||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)}}();Object.defineProperty(it,"__esModule",{value:!0}),it.CountAggregateCommand=void 0;var ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return at(e,t),e.prototype.stringify=function(){return{$count:{}}},e}(N.AggregateCommand);it.CountAggregateCommand=ut;var ct={},st=a&&a.__extends||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])})(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)}}();Object.defineProperty(ct,"__esModule",{value:!0}),ct.EqAggregateCommand=void 0;var lt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return st(e,t),e.prototype.stringify=function(){return{$eq:this.val}},e}(N.AggregateCommand);ct.EqAggregateCommand=lt;var pt,ft={},dt={},yt={},ht={},mt={};function vt(){if(pt)return mt;pt=1;var t,e=a&&a.__extends||(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)},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)});Object.defineProperty(mt,"__esModule",{value:!0}),mt.AndCommand=void 0;var n=N,r=ue(),o=function(t){function n(e){var n=t.call(this)||this;return n.commands=e.map(r.CommandUtils.stringify),n}return e(n,t),n.prototype.pushCommand=function(t){this.commands.push(r.CommandUtils.stringify(t))},n.prototype.stringify=function(){return{$and:this.commands}},n}(n.QueryCommand);return mt.AndCommand=o,mt}var gt,_t={};function bt(){if(gt)return _t;gt=1;var t=a&&a.__extends||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)}}();Object.defineProperty(_t,"__esModule",{value:!0}),_t.OrCommand=void 0;var e=N,n=ue(),r=function(e){function r(t){var r=e.call(this)||this;return r.commands=t.map(n.CommandUtils.stringify),r}return t(r,e),r.prototype.pushCommand=function(t){this.commands.push(n.CommandUtils.stringify(t))},r.prototype.stringify=function(){return{$or:this.commands}},r}(e.QueryCommand);return _t.OrCommand=r,_t}var wt={},Ot=a&&a.__extends||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)}}();Object.defineProperty(wt,"__esModule",{value:!0}),wt.EqCommand=void 0;var Ct=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Ot(e,t),e.prototype.stringify=function(){return{$eq:this.val}},e}(N.QueryCommand);wt.EqCommand=Ct;var Pt={},At=a&&a.__extends||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])})(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)}}();Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.NeqCommand=void 0;var jt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return At(e,t),e.prototype.stringify=function(){return{$ne:this.val}},e}(N.QueryCommand);Pt.NeqCommand=jt;var xt={},St=a&&a.__extends||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)}}();Object.defineProperty(xt,"__esModule",{value:!0}),xt.LtCommand=void 0;var Et=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return St(e,t),e.prototype.stringify=function(){return{$lt:this.val}},e}(N.QueryCommand);xt.LtCommand=Et;var Rt={},Dt=a&&a.__extends||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)}}();Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.LteCommand=void 0;var Mt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Dt(e,t),e.prototype.stringify=function(){return{$lte:this.val}},e}(N.QueryCommand);Rt.LteCommand=Mt;var It={},Nt=a&&a.__extends||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)}}();Object.defineProperty(It,"__esModule",{value:!0}),It.GtCommand=void 0;var qt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Nt(e,t),e.prototype.stringify=function(){return{$gt:this.val}},e}(N.QueryCommand);It.GtCommand=qt;var Bt={},Tt=a&&a.__extends||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)}}();Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.GteCommand=void 0;var kt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Tt(e,t),e.prototype.stringify=function(){return{$gte:this.val}},e}(N.QueryCommand);Bt.GteCommand=kt;var Ut={},Ft=a&&a.__extends||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)}}();Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.InCommand=void 0;var Qt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Ft(e,t),e.prototype.stringify=function(){return{$in:this.val}},e}(N.QueryCommand);Ut.InCommand=Qt;var Lt={},$t=a&&a.__extends||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)}}();Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.NinCommand=void 0;var Ht=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return $t(e,t),e.prototype.stringify=function(){return{$nin:this.val}},e}(N.QueryCommand);Lt.NinCommand=Ht;var Wt={},Gt=a&&a.__extends||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)}}();Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.ExistsCommand=void 0;var zt=function(t){function e(e){var n=t.call(this)||this;return n.exists=e,n}return Gt(e,t),e.prototype.stringify=function(){return{$exists:this.exists}},e}(N.QueryCommand);Wt.ExistsCommand=zt;var Vt={},Jt=a&&a.__extends||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])})(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)}}();Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.ModCommand=void 0;var Kt=function(t){function e(e,n){var r=t.call(this)||this;return r.divisor=e,r.remainder=n,r}return Jt(e,t),e.prototype.stringify=function(){return{$mod:[this.divisor,this.remainder]}},e}(N.QueryCommand);Vt.ModCommand=Kt;var Yt={},Xt=a&&a.__extends||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)}}();Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.AllCommand=void 0;var Zt=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Xt(e,t),e.prototype.stringify=function(){return{$all:this.val}},e}(N.QueryCommand);Yt.AllCommand=Zt;var te,ee,ne,re,oe={};function ie(){if(te)return oe;te=1;var t=a&&a.__extends||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)}}();Object.defineProperty(oe,"__esModule",{value:!0}),oe.ElemMatchCommand=void 0;var e=N,n=ue(),r=function(e){function r(t){var r=e.call(this)||this;return r.val=n.CommandUtils.stringify(t),r}return t(r,e),r.prototype.stringify=function(){return{$elemMatch:this.val}},r}(e.QueryCommand);return oe.ElemMatchCommand=r,oe}function ae(){if(ee)return ht;ee=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.QueryChain=void 0;var t=vt(),e=bt(),n=wt,r=Pt,o=xt,i=Rt,a=It,u=Bt,c=Ut,s=Lt,l=Wt,p=Vt,f=Yt,d=ie(),y=ue(),h=function(){function h(t){this.lastCmd=t}return h.prototype.appendCommand=function(e){return e=y.CommandUtils.unchain(e),this.lastCmd instanceof t.AndCommand?this.lastCmd.pushCommand(e):this.lastCmd=new t.AndCommand([this.lastCmd,e]),this},h.prototype.and=function(t){return this.appendCommand(t)},h.prototype.or=function(t){return t=y.CommandUtils.unchain(t),this.lastCmd instanceof e.OrCommand?this.lastCmd.pushCommand(t):this.lastCmd=new e.OrCommand([this.lastCmd,t]),this},h.prototype.not=function(t){return this.appendCommand(t)},h.prototype.nor=function(t){return this.appendCommand(t)},h.prototype.eq=function(t){return this.appendCommand(new n.EqCommand(t))},h.prototype.neq=function(t){return this.appendCommand(new r.NeqCommand(t))},h.prototype.lt=function(t){return this.appendCommand(new o.LtCommand(t))},h.prototype.lte=function(t){return this.appendCommand(new i.LteCommand(t))},h.prototype.gt=function(t){return this.appendCommand(new a.GtCommand(t))},h.prototype.gte=function(t){return this.appendCommand(new u.GteCommand(t))},h.prototype.in=function(t){return this.appendCommand(new c.InCommand(t))},h.prototype.nin=function(t){return this.appendCommand(new s.NinCommand(t))},h.prototype.exists=function(t){return this.appendCommand(new l.ExistsCommand(t))},h.prototype.mod=function(t,e){return this.appendCommand(new p.ModCommand(t,e))},h.prototype.all=function(t){return this.appendCommand(new f.AllCommand(t))},h.prototype.elemMatch=function(t){return this.appendCommand(new d.ElemMatchCommand(y.CommandUtils.unchain(t)))},h.prototype.size=function(t){return this.appendCommand(t)},h}();return ht.QueryChain=h,ht}function ue(){if(ne)return yt;ne=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.CommandUtils=void 0;var t=N,e=ce(),n=ae(),r=function(){function r(){}return r.stringify=function(n){return(n=r.unchain(n))instanceof t.QueryCommand?n.stringify():new e.QueryRequest(n).toJSON()},r.unchain=function(t){return t instanceof n.QueryChain?t.lastCmd:t},r}();return yt.CommandUtils=r,yt}function ce(){if(re)return dt;re=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.QueryRequest=void 0;var t=N,n=H,r=ue(),o=function(){function o(t,e){void 0===e&&(e=""),this.query=t,this.prefix=e}return o.prototype.stringify=function(){var i=this,a={},u=r.CommandUtils.unchain(this.query),c=e(u);if(u instanceof t.QueryCommand)return u.stringify();if(Array.isArray(u))return u.map((function(t,e){return new o(t,"".concat(i.prefix,".$.").concat(e)).stringify()}));if("number"===c)return u;if("boolean"===c)return u;if("string"===c)return u;if("bigint"===c)return u;if("function"===c)throw n.DbBuildError.invalidParam(this.prefix,"不支持函数");if("symbol"===c)throw n.DbBuildError.invalidParam(this.prefix,"不支持 symbol");if("undefined"===c)throw n.DbBuildError.invalidParam(this.prefix,"不支持 undefined");if(null===u)return u;for(var s in u){var l=this.prefix?"".concat(this.prefix,".").concat(s):s,p=new o(u[s],l);a[s]=p.stringify()}return a},o.prototype.toJSON=function(){return this.stringify()},o}();return dt.QueryRequest=o,dt}var se,le,pe,fe,de,ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.PipelineStageName=ye.Target=ye.DocumentAction=ye.CollectionAction=ye.Sort=void 0,function(t){t.DESC="desc",t.ASC="asc"}(se||(ye.Sort=se={})),function(t){t.update="update",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create"}(le||(ye.CollectionAction=le={})),function(t){t.update="update",t.replace="replace",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create",t.batchCreate="batchCreate",t.count="count",t.aggregate="aggregate"}(pe||(ye.DocumentAction=pe={})),function(t){t.collection="collection",t.document="document"}(fe||(ye.Target=fe={})),function(t){t.match="$match",t.group="$group",t.sample="$sample",t.lookup="$lookup"}(de||(ye.PipelineStageName=de={})),Object.defineProperty(ft,"__esModule",{value:!0}),ft.AggregatePipeline=void 0;var he=$,me=ce(),ve=ye,ge=H,_e=function(){function t(){this.pipeline=[]}return t.prototype.match=function(t){return this.pushStage(ve.PipelineStageName.match,t),this},t.prototype.group=function(t){return this.pushStage(ve.PipelineStageName.group,t),this},t.prototype.sample=function(t){return this.pushStage(ve.PipelineStageName.sample,t),this},t.prototype.lookup=function(t){return this.pushStage(ve.PipelineStageName.lookup,t),this},t.prototype.done=function(){return this.pipeline.map((function(t){var e;switch(t.name){case ve.PipelineStageName.match:return{$match:new me.QueryRequest(t.param).toJSON()};case ve.PipelineStageName.sample:case ve.PipelineStageName.lookup:return(e={})[t.name]=t.param,e;case ve.PipelineStageName.group:return{$group:new he.AggregateRequest(t.param).toJSON()};default:var n=t.name;throw ge.DbBuildError.invalidParam(n,"不支持的 aggregate 操作")}}))},t.prototype.pushStage=function(t,e){this.pipeline.push({name:t,param:e})},t}();ft.AggregatePipeline=_e;var be={},we=a&&a.__extends||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)}}();Object.defineProperty(be,"__esModule",{value:!0}),be.ExprCommand=void 0;var Oe=$,Ce=function(t){function e(e){var n=t.call(this)||this;return n.commands=new Oe.AggregateRequest(e).toJSON(),n}return we(e,t),e.prototype.stringify=function(){return{$expr:this.commands}},e}(N.QueryCommand);be.ExprCommand=Ce;var Pe={},Ae=a&&a.__extends||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)}}();Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.GtAggregateCommand=void 0;var je=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Ae(e,t),e.prototype.stringify=function(){return{$gt:this.val}},e}(N.AggregateCommand);Pe.GtAggregateCommand=je;var xe={},Se=a&&a.__extends||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])})(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)}}();Object.defineProperty(xe,"__esModule",{value:!0}),xe.GteAggregateCommand=void 0;var Ee=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Se(e,t),e.prototype.stringify=function(){return{$gte:this.val}},e}(N.AggregateCommand);xe.GteAggregateCommand=Ee;var Re={},De=a&&a.__extends||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)}}();Object.defineProperty(Re,"__esModule",{value:!0}),Re.LtAggregateCommand=void 0;var Me=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return De(e,t),e.prototype.stringify=function(){return{$lt:this.val}},e}(N.AggregateCommand);Re.LtAggregateCommand=Me;var Ie={},Ne=a&&a.__extends||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])})(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)}}();Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.LteAggregateCommand=void 0;var qe=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Ne(e,t),e.prototype.stringify=function(){return{$lte:this.val}},e}(N.AggregateCommand);Ie.LteAggregateCommand=qe;var Be={},Te=a&&a.__extends||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])})(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)}}();Object.defineProperty(Be,"__esModule",{value:!0}),Be.MaxAggregateCommand=void 0;var ke=$,Ue=function(t){function e(e){var n=t.call(this)||this;return n.val=new ke.AggregateRequest(e).toJSON(),n}return Te(e,t),e.prototype.stringify=function(){return{$max:this.val}},e}(N.AggregateCommand);Be.MaxAggregateCommand=Ue;var Fe={},Qe=a&&a.__extends||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])})(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)}}();Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.MinAggregateCommand=void 0;var Le=$,$e=function(t){function e(e){var n=t.call(this)||this;return n.val=new Le.AggregateRequest(e).toJSON(),n}return Qe(e,t),e.prototype.stringify=function(){return{$min:this.val}},e}(N.AggregateCommand);Fe.MinAggregateCommand=$e;var He={},We=a&&a.__extends||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])})(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)}}();Object.defineProperty(He,"__esModule",{value:!0}),He.NeqAggregateCommand=void 0;var Ge=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return We(e,t),e.prototype.stringify=function(){return{$ne:this.val}},e}(N.AggregateCommand);He.NeqAggregateCommand=Ge;var ze={},Ve=a&&a.__extends||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])})(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)}}();Object.defineProperty(ze,"__esModule",{value:!0}),ze.OrAggregateCommand=void 0;var Je=$,Ke=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map((function(t){return new Je.AggregateRequest(t).toJSON()})),n}return Ve(e,t),e.prototype.pushCommand=function(t){this.commands.push(new Je.AggregateRequest(t).toJSON())},e.prototype.stringify=function(){return{$or:this.commands}},e}(N.AggregateCommand);ze.OrAggregateCommand=Ke;var Ye={},Xe=a&&a.__extends||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])})(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)}}();Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.SumAggregateCommand=void 0;var Ze=$,tn=function(t){function e(e){var n=t.call(this)||this;return n.val=new Ze.AggregateRequest(e).toJSON(),n}return Xe(e,t),e.prototype.stringify=function(){return{$sum:this.val}},e}(N.AggregateCommand);Ye.SumAggregateCommand=tn;var en={},nn=a&&a.__extends||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])})(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)}}();Object.defineProperty(en,"__esModule",{value:!0}),en.SetCommand=void 0;var rn=function(t){function e(e){var n=t.call(this)||this;return n.data=e,n}return nn(e,t),Object.defineProperty(e.prototype,"operator",{get:function(){return"$set"},enumerable:!1,configurable:!0}),e.prototype.stringify=function(){return this.data},e}(N.UpdateCommand);en.SetCommand=rn;var on={},an=a&&a.__extends||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])})(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)}}();Object.defineProperty(on,"__esModule",{value:!0}),on.IncCommand=void 0;var un=function(t){function e(e){var n=t.call(this)||this;return n.num=e,n}return an(e,t),Object.defineProperty(e.prototype,"operator",{get:function(){return"$inc"},enumerable:!1,configurable:!0}),e.prototype.stringify=function(){return this.num},e}(N.UpdateCommand);on.IncCommand=un;var cn,sn={},ln=a&&a.__extends||(cn=function(t,e){return cn=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])},cn(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}cn(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(sn,"__esModule",{value:!0}),sn.NotCommand=void 0;var pn=N,fn=ue(),dn=function(t){function e(e){var n=t.call(this)||this;return n.command=fn.CommandUtils.stringify(e),n}return ln(e,t),e.prototype.stringify=function(){return{$not:this.command.stringify()}},e}(pn.QueryCommand);sn.NotCommand=dn;var yn={},hn=a&&a.__extends||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)}}();Object.defineProperty(yn,"__esModule",{value:!0}),yn.NorCommand=void 0;var mn=N,vn=ue(),gn=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map(vn.CommandUtils.stringify),n}return hn(e,t),e.prototype.pushCommand=function(t){this.commands.push(vn.CommandUtils.stringify(t))},e.prototype.stringify=function(){return{$nor:this.commands}},e}(mn.QueryCommand);yn.NorCommand=gn;var _n={},bn=a&&a.__extends||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)}}();Object.defineProperty(_n,"__esModule",{value:!0}),_n.SizeCommand=void 0;var wn=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return bn(e,t),e.prototype.stringify=function(){return{$size:this.val}},e}(N.QueryCommand);_n.SizeCommand=wn,Object.defineProperty(M,"__esModule",{value:!0}),M.Command=M.AggregateCommandFactory=void 0;var On=I,Cn=et,Pn=it,An=ct,jn=ft,xn=be,Sn=Pe,En=xe,Rn=Re,Dn=Ie,Mn=Be,In=Fe,Nn=He,qn=ze,Bn=Ye,Tn=en,kn=on,Un=ae(),Fn=bt(),Qn=vt(),Ln=ue(),$n=sn,Hn=yn,Wn=wt,Gn=Pt,zn=xt,Vn=Rt,Jn=It,Kn=Bt,Yn=Ut,Xn=Lt,Zn=Wt,tr=Vt,er=Yt,nr=ie(),rr=_n,or=function(){function t(){}return t.prototype.pipeline=function(){return new jn.AggregatePipeline},t.prototype.avg=function(t){return new Cn.AvgAggregateCommand(t)},t.prototype.count=function(){return new Pn.CountAggregateCommand},t.prototype.max=function(t){return new Mn.MaxAggregateCommand(t)},t.prototype.min=function(t){return new In.MinAggregateCommand(t)},t.prototype.sum=function(t){return new Bn.SumAggregateCommand(t)},t.prototype.and=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=Array.isArray(t[0])?t[0]:t,new On.AndAggregateCommand(t)},t.prototype.or=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=Array.isArray(t[0])?t[0]:t,new qn.OrAggregateCommand(t)},t.prototype.eq=function(t){return new An.EqAggregateCommand(t)},t.prototype.neq=function(t){return new Nn.NeqAggregateCommand(t)},t.prototype.lt=function(t){return new Rn.LtAggregateCommand(t)},t.prototype.lte=function(t){return new Dn.LteAggregateCommand(t)},t.prototype.gt=function(t){return new Sn.GtAggregateCommand(t)},t.prototype.gte=function(t){return new En.GteAggregateCommand(t)},t}();M.AggregateCommandFactory=or;var ir=function(){function t(){this.aggregate=new or}return t.prototype.set=function(t){return new Tn.SetCommand(t)},t.prototype.inc=function(t){return new kn.IncCommand(t)},t.prototype.expr=function(t){return new xn.ExprCommand(t)},t.prototype.and=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t=Array.isArray(t[0])?t[0]:t;var n=new Qn.AndCommand(t.map(Ln.CommandUtils.unchain));return new Un.QueryChain(n)},t.prototype.or=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t=Array.isArray(t[0])?t[0]:t;var n=new Fn.OrCommand(t.map(Ln.CommandUtils.unchain));return new Un.QueryChain(n)},t.prototype.not=function(t){var e=new $n.NotCommand(Ln.CommandUtils.unchain(t));return new Un.QueryChain(e)},t.prototype.nor=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t=Array.isArray(t[0])?t[0]:t;var n=new Hn.NorCommand(t.map(Ln.CommandUtils.unchain));return new Un.QueryChain(n)},t.prototype.eq=function(t){return new Un.QueryChain(new Wn.EqCommand(t))},t.prototype.neq=function(t){return new Un.QueryChain(new Gn.NeqCommand(t))},t.prototype.lt=function(t){return new Un.QueryChain(new zn.LtCommand(t))},t.prototype.lte=function(t){return new Un.QueryChain(new Vn.LteCommand(t))},t.prototype.gt=function(t){return new Un.QueryChain(new Jn.GtCommand(t))},t.prototype.gte=function(t){return new Un.QueryChain(new Kn.GteCommand(t))},t.prototype.in=function(t){return new Un.QueryChain(new Yn.InCommand(t))},t.prototype.nin=function(t){return new Un.QueryChain(new Xn.NinCommand(t))},t.prototype.exists=function(t){return new Un.QueryChain(new Zn.ExistsCommand(t))},t.prototype.mod=function(t,e){return new Un.QueryChain(new tr.ModCommand(t,e))},t.prototype.all=function(t){return new Un.QueryChain(new er.AllCommand(t))},t.prototype.elemMatch=function(t){return new Un.QueryChain(new nr.ElemMatchCommand(Ln.CommandUtils.unchain(t)))},t.prototype.size=function(t){return new Un.QueryChain(new rr.SizeCommand(t))},t}();M.Command=ir;var ar={};Object.defineProperty(ar,"__esModule",{value:!0}),ar.ActionBuilder=void 0;var ur=ye,cr=function(){function t(){}return t.buildCollectionAction=function(t,e){return{target:ur.Target.collection,action:t,collectionName:e}},t.buildCollectionListQueryAction=function(t){return{target:ur.Target.collection,action:ur.CollectionAction.queryList,options:t}},t.buildDocumentAction=function(t,e,n){return{target:ur.Target.document,action:t,collectionName:e,options:n}},t}();ar.ActionBuilder=cr;var sr={},lr={},pr=a&&a.__extends||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])})(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)}}();Object.defineProperty(lr,"__esModule",{value:!0}),lr.AggregateBuilder=void 0;var fr=ye,dr=ar,yr=function(t){function e(e){var n=t.call(this)||this;return n.collectionName=e,n}return pr(e,t),e.prototype.end=function(){var t={$aggregate:this.done()};return dr.ActionBuilder.buildDocumentAction(fr.DocumentAction.aggregate,this.collectionName,t)},e}(ft.AggregatePipeline);lr.AggregateBuilder=yr;var hr={},mr={},vr={},gr={};Object.defineProperty(gr,"__esModule",{value:!0}),gr.Operator=void 0;var _r=function(){function t(){this.res={}}return t.prototype.set=function(t,e){this.res.$set=this.res.$set||{},this.res.$set[t]=e},t.prototype.applyOperator=function(t,e,n){this.res[t]=this.res[t]||{},this.res[t][e]=n},t.prototype.emit=function(){return this.res},t}();gr.Operator=_r,Object.defineProperty(vr,"__esModule",{value:!0}),vr.UpdateRequest=void 0;var br=H,wr=N,Or=gr,Cr=function(){function t(t,e){void 0===e&&(e=""),this.data=t,this.prefix=e}return t.prototype.stringify=function(n){for(var r in n=n||new Or.Operator,this.data){var o=this.prefix?"".concat(this.prefix,".").concat(r):r,i=this.data[r],a=e(i);if(i instanceof wr.AbstractCommand){if(!(i instanceof wr.UpdateCommand))throw br.DbBuildError.invalidCommand("Command 不是更新操作");n.applyOperator(i.operator,o,i.stringify())}else if("number"===a)n.set(o,i);else if("boolean"===a)n.set(o,i);else if("string"===a)n.set(o,i);else if("bigint"===a)n.set(o,i);else{if("function"===a)throw br.DbBuildError.invalidParam(o,"不支持函数");if("symbol"===a)throw br.DbBuildError.invalidParam(o,"不支持 symbol");if("undefined"===a)throw br.DbBuildError.invalidParam(o,"不支持 undefined");if(null===i)n.set(o,i);else if(Array.isArray(i))n.set(o,i);else{new t(i,o).stringify(n)}}}return n},t.prototype.toJSON=function(){return this.stringify().emit()},t}();vr.UpdateRequest=Cr;var Pr=a&&a.__assign||function(){return Pr=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},Pr.apply(this,arguments)};Object.defineProperty(mr,"__esModule",{value:!0}),mr.QueryBuilder=void 0;var Ar=ce(),jr=vr,xr=ye,Sr=ar,Er=function(){function t(t){this.collectionName=t,this.criteria={sort:[]}}return t.prototype.limit=function(t){return this.criteria.limit=t,this},t.prototype.skip=function(t){return this.criteria.skip=t,this},t.prototype.where=function(t){return this.criteria.match=t,this},t.prototype.projection=function(t){for(var n in t)t[n]?"object"!==e(t[n])&&(t[n]=1):t[n]=0;return this.criteria.projection=t,this},t.prototype.orderBy=function(t,e){return this.criteria.sort.push({field:t,sort:e}),this},t.prototype.update=function(t){return this.build(xr.DocumentAction.update,Pr(Pr({},this.baseOptions()),{$update:new jr.UpdateRequest(t.data).toJSON()}))},t.prototype.set=function(t){return this.build(xr.DocumentAction.replace,Pr(Pr({},this.baseOptions()),{$replace:t.data}))},t.prototype.remove=function(){return this.build(xr.DocumentAction.delete,this.baseOptions())},t.prototype.get=function(){return this.build(xr.DocumentAction.queryList,Pr({$limit:100},this.findOptions()))},t.prototype.count=function(){return this.build(xr.DocumentAction.count,this.baseOptions())},t.prototype.baseOptions=function(){var t={};if(void 0!==this.criteria.match){var e=new Ar.QueryRequest(this.criteria.match);t.$match=e.toJSON()}return void 0!==this.criteria.limit&&(t.$limit=this.criteria.limit),t},t.prototype.findOptions=function(){var t=this.baseOptions();if(void 0!==this.criteria.projection&&(t.$project=this.criteria.projection),void 0!==this.criteria.sort){t.$sort={};for(var e=0,n=this.criteria.sort;e<n.length;e++){var r=n[e];t.$sort[r.field]=r.sort===xr.Sort.DESC?-1:1}}return void 0!==this.criteria.skip&&(t.$skip=this.criteria.skip),t},t.prototype.build=function(t,e){return Sr.ActionBuilder.buildDocumentAction(t,this.collectionName,e)},t}();mr.QueryBuilder=Er,Object.defineProperty(hr,"__esModule",{value:!0}),hr.DocumentBuilder=void 0;var Rr=ye,Dr=mr,Mr=function(){function t(t,e){this.collectionName=t,this.id=e}return t.prototype.update=function(t){return new Dr.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).update(t)},t.prototype.set=function(t){return new Dr.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).set(t)},t.prototype.remove=function(){return new Dr.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).remove()},t.prototype.get=function(){var t=new Dr.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).get();return t.action=Rr.DocumentAction.query,t},t}();hr.DocumentBuilder=Mr,Object.defineProperty(sr,"__esModule",{value:!0}),sr.CollectionBuilder=void 0;var Ir=ye,Nr=H,qr=ar,Br=lr,Tr=hr,kr=mr,Ur=function(){function t(t){this.collectionName=t}return t.prototype.add=function(t){return Array.isArray(t.data)?this.batchAdd(t):qr.ActionBuilder.buildDocumentAction(Ir.DocumentAction.create,this.collectionName,t.data)},t.prototype.batchAdd=function(t){if(t.data.length>200)throw Nr.DbBuildError.invalidParam("data","最大长度 200");var e={$create:t.data};return"boolean"==typeof t.ordered&&(e.$ordered=t.ordered),qr.ActionBuilder.buildDocumentAction(Ir.DocumentAction.batchCreate,this.collectionName,e)},t.prototype.doc=function(t){return new Tr.DocumentBuilder(this.collectionName,t)},t.prototype.limit=function(t){return new kr.QueryBuilder(this.collectionName).limit(t)},t.prototype.skip=function(t){return new kr.QueryBuilder(this.collectionName).skip(t)},t.prototype.where=function(t){return new kr.QueryBuilder(this.collectionName).where(t)},t.prototype.projection=function(t){return new kr.QueryBuilder(this.collectionName).projection(t)},t.prototype.orderBy=function(t,e){return new kr.QueryBuilder(this.collectionName).orderBy(t,e)},t.prototype.aggregate=function(){return new Br.AggregateBuilder(this.collectionName)},t.prototype.get=function(){return new kr.QueryBuilder(this.collectionName).get()},t.prototype.count=function(){return new kr.QueryBuilder(this.collectionName).count()},t}();sr.CollectionBuilder=Ur,Object.defineProperty(D,"__esModule",{value:!0}),D.MongoBuilder=void 0;var Fr=M,Qr=ye,Lr=ar,$r=sr,Hr=function(){function t(){this.command=new Fr.Command}return t.prototype.collection=function(t){return new $r.CollectionBuilder(t)},t.prototype.createCollection=function(t){return Lr.ActionBuilder.buildCollectionAction(Qr.CollectionAction.create,t)},t.prototype.getCollection=function(t){return Lr.ActionBuilder.buildCollectionAction(Qr.CollectionAction.query,t)},t.prototype.listCollection=function(t,e){return Lr.ActionBuilder.buildCollectionListQueryAction({$limit:null!=t?t:10,$skip:null!=e?e:0})},t.prototype.deleteCollection=function(t){return Lr.ActionBuilder.buildCollectionAction(Qr.CollectionAction.delete,t)},t}();D.MongoBuilder=Hr,function(t){var e=a&&a.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),n=a&&a.__exportStar||function(t,n){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||e(n,t,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.DbBuildError=t.CommandUtils=t.Command=t.AggregateRequest=t.UpdateRequest=t.QueryRequest=t.AggregateBuilder=t.QueryBuilder=t.DocumentBuilder=t.CollectionBuilder=t.MongoBuilder=void 0,n(E,t);var r=D;Object.defineProperty(t,"MongoBuilder",{enumerable:!0,get:function(){return r.MongoBuilder}});var o=sr;Object.defineProperty(t,"CollectionBuilder",{enumerable:!0,get:function(){return o.CollectionBuilder}});var i=hr;Object.defineProperty(t,"DocumentBuilder",{enumerable:!0,get:function(){return i.DocumentBuilder}});var u=mr;Object.defineProperty(t,"QueryBuilder",{enumerable:!0,get:function(){return u.QueryBuilder}});var c=lr;Object.defineProperty(t,"AggregateBuilder",{enumerable:!0,get:function(){return c.AggregateBuilder}});var s=ce();Object.defineProperty(t,"QueryRequest",{enumerable:!0,get:function(){return s.QueryRequest}});var l=vr;Object.defineProperty(t,"UpdateRequest",{enumerable:!0,get:function(){return l.UpdateRequest}});var p=$;Object.defineProperty(t,"AggregateRequest",{enumerable:!0,get:function(){return p.AggregateRequest}});var f=M;Object.defineProperty(t,"Command",{enumerable:!0,get:function(){return f.Command}});var d=ue();Object.defineProperty(t,"CommandUtils",{enumerable:!0,get:function(){return d.CommandUtils}});var y=H;Object.defineProperty(t,"DbBuildError",{enumerable:!0,get:function(){return y.DbBuildError}}),n(ye,t)}(S);var Wr={},Gr={},zr=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Vr=a&&a.__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=a.trys,(o=o.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(Gr,"__esModule",{value:!0}),Gr.WrapCallback=void 0;var Jr=f;Gr.WrapCallback=function(){return function(t,e,n){var r=n.value;n.value=function(t){return zr(this,void 0,void 0,(function(){return Vr(this,(function(e){return[2,(0,Jr.wrapCallback)(r,this)(t)]}))}))}}};var Kr={},Yr=a&&a.__decorate||function(t,n,r,o){var i,a=arguments.length,u=a<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,n,r,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(u=(a<3?i(u):a>3?i(n,r,u):i(n,r))||u);return a>3&&u&&Object.defineProperty(n,r,u),u},Xr=a&&a.__metadata||function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},Zr=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},to=a&&a.__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=a.trys,(o=o.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(Kr,"__esModule",{value:!0}),Kr.Aggregate=void 0;var eo=S,no=Gr,ro=f;Kr.Aggregate=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new eo.AggregateBuilder(t)}return t.prototype.match=function(t){return this.builder.match(t),this},t.prototype.group=function(t){return this.builder.group(t),this},t.prototype.sample=function(t){return this.builder.sample(t),this},t.prototype.lookup=function(t){return this.builder.lookup(t),this},t.prototype.end=function(){return Zr(this,void 0,void 0,(function(){var t,e,n;return to(this,(function(r){switch(r.label){case 0:return t=this.builder.end().options,"POST",e="".concat(this.getCollectionPath(),"?aggregate"),[4,this.options.httpclient.request({method:"POST",path:e,data:t})];case 1:return n=r.sent(),[2,ro.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},Yr([(0,no.WrapCallback)(),Xr("design:type",Function),Xr("design:paramtypes",[]),Xr("design:returntype",Promise)],t.prototype,"end",null),t}();var oo={},io={},ao=a&&a.__decorate||function(t,n,r,o){var i,a=arguments.length,u=a<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,n,r,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(u=(a<3?i(u):a>3?i(n,r,u):i(n,r))||u);return a>3&&u&&Object.defineProperty(n,r,u),u},uo=a&&a.__metadata||function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},co=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},so=a&&a.__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=a.trys,(o=o.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(io,"__esModule",{value:!0}),io.Query=void 0;var lo=S,po=Gr,fo=f;io.Query=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new lo.QueryBuilder(t)}return t.prototype.limit=function(t){return this.builder.limit(t),this},t.prototype.skip=function(t){return this.builder.skip(t),this},t.prototype.where=function(t){return this.builder.where(t),this},t.prototype.projection=function(t){return this.builder.projection(t),this},t.prototype.field=function(t){return this.builder.projection(t),this},t.prototype.orderBy=function(t,e){return this.builder.orderBy(t,e),this},t.prototype.update=function(t){return co(this,void 0,void 0,(function(){var e,n,r;return so(this,(function(o){switch(o.label){case 0:return"POST",e="".concat(this.getCollectionPath(),"?update"),n=this.builder.update(t).options,[4,this.options.httpclient.request({method:"POST",path:e,data:n})];case 1:return r=o.sent(),[2,fo.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.set=function(t){return co(this,void 0,void 0,(function(){var e,n,r;return so(this,(function(o){switch(o.label){case 0:return"POST",e="".concat(this.getCollectionPath(),"?replace"),n=this.builder.set(t).options,[4,this.options.httpclient.request({method:"POST",path:e,data:n})];case 1:return r=o.sent(),[2,fo.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.remove=function(){return co(this,void 0,void 0,(function(){var t,e,n;return so(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?delete"),e=this.builder.remove().options,[4,this.options.httpclient.request({method:"POST",path:t,data:e})];case 1:return n=r.sent(),[2,fo.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.get=function(){return co(this,void 0,void 0,(function(){var t,e,n;return so(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?query"),e=this.builder.get().options,[4,this.options.httpclient.request({method:"POST",path:t,data:e})];case 1:return n=r.sent(),[2,fo.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.count=function(){return co(this,void 0,void 0,(function(){var t,e,n;return so(this,(function(r){switch(r.label){case 0:return"POST",t="".concat(this.getCollectionPath(),"?count"),e=this.builder.count().options,[4,this.options.httpclient.request({method:"POST",path:t,data:e})];case 1:return n=r.sent(),[2,{total:fo.ResponseUtil.handleResponse(n).count}]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},ao([(0,po.WrapCallback)(),uo("design:type",Function),uo("design:paramtypes",[Object]),uo("design:returntype",Promise)],t.prototype,"update",null),ao([(0,po.WrapCallback)(),uo("design:type",Function),uo("design:paramtypes",[Object]),uo("design:returntype",Promise)],t.prototype,"set",null),ao([(0,po.WrapCallback)(),uo("design:type",Function),uo("design:paramtypes",[]),uo("design:returntype",Promise)],t.prototype,"remove",null),ao([(0,po.WrapCallback)(),uo("design:type",Function),uo("design:paramtypes",[]),uo("design:returntype",Promise)],t.prototype,"get",null),ao([(0,po.WrapCallback)(),uo("design:type",Function),uo("design:paramtypes",[]),uo("design:returntype",Promise)],t.prototype,"count",null),t}();var yo=a&&a.__decorate||function(t,n,r,o){var i,a=arguments.length,u=a<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,n,r,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(u=(a<3?i(u):a>3?i(n,r,u):i(n,r))||u);return a>3&&u&&Object.defineProperty(n,r,u),u},ho=a&&a.__metadata||function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},mo=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},vo=a&&a.__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=a.trys,(o=o.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(oo,"__esModule",{value:!0}),oo.Document=void 0;var go=Gr,_o=d,bo=io;oo.Document=function(){function t(t,e,n){this.collectionName=t,this.id=e,this.options=n}return t.prototype.update=function(t){return mo(this,void 0,void 0,(function(){return vo(this,(function(e){switch(e.label){case 0:return[4,this.query.update(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.set=function(t){return mo(this,void 0,void 0,(function(){return vo(this,(function(e){switch(e.label){case 0:return[4,this.query.set(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.remove=function(){return mo(this,void 0,void 0,(function(){return vo(this,(function(t){switch(t.label){case 0:return[4,this.query.remove()];case 1:return[2,t.sent()]}}))}))},t.prototype.get=function(){return mo(this,void 0,void 0,(function(){var t,e;return vo(this,(function(n){switch(n.label){case 0:return[4,this.query.get()];case 1:if(t=n.sent(),!(e=t[0])){if(this.options.throwOnNotFound)throw _o.FaasError.NOT_FOUND_ERR("不存在_id 为 ".concat(this.id," 的文档"));return[2,null]}return[2,e]}}))}))},Object.defineProperty(t.prototype,"query",{get:function(){return new bo.Query(this.collectionName,this.options).where({_id:String(this.id)}).limit(1)},enumerable:!1,configurable:!0}),yo([(0,go.WrapCallback)(),ho("design:type",Function),ho("design:paramtypes",[Object]),ho("design:returntype",Promise)],t.prototype,"update",null),yo([(0,go.WrapCallback)(),ho("design:type",Function),ho("design:paramtypes",[Object]),ho("design:returntype",Promise)],t.prototype,"set",null),yo([(0,go.WrapCallback)(),ho("design:type",Function),ho("design:paramtypes",[]),ho("design:returntype",Promise)],t.prototype,"remove",null),yo([(0,go.WrapCallback)(),ho("design:type",Function),ho("design:paramtypes",[]),ho("design:returntype",Promise)],t.prototype,"get",null),t}();var wo=a&&a.__decorate||function(t,n,r,o){var i,a=arguments.length,u=a<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,r):o;if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,n,r,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(u=(a<3?i(u):a>3?i(n,r,u):i(n,r))||u);return a>3&&u&&Object.defineProperty(n,r,u),u},Oo=a&&a.__metadata||function(t,n){if("object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},Co=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Po=a&&a.__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=a.trys,(o=o.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(Wr,"__esModule",{value:!0}),Wr.Collection=void 0;var Ao=S,jo=Gr,xo=f,So=Kr,Eo=oo,Ro=io;Wr.Collection=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new Ao.CollectionBuilder(t)}return t.prototype.add=function(t){return Co(this,void 0,void 0,(function(){var e,n,r;return Po(this,(function(o){switch(o.label){case 0:return e=this.builder.add(t).options,"POST",n=this.getDocumentPath(t.data._id),[4,this.options.httpclient.request({method:"POST",path:n,data:e})];case 1:return r=o.sent(),[2,xo.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.doc=function(t){return new Eo.Document(this.collectionName,t,this.options)},t.prototype.limit=function(t){return new Ro.Query(this.collectionName,this.options).limit(t)},t.prototype.skip=function(t){return new Ro.Query(this.collectionName,this.options).skip(t)},t.prototype.where=function(t){return new Ro.Query(this.collectionName,this.options).where(t)},t.prototype.projection=function(t){return new Ro.Query(this.collectionName,this.options).projection(t)},t.prototype.field=function(t){return new Ro.Query(this.collectionName,this.options).field(t)},t.prototype.orderBy=function(t,e){return new Ro.Query(this.collectionName,this.options).orderBy(t,e)},t.prototype.aggregate=function(){return new So.Aggregate(this.collectionName,this.options)},t.prototype.get=function(){return Co(this,void 0,void 0,(function(){return Po(this,(function(t){switch(t.label){case 0:return[4,new Ro.Query(this.collectionName,this.options).get()];case 1:return[2,t.sent()]}}))}))},t.prototype.count=function(){return Co(this,void 0,void 0,(function(){return Po(this,(function(t){switch(t.label){case 0:return[4,new Ro.Query(this.collectionName,this.options).count()];case 1:return[2,t.sent()]}}))}))},t.prototype.getDocumentPath=function(t){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName,"?_id=").concat(t||"")},wo([(0,jo.WrapCallback)(),Oo("design:type",Function),Oo("design:paramtypes",[Object]),Oo("design:returntype",Promise)],t.prototype,"add",null),wo([(0,jo.WrapCallback)(),Oo("design:type",Function),Oo("design:paramtypes",[]),Oo("design:returntype",Promise)],t.prototype,"get",null),wo([(0,jo.WrapCallback)(),Oo("design:type",Function),Oo("design:paramtypes",[]),Oo("design:returntype",Promise)],t.prototype,"count",null),t}();var Do=a&&a.__assign||function(){return Do=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},Do.apply(this,arguments)},Mo=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Io=a&&a.__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=a.trys,(o=o.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(x,"__esModule",{value:!0}),x.Database=void 0;var No=S,qo=d,Bo=Wr,To=function(){function t(t){this.httpclient=t}return t.prototype.request=function(t){var e=t.method,n=t.path,r=t.data,o=t.headers;return Mo(this,void 0,void 0,(function(){return Io(this,(function(t){switch(t.label){case 0:return[4,this.httpclient.request({method:e,path:n,data:r,headers:Do({"x-alipay-cloud-mode":"mongo","x-data-api-type":"mongo","x-expire-timestamp":"".concat(Date.now()+6e4)},o)})];case 1:return[2,t.sent()]}}))}))},t}(),ko=function(){function t(t){this.command=new No.Command,this.options=Do(Do({},t),{httpclient:new To(t.httpclient)})}return t.prototype.collection=function(t){if(!t)throw qo.FaasError.INVALID_PARAM_ERR("collectionName","不能为空");return new Bo.Collection(t,this.options)},t}();x.Database=ko;var Uo={},Fo=a&&a.__assign||function(){return Fo=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},Fo.apply(this,arguments)},Qo=a&&a.__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){t.done?o(t.value):function(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Lo=a&&a.__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=a.trys,(o=o.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(Uo,"__esModule",{value:!0}),Uo.Storage=void 0;var $o=d,Ho=f,Wo=function(){function t(t){this.options=t}return t.prototype.getUploadPath=function(t){return"/".concat(t,"?upload_url")},t.prototype.getDownloadPath=function(t){return"/".concat(t,"?download_url&expire=3600")},t.prototype.getBatchDeletePath=function(){return"/?delete"},t.prototype.getBatchDownloadPath=function(){return"/?download_url"},t.prototype.checkCloudPath=function(t){return"string"!=typeof t?"必须为字符串":(t=t.trim())?t.startsWith("/")?"不能以 / 开头":t.includes("//")?"不能包含连续的 /":t.length>850?"长度不能超过 850 字节":void 0:"不能为空字符串"},t.prototype.checkFileID=function(t){return"string"!=typeof t?"必须为字符串":(t=t.trim())?void 0:"不能为空字符串"},t.prototype.formatFileID=function(t){return"cloud://".concat(this.options.toEnvId,"/").concat(t.replace(/^\/+/,""))},t.prototype.getCloudPathFromFileID=function(t){var e=t.trim().replace(/^cloud:\/\//,""),n=e.indexOf("/");if(n<=0)throw $o.FaasError.INVALID_PARAM_ERR("fileID","不合法");var r=e.substring(0,n),o=e.substring(n+1);return r!==this.options.toEnvId&&console.warn("file ".concat(t," does not belong to env ").concat(this.options.toEnvId)),o},t.prototype.uploadFile=function(t){return Qo(this,void 0,void 0,(function(){var e,n,r,o,i,a;return Lo(this,(function(u){switch(u.label){case 0:if(e=this.checkCloudPath(t.cloudPath))throw $o.FaasError.INVALID_PARAM_ERR("cloudPath",e);return n=this.getUploadPath(t.cloudPath.trim()),[4,this.request({method:"GET",path:n})];case 1:return r=u.sent(),o=Ho.ResponseUtil.handleResponse(r),i=this.formatFileID(o.file_id),[4,this.options.fileUploader.upload({fileID:i,uploadURL:o.upload_url,fileContent:t.fileContent})];case 2:if(200!==(a=u.sent()).statusCode)throw $o.FaasError.STORAGE_ERR(-1,"上传文件 ".concat(o.upload_url," 失败"),r.requestID);return[2,{fileID:i,statusCode:a.statusCode}]}}))}))},t.prototype.downloadFile=function(t){return Qo(this,void 0,void 0,(function(){var e,n,r,o,i,a;return Lo(this,(function(u){switch(u.label){case 0:if(e=this.checkFileID(t.fileID))throw $o.FaasError.INVALID_PARAM_ERR("fileID",e);return n=this.getCloudPathFromFileID(t.fileID),r=this.getDownloadPath(n),[4,this.request({method:"GET",path:r})];case 1:return o=u.sent(),i=Ho.ResponseUtil.handleResponse(o),[4,this.options.fileUploader.download({fileID:t.fileID,downloadURL:i.download_url})];case 2:if(200!==(a=u.sent()).statusCode)throw $o.FaasError.STORAGE_ERR(-1,"下载文件 ".concat(i.download_url," 失败"),o.requestID);return[2,a]}}))}))},t.prototype.deleteFile=function(t){return Qo(this,void 0,void 0,(function(){var e,n,r,o,i,a,u,c,s,l=this;return Lo(this,(function(p){switch(p.label){case 0:if(e=Array.isArray(t)?t:t.fileList,!Array.isArray(e)||0===e.length)throw $o.FaasError.INVALID_PARAM_ERR("fileList","不能为空数组");for(n=[],r=0,o=e;r<o.length;r++){if(i=o[r],a=this.checkFileID(i))throw $o.FaasError.INVALID_PARAM_ERR("fileID",a);u=this.getCloudPathFromFileID(i),n.push(u)}return c=this.getBatchDeletePath(),[4,this.request({method:"POST",path:c,data:{file_list:n}})];case 1:return s=p.sent(),[2,{fileList:Ho.ResponseUtil.handleResponse(s).file_list.map((function(t){return{fileID:l.formatFileID(t.file_id),status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.getTempFileURL=function(t){return Qo(this,void 0,void 0,(function(){var e,n,r,o,i,a,u,c,s,l=this;return Lo(this,(function(p){switch(p.label){case 0:if(e=Array.isArray(t)?t:t.fileList,!Array.isArray(e)||0===e.length)throw $o.FaasError.INVALID_PARAM_ERR("fileList","不能为空数组");if(e.length>50)throw $o.FaasError.INVALID_PARAM_ERR("fileList","最大长度 50");for(n=[],r=0,o=e;r<o.length;r++){if(i=o[r],a=this.checkFileID(i))throw $o.FaasError.INVALID_PARAM_ERR("fileID",a);u=this.getCloudPathFromFileID(i),n.push({file_id:u,expire:600})}return c=this.getBatchDownloadPath(),[4,this.request({method:"POST",path:c,data:{file_list:n}})];case 1:return s=p.sent(),[2,{fileList:Ho.ResponseUtil.handleResponse(s).file_list.map((function(t){return{fileID:l.formatFileID(t.file_id),tempFileURL:t.download_url,status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.request=function(t){var e=t.method,n=t.path,r=t.data,o=t.headers;return Qo(this,void 0,void 0,(function(){return Lo(this,(function(t){switch(t.label){case 0:return[4,this.options.httpclient.request({method:e,path:n,data:r,headers:Fo({"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":"".concat(Date.now()+6e4)},o)})];case 1:return[2,t.sent()]}}))}))},t}();Uo.Storage=Wo,Object.defineProperty(l,"__esModule",{value:!0}),l.WebSDK=void 0;var Go=p,zo=O,Vo=x,Jo=Uo,Ko=function(){function t(){}return t.createCallFunction=function(t){return(0,zo.createCallFunction)(t)},t.createCallContainer=function(t){return(0,Go.createCallContainer)(t)},t.createDatabase=function(t){return new Vo.Database(t)},t.createStorage=function(t){return new Jo.Storage(t)},t}();l.WebSDK=Ko;var Yo,Xo={};Object.defineProperty(Xo,"__esModule",{value:!0}),function(t){var e=a&&a.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),n=a&&a.__exportStar||function(t,n){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||e(n,t,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.ResponseUtil=t.FaasError=t.Query=t.Aggregate=t.Collection=t.Document=t.Database=t.Storage=t.WebSDK=void 0;var r=l;Object.defineProperty(t,"WebSDK",{enumerable:!0,get:function(){return r.WebSDK}});var o=Uo;Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return o.Storage}});var i=x;Object.defineProperty(t,"Database",{enumerable:!0,get:function(){return i.Database}});var u=oo;Object.defineProperty(t,"Document",{enumerable:!0,get:function(){return u.Document}});var c=Wr;Object.defineProperty(t,"Collection",{enumerable:!0,get:function(){return c.Collection}});var s=Kr;Object.defineProperty(t,"Aggregate",{enumerable:!0,get:function(){return s.Aggregate}});var p=io;Object.defineProperty(t,"Query",{enumerable:!0,get:function(){return p.Query}});var y=d;Object.defineProperty(t,"FaasError",{enumerable:!0,get:function(){return y.FaasError}});var h=f;Object.defineProperty(t,"ResponseUtil",{enumerable:!0,get:function(){return h.ResponseUtil}}),n(Xo,t)}(s),function(t){t.WEB="WEB",t.ALIPAY_MINI="ALIPAY_MINI",t.WEICHAT_MINI="WEICHAT_MINI"}(Yo||(Yo={}));var Zo={exports:{}};var ti,ei={exports:{}};function ni(){return ti||(ti=1,function(t,e){var n;t.exports=(n=n||function(t,e){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==a&&a.crypto&&(n=a.crypto),!n)try{n=require("crypto")}catch(t){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),i={},u=i.lib={},c=u.Base={extend:function(t){var e=o(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=u.WordArray=c.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||p).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var u=0;u<o;u+=4)e[r+u>>>2]=n[u>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(r());return new s.init(e,t)}}),l=i.enc={},p=l.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new s.init(n,e/2)}},f=l.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new s.init(n,e)}},d=l.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},y=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,u=i/(4*a),c=(u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0))*a,l=t.min(4*c,i);if(c){for(var p=0;p<c;p+=a)this._doProcessBlock(o,p);n=o.splice(0,c),r.sigBytes-=l}return new s.init(n,l)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});u.Hasher=y.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new h.HMAC.init(t,n).finalize(e)}}});var h=i.algo={};return i}(Math),n)}(ei)),ei.exports}!function(t,e){t.exports=ni().enc.Hex}(Zo);var ri=u(Zo.exports),oi={exports:{}},ii={exports:{}};!function(t,e){var n;t.exports=(n=ni(),function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,a=e.algo,u=[],c=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var r=2,o=0;o<64;)e(r)&&(o<8&&(u[o]=n(t.pow(r,.5))),c[o]=n(t.pow(r,1/3)),o++),r++}();var s=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(u.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],l=n[5],p=n[6],f=n[7],d=0;d<64;d++){if(d<16)s[d]=0|t[e+d];else{var y=s[d-15],h=(y<<25|y>>>7)^(y<<14|y>>>18)^y>>>3,m=s[d-2],v=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;s[d]=h+s[d-7]+v+s[d-16]}var g=r&o^r&i^o&i,_=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),b=f+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&l^~u&p)+c[d]+s[d];f=p,p=l,l=u,u=a+b|0,a=i,i=o,o=r,r=b+(_+g)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0,n[5]=n[5]+l|0,n[6]=n[6]+p|0,n[7]=n[7]+f|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)}(ii);var ai,ui=ii.exports,ci=u(ui),si={exports:{}};!function(t,e){var n;t.exports=(n=ni(),ai||(ai=1,function(t,e){var n,r,o;t.exports=(r=(n=ni()).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=o.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var i=this._oKey=e.clone(),a=this._iKey=e.clone(),u=i.words,c=a.words,s=0;s<n;s++)u[s]^=1549556828,c[s]^=909522486;i.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})))}(si)),n.HmacSHA256)}(oi);var li=u(oi.exports),pi=function(){function t(){}return t.sign=function(e){for(var n=e.signedHeaders.join(";"),r="",o=0,i=e.signedHeaders;o<i.length;o++){var a=i[o],u=e.headers[a];r+="".concat(a,":").concat(u,"\n")}var c=t.createHash(e.body||""),s=e.method.toUpperCase()+"\n"+e.path+"\n"+e.query+"\n"+r+"\n"+n+"\n"+c+"\n",l="HMAC-SHA256",p=t.createHash(s),f="".concat(l,"\n").concat(e.timestamp,"\n").concat(p,"\n"),d=t.createSha256(f,e.secretKey);return"".concat(l," Credential=").concat(e.secretId,", SignedHeaders=").concat(n,", Signature=").concat(d)},t.createSha256=function(t,e){return void 0===e&&(e=""),li(t,e).toString(ri)},t.createHash=function(t){return ci(t).toString(ri)},t}(),fi=function(){function t(){}return t.detectRuntime=function(){return window||void 0===("undefined"==typeof my?"undefined":e(my))?window||void 0===("undefined"==typeof wx?"undefined":e(wx))?Yo.WEB:Yo.WEICHAT_MINI:Yo.ALIPAY_MINI},t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},t.parseUrl=function(t,e){if(e===Yo.WEB)return new URL(t);var n=t.match(/^(https?):\/\/([^/]+)(\/[^?]+)?(\?[^#]+)?/)||[],r=n[1],o=n[2],i=n[3],a=n[4];return{protocol:r||"",host:o||"",pathname:"".concat(i||""),search:a||""}},t}();var di=function(){function t(t,e){this.req=t,this.config=e}return Object.defineProperty(t.prototype,"requestId",{get:function(){return this.req.requestOptions.headers["x-trace-id"]},enumerable:!1,configurable:!0}),t}(),yi=function(){function t(){}return t.prototype.request=function(t,e){return o(this,void 0,void 0,(function(){var n,o,a;return i(this,(function(i){switch(i.label){case 0:return[4,fetch(t,r({mode:"cors"},e))];case 1:return n=i.sent(),o={},n.headers.forEach((function(t,e){o[e]=t})),a={status:n.status},[4,n.json()];case 2:return[2,(a.data=i.sent(),a.headers=o,a)]}}))}))},t}(),hi=function(){function t(){}return t.prototype.request=function(t,e){return o(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,my.request({url:t,method:(null==e?void 0:e.method)||"GET",data:null==e?void 0:e.body,headers:null==e?void 0:e.headers,dataType:"json"})];case 1:return[2,r.sent()];case 2:throw n=r.sent(),console.error(n),new Error("error: ".concat(n.error,", message: ").concat(n.errorMessage));case 3:return[2]}}))}))},t}(),mi=function(){function t(){}return t.prototype.request=function(t,e){return o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,new Promise((function(n,r){wx.request({url:t,method:(null==e?void 0:e.method)||"GET",data:null==e?void 0:e.body,header:null==e?void 0:e.headers,dataType:"json",success:function(t){n({status:t.statusCode,data:t.data,headers:t.header})},reject:function(t){r(new Error("error: ".concat(t.errno,", message: ").concat(t.errMsg)))}})}))]}))}))},t}(),vi=function(){function t(){}return t.default=function(t){if(!this.singleton)switch(t){case Yo.ALIPAY_MINI:this.singleton=new hi;break;case Yo.WEB:this.singleton=new yi;break;case Yo.WEICHAT_MINI:this.singleton=new mi;break;default:throw new Error("未知运行环境".concat(t))}return this.singleton},t}();function gi(t,e){return o(this,void 0,void 0,(function(){var n,r;return i(this,(function(o){switch(o.label){case 0:return[4,e()];case 1:return o.sent(),n=t.config.fetch||vi.default(t.config.runtime),r=t,[4,n.request(t.req.url,t.req.requestOptions)];case 2:return r.res=o.sent(),t.result={status:t.res.status,requestID:t.requestId,headers:t.res.headers,data:t.res.data},[2]}}))}))}function _i(t,e){return o(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e()];case 1:return r.sent(),[3,3];case 2:throw n=r.sent(),s.FaasError.NETWORK_ERR(n,t.requestId);case 3:return[2]}}))}))}function bi(t){return function(e,n){return o(this,void 0,void 0,(function(){var o,a,u,c,s;return i(this,(function(i){switch(i.label){case 0:return o=Date.now(),a=fi.parseUrl(e.req.url,e.config.runtime),u={authorization:"","x-from-app-id":e.config.appId,"x-from-env-id":e.config.envId,"x-to-env-id":e.config.envId,"x-from-instance-id":"".concat(o),"x-from-function-name":e.config.functionName,"x-client-timestamp":"".concat(o)},t.length>0&&t.forEach((function(t){var n,r=null===(n=e.req.requestOptions.headers)||void 0===n?void 0:n[t];r&&(u[t]=r)})),c=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))}(["x-from-app-id","x-from-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp","x-to-env-id"],t,!0).sort(),s={path:a.pathname,query:a.search.substring(1),secretId:e.config.secretId,secretKey:e.config.secretKey,method:e.req.requestOptions.method,headers:u,body:e.req.requestOptions.body,timestamp:o,signedHeaders:c},u.authorization=pi.sign(s),e.req.requestOptions.headers=r(r({},u),e.req.requestOptions.headers),[4,n()];case 1:return i.sent(),[2]}}))}))}}var wi=function(){function t(t,e){var n;this.config=t,this.handler=(n=e,function(t,e){var r=-1;return function o(i){if(i<=r)return Promise.reject(new Error("next() called multiple times"));r=i;var a=n[i];if(i===n.length&&(a=e),!a)return Promise.resolve();try{return Promise.resolve(a(t,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)})}return t.prototype.request=function(t){var e=t.method,n=t.path,r=t.data,a=t.headers;return o(this,void 0,void 0,(function(){var t,o,u,c;return i(this,(function(i){switch(i.label){case 0:return t=this.config.endpoint+n,o=r?JSON.stringify(r):r,u=fi.generateUUID(),a=Object.assign({"x-alipay-callid":u,"x-request-id":u,"x-alipay-source":"web,web-sdk","content-type":"application/json"},a),c=new di({url:t,requestOptions:{method:e,body:o,headers:a}},this.config),[4,this.handler(c)];case 1:return i.sent(),[2,c.result]}}))}))},t.createFunctionHttpclient=function(e){return new t(e,[_i,bi(["x-to-function-name"]),gi])},t.createDatabaseHttpclient=function(e){return new t(e,[_i,bi(["x-data-api-type","x-expire-timestamp"]),gi])},t.createStorageHttpclient=function(e){return new t(e,[_i,bi(["x-data-api-type","x-expire-timestamp"]),gi])},t}(),Oi=function(){function t(){}return t.prototype.upload=function(t){return o(this,void 0,void 0,(function(){var e,n;return i(this,(function(r){switch(r.label){case 0:return e=t.uploadURL,n=t.fileContent,[4,fetch(e,{method:"PUT",mode:"cors",body:n})];case 1:return[2,{statusCode:r.sent().status}]}}))}))},t.prototype.download=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,{fileContent:t.downloadURL,statusCode:200}]}))}))},t.create=function(){return t.instance||(t.instance=new t),t.instance},t}(),Ci=function(t){function e(n){var r=wi.createStorageHttpclient(n),o=e.getFileUploader(n);return t.call(this,{httpclient:r,fileUploader:o,type:"web",toEnvId:n.envId})||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.getFileUploader=function(t){if(t.fileUploader)return t.fileUploader;if(t.runtime===Yo.WEB)return Oi.create();throw s.FaasError.INVALID_PARAM_ERR("fileUploader","未指定文件上传/下载实现")},e}(s.Storage),Pi=function(){function t(t){var e=t.resourceEnv||t.envId,n=t.resourceAppid||t.appId;this.config={endpoint:t.endpoint||"https://".concat(e,".api-hz.cloudbasefunction.cn"),secretId:t.secretId,secretKey:t.secretKey,appId:n,envId:e,fetch:t.fetch,fileUploader:t.fileUploader,runtime:t.runtime||fi.detectRuntime(),functionName:""}}return t.prototype.init=function(){},t.prototype.callFunction=function(t){var e;return o(this,void 0,void 0,(function(){var n,o;return i(this,(function(i){switch(i.label){case 0:return n=r(r({},this.config),{envId:(null===(e=t.config)||void 0===e?void 0:e.env)||this.config.envId,functionName:t.name}),o=wi.createFunctionHttpclient(n),[4,s.WebSDK.createCallFunction({type:"web",httpclient:o})(t)];case 1:return[2,i.sent()]}}))}))},t.prototype.getStorage=function(){return this.storage||(this.storage=new Ci(this.config)),this.storage},t.prototype.uploadFile=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.getStorage().uploadFile(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.downloadFile=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.getStorage().downloadFile(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteFile=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.getStorage().deleteFile(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTempFileURL=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.getStorage().getTempFileURL(t)];case 1:return[2,e.sent()]}}))}))},t.RUNTIME=Yo,t}();t.Cloud=Pi}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/faas-web-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13-alpha.0",
|
|
4
4
|
"description": "云函数服务 web SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@alipay/faas-common-sdk": "^1.1.
|
|
21
|
+
"@alipay/faas-common-sdk": "^1.1.13-alpha.0",
|
|
22
22
|
"crypto-js": "^4.1.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"puppeteer": "^20.7.3",
|
|
42
42
|
"rollup": "^3.25.3",
|
|
43
43
|
"ts-jest": "^29.1.0",
|
|
44
|
-
"typescript": "^5.0.4"
|
|
44
|
+
"typescript": "^5.0.4",
|
|
45
|
+
"urllib": "^3.17.1"
|
|
45
46
|
}
|
|
46
47
|
}
|