@alipay/faas-web-sdk 1.1.10-alpha.2 → 1.1.10-alpha.3

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
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 u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;var i="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 a={},c={},s={},l={},f={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.FaasError=void 0;var r=function(t){function e(n,r){var o=t.call(this,r)||this;return o.error=n,o.errorMessage=r,Object.setPrototypeOf(o,e.prototype),o}return n(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(70001,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);t.FaasError=r}(f),function(t){var e=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(t,"__esModule",{value:!0}),t.ResponseUtil=t.wrapCallback=void 0;var n=f;t.wrapCallback=function(t){return function(n){if(!(null!=n&&n.complete||null!=n&&n.success||null!=n&&n.fail))return t(n);var r=n.complete,o=n.success,i=n.fail,u=e(n,["complete","success","fail"]);t(u).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 r=function(){function t(){}return t.handleResponse=function(t){if(200!==t.status){var e=t.data||{code:-1,message:"未知异常"},r=e.code,o=e.message;throw n.FaasError.SERVER_ERR(r,o,t.requestID,t.status)}return t.data.data},t}();t.ResponseUtil=r}(l),function(t){var e=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},n=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.createCallContainer=void 0;var r=l;t.createCallContainer=function(t){return(0,r.wrapCallback)((function(r){return e(void 0,void 0,void 0,(function(){return n(this,(function(e){throw new Error("not implemented in "+t.type+" with "+r)}))}))}))}}(s);var p={};!function(t){var e=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},n=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.createCallFunction=void 0;var r=f,o=l;t.createCallFunction=function(t){var i=t.httpclient;return(0,o.wrapCallback)((function(t){return e(void 0,void 0,void 0,(function(){var e,o,u,a,c;return n(this,(function(n){switch(n.label){case 0:if(!t.name)throw r.FaasError.INVALID_PARAM_ERR("name","缺失");return e={"x-to-function-name":t.name,"x-alipay-cloud-mode":"function"},"POST","/functions/invokeFunction",[4,i.request({method:"POST",path:"/functions/invokeFunction",data:t.data,headers:e})];case 1:if(200!==(o=n.sent()).status)throw u=-1,a="",(c=o.data)&&(u=c.errCode,a=c.errMsg,c.errDetail&&(a+=",详情:".concat(c.errDetail))),r.FaasError.SERVER_ERR(u,a,o.requestID,o.status);return[2,{requestID:o.requestID,result:o.data}]}}))}))}))}}(p);var d={},h={},y={},m={};Object.defineProperty(m,"__esModule",{value:!0});var v={},g={},_={},b={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AggregateCommand=t.QueryCommand=t.UpdateCommand=t.AbstractCommand=void 0;var r=function(){};t.AbstractCommand=r;var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(r);t.UpdateCommand=o;var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(r);t.QueryCommand=u;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(r);t.AggregateCommand=a}(b);var w={},O={};!function(t){var e,n,r,o=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.DbBuildError=t.ErrorCode=void 0,(r=n||(t.ErrorCode=n={})).INVALID_PARAM="INVALID_PARAM",r.INVALID_COMMAND="INVALID_COMMAND";var u=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return o(e,t),e.create=function(t,n){var r=new e(n);return r.code=t,r},e.invalidParam=function(t,r){return e.create(n.INVALID_PARAM,'无效入参 "'.concat(t,'", ').concat(r))},e.invalidCommand=function(t){return e.create(n.INVALID_COMMAND,t)},e}(Error);t.DbBuildError=u}(O),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.AggregateRequest=void 0;var n=O,r=b,o=function(){function t(t,e){void 0===e&&(e=""),this.data=t,this.prefix=e}return t.prototype.stringify=function(){var o=this;if(this.data instanceof r.AbstractCommand){if(!(this.data instanceof r.AggregateCommand))throw n.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,n){return new t(e,"".concat(o.prefix,".$.").concat(n)).stringify()}));switch(e(this.data)){case"number":case"boolean":case"string":case"bigint":return this.data;case"function":throw n.DbBuildError.invalidParam(this.prefix,"不支持函数");case"symbol":throw n.DbBuildError.invalidParam(this.prefix,"不支持 symbol");case"undefined":throw n.DbBuildError.invalidParam(this.prefix,"不支持 undefined");default:var i={};for(var u in this.data){var a=this.prefix?"".concat(this.prefix,".").concat(u):u,c=new t(this.data[u],a);i[u]=c.stringify()}return i}},t.prototype.toJSON=function(){return this.stringify()},t}();t.AggregateRequest=o}(w),function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AndAggregateCommand=void 0;var r=w,o=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map((function(t){return new r.AggregateRequest(t).toJSON()})),n}return n(e,t),e.prototype.pushCommand=function(t){this.commands.push(new r.AggregateRequest(t).toJSON())},e.prototype.stringify=function(){return{$and:this.commands}},e}(b.AggregateCommand);t.AndAggregateCommand=o}(_);var C={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AvgAggregateCommand=void 0;var r=w,o=function(t){function e(e){var n=t.call(this)||this;return n.val=new r.AggregateRequest(e).toJSON(),n}return n(e,t),e.prototype.stringify=function(){return{$avg:this.val}},e}(b.AggregateCommand);t.AvgAggregateCommand=o}(C);var A={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CountAggregateCommand=void 0;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.stringify=function(){return{$count:{}}},e}(b.AggregateCommand);t.CountAggregateCommand=r}(A);var P={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EqAggregateCommand=void 0;var r=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{$eq:this.val}},e}(b.AggregateCommand);t.EqAggregateCommand=r}(P);var x,j={},S={},E={},D={},R={};function M(){return x||(x=1,function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AndCommand=void 0;var r=b,o=tt(),u=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map(o.CommandUtils.stringify),n}return n(e,t),e.prototype.pushCommand=function(t){this.commands.push(o.CommandUtils.stringify(t))},e.prototype.stringify=function(){return{$and:this.commands}},e}(r.QueryCommand);t.AndCommand=u}(R)),R}var q,N={};function I(){return q||(q=1,function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.OrCommand=void 0;var r=b,o=tt(),u=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map(o.CommandUtils.stringify),n}return n(e,t),e.prototype.pushCommand=function(t){this.commands.push(o.CommandUtils.stringify(t))},e.prototype.stringify=function(){return{$or:this.commands}},e}(r.QueryCommand);t.OrCommand=u}(N)),N}var B={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EqCommand=void 0;var r=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{$eq:this.val}},e}(b.QueryCommand);t.EqCommand=r}(B);var T={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NeqCommand=void 0;var r=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{$ne:this.val}},e}(b.QueryCommand);t.NeqCommand=r}(T);var Q={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.LtCommand=void 0;var r=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{$lt:this.val}},e}(b.QueryCommand);t.LtCommand=r}(Q);var k={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.LteCommand=void 0;var r=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{$lte:this.val}},e}(b.QueryCommand);t.LteCommand=r}(k);var U={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.GtCommand=void 0;var r=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{$gt:this.val}},e}(b.QueryCommand);t.GtCommand=r}(U);var $={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.GteCommand=void 0;var r=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{$gte:this.val}},e}(b.QueryCommand);t.GteCommand=r}($);var F={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.InCommand=void 0;var r=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{$in:this.val}},e}(b.QueryCommand);t.InCommand=r}(F);var L={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NinCommand=void 0;var r=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{$nin:this.val}},e}(b.QueryCommand);t.NinCommand=r}(L);var H={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ExistsCommand=void 0;var r=function(t){function e(e){var n=t.call(this)||this;return n.exists=e,n}return n(e,t),e.prototype.stringify=function(){return{$exists:this.exists}},e}(b.QueryCommand);t.ExistsCommand=r}(H);var G={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ModCommand=void 0;var r=function(t){function e(e,n){var r=t.call(this)||this;return r.divisor=e,r.remainder=n,r}return n(e,t),e.prototype.stringify=function(){return{$mod:[this.divisor,this.remainder]}},e}(b.QueryCommand);t.ModCommand=r}(G);var z={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AllCommand=void 0;var r=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{$all:this.val}},e}(b.QueryCommand);t.AllCommand=r}(z);var V,W,J,K,Y={};function X(){return V||(V=1,function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ElemMatchCommand=void 0;var r=b,o=tt(),u=function(t){function e(e){var n=t.call(this)||this;return n.val=o.CommandUtils.stringify(e),n}return n(e,t),e.prototype.stringify=function(){return{$elemMatch:this.val}},e}(r.QueryCommand);t.ElemMatchCommand=u}(Y)),Y}function Z(){return W||(W=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.QueryChain=void 0;var e=M(),n=I(),r=B,o=T,i=Q,u=k,a=U,c=$,s=F,l=L,f=H,p=G,d=z,h=X(),y=tt(),m=function(){function t(t){this.lastCmd=t}return t.prototype.appendCommand=function(t){return t=y.CommandUtils.unchain(t),this.lastCmd instanceof e.AndCommand?this.lastCmd.pushCommand(t):this.lastCmd=new e.AndCommand([this.lastCmd,t]),this},t.prototype.and=function(t){return this.appendCommand(t)},t.prototype.or=function(t){return t=y.CommandUtils.unchain(t),this.lastCmd instanceof n.OrCommand?this.lastCmd.pushCommand(t):this.lastCmd=new n.OrCommand([this.lastCmd,t]),this},t.prototype.not=function(t){return this.appendCommand(t)},t.prototype.nor=function(t){return this.appendCommand(t)},t.prototype.eq=function(t){return this.appendCommand(new r.EqCommand(t))},t.prototype.neq=function(t){return this.appendCommand(new o.NeqCommand(t))},t.prototype.lt=function(t){return this.appendCommand(new i.LtCommand(t))},t.prototype.lte=function(t){return this.appendCommand(new u.LteCommand(t))},t.prototype.gt=function(t){return this.appendCommand(new a.GtCommand(t))},t.prototype.gte=function(t){return this.appendCommand(new c.GteCommand(t))},t.prototype.in=function(t){return this.appendCommand(new s.InCommand(t))},t.prototype.nin=function(t){return this.appendCommand(new l.NinCommand(t))},t.prototype.exists=function(t){return this.appendCommand(new f.ExistsCommand(t))},t.prototype.mod=function(t,e){return this.appendCommand(new p.ModCommand(t,e))},t.prototype.all=function(t){return this.appendCommand(new d.AllCommand(t))},t.prototype.elemMatch=function(t){return this.appendCommand(new h.ElemMatchCommand(y.CommandUtils.unchain(t)))},t.prototype.size=function(t){return this.appendCommand(t)},t}();t.QueryChain=m}(D)),D}function tt(){return J||(J=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CommandUtils=void 0;var e=b,n=et(),r=Z(),o=function(){function t(){}return t.stringify=function(r){return(r=t.unchain(r))instanceof e.QueryCommand?r.stringify():new n.QueryRequest(r).toJSON()},t.unchain=function(t){return t instanceof r.QueryChain?t.lastCmd:t},t}();t.CommandUtils=o}(E)),E}function et(){return K||(K=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.QueryRequest=void 0;var n=b,r=O,o=tt(),i=function(){function t(t,e){void 0===e&&(e=""),this.query=t,this.prefix=e}return t.prototype.stringify=function(){var i=this,u={},a=o.CommandUtils.unchain(this.query),c=e(a);if(a instanceof n.QueryCommand)return a.stringify();if(Array.isArray(a))return a.map((function(e,n){return new t(e,"".concat(i.prefix,".$.").concat(n)).stringify()}));if("number"===c)return a;if("boolean"===c)return a;if("string"===c)return a;if("bigint"===c)return a;if("function"===c)throw r.DbBuildError.invalidParam(this.prefix,"不支持函数");if("symbol"===c)throw r.DbBuildError.invalidParam(this.prefix,"不支持 symbol");if("undefined"===c)throw r.DbBuildError.invalidParam(this.prefix,"不支持 undefined");if(null===a)return a;for(var s in a){var l=this.prefix?"".concat(this.prefix,".").concat(s):s,f=new t(a[s],l);u[s]=f.stringify()}return u},t.prototype.toJSON=function(){return this.stringify()},t}();t.QueryRequest=i}(S)),S}var nt={};!function(t){var e,n,r,o,i,u;Object.defineProperty(t,"__esModule",{value:!0}),t.PipelineStageName=t.Target=t.DocumentAction=t.CollectionAction=t.Sort=void 0,(n=e||(t.Sort=e={})).DESC="desc",n.ASC="asc",function(t){t.update="update",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create"}(r||(t.CollectionAction=r={})),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"}(o||(t.DocumentAction=o={})),function(t){t.collection="collection",t.document="document"}(i||(t.Target=i={})),function(t){t.match="$match",t.group="$group",t.sample="$sample",t.lookup="$lookup"}(u||(t.PipelineStageName=u={}))}(nt),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.AggregatePipeline=void 0;var e=w,n=et(),r=nt,o=O,i=function(){function t(){this.pipeline=[]}return t.prototype.match=function(t){return this.pushStage(r.PipelineStageName.match,t),this},t.prototype.group=function(t){return this.pushStage(r.PipelineStageName.group,t),this},t.prototype.sample=function(t){return this.pushStage(r.PipelineStageName.sample,t),this},t.prototype.lookup=function(t){return this.pushStage(r.PipelineStageName.lookup,t),this},t.prototype.done=function(){return this.pipeline.map((function(t){var i;switch(t.name){case r.PipelineStageName.match:return{$match:new n.QueryRequest(t.param).toJSON()};case r.PipelineStageName.sample:case r.PipelineStageName.lookup:return(i={})[t.name]=t.param,i;case r.PipelineStageName.group:return{$group:new e.AggregateRequest(t.param).toJSON()};default:var u=t.name;throw o.DbBuildError.invalidParam(u,"不支持的 aggregate 操作")}}))},t.prototype.pushStage=function(t,e){this.pipeline.push({name:t,param:e})},t}();t.AggregatePipeline=i}(j);var rt={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ExprCommand=void 0;var r=w,o=function(t){function e(e){var n=t.call(this)||this;return n.commands=new r.AggregateRequest(e).toJSON(),n}return n(e,t),e.prototype.stringify=function(){return{$expr:this.commands}},e}(b.QueryCommand);t.ExprCommand=o}(rt);var ot={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.GtAggregateCommand=void 0;var r=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{$gt:this.val}},e}(b.AggregateCommand);t.GtAggregateCommand=r}(ot);var it={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.GteAggregateCommand=void 0;var r=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{$gte:this.val}},e}(b.AggregateCommand);t.GteAggregateCommand=r}(it);var ut={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.LtAggregateCommand=void 0;var r=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{$lt:this.val}},e}(b.AggregateCommand);t.LtAggregateCommand=r}(ut);var at={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.LteAggregateCommand=void 0;var r=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{$lte:this.val}},e}(b.AggregateCommand);t.LteAggregateCommand=r}(at);var ct={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.MaxAggregateCommand=void 0;var r=w,o=function(t){function e(e){var n=t.call(this)||this;return n.val=new r.AggregateRequest(e).toJSON(),n}return n(e,t),e.prototype.stringify=function(){return{$max:this.val}},e}(b.AggregateCommand);t.MaxAggregateCommand=o}(ct);var st={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.MinAggregateCommand=void 0;var r=w,o=function(t){function e(e){var n=t.call(this)||this;return n.val=new r.AggregateRequest(e).toJSON(),n}return n(e,t),e.prototype.stringify=function(){return{$min:this.val}},e}(b.AggregateCommand);t.MinAggregateCommand=o}(st);var lt={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NeqAggregateCommand=void 0;var r=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{$ne:this.val}},e}(b.AggregateCommand);t.NeqAggregateCommand=r}(lt);var ft={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.OrAggregateCommand=void 0;var r=w,o=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map((function(t){return new r.AggregateRequest(t).toJSON()})),n}return n(e,t),e.prototype.pushCommand=function(t){this.commands.push(new r.AggregateRequest(t).toJSON())},e.prototype.stringify=function(){return{$or:this.commands}},e}(b.AggregateCommand);t.OrAggregateCommand=o}(ft);var pt={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.SumAggregateCommand=void 0;var r=w,o=function(t){function e(e){var n=t.call(this)||this;return n.val=new r.AggregateRequest(e).toJSON(),n}return n(e,t),e.prototype.stringify=function(){return{$sum:this.val}},e}(b.AggregateCommand);t.SumAggregateCommand=o}(pt);var dt={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.SetCommand=void 0;var r=function(t){function e(e){var n=t.call(this)||this;return n.data=e,n}return n(e,t),Object.defineProperty(e.prototype,"operator",{get:function(){return"$set"},enumerable:!1,configurable:!0}),e.prototype.stringify=function(){return this.data},e}(b.UpdateCommand);t.SetCommand=r}(dt);var ht={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.IncCommand=void 0;var r=function(t){function e(e){var n=t.call(this)||this;return n.num=e,n}return n(e,t),Object.defineProperty(e.prototype,"operator",{get:function(){return"$inc"},enumerable:!1,configurable:!0}),e.prototype.stringify=function(){return this.num},e}(b.UpdateCommand);t.IncCommand=r}(ht);var yt={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NotCommand=void 0;var r=b,o=tt(),u=function(t){function e(e){var n=t.call(this)||this;return n.command=o.CommandUtils.stringify(e),n}return n(e,t),e.prototype.stringify=function(){return{$not:this.command.stringify()}},e}(r.QueryCommand);t.NotCommand=u}(yt);var mt={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NorCommand=void 0;var r=b,o=tt(),u=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map(o.CommandUtils.stringify),n}return n(e,t),e.prototype.pushCommand=function(t){this.commands.push(o.CommandUtils.stringify(t))},e.prototype.stringify=function(){return{$nor:this.commands}},e}(r.QueryCommand);t.NorCommand=u}(mt);var vt={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.SizeCommand=void 0;var r=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}(b.QueryCommand);t.SizeCommand=r}(vt),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Command=t.AggregateCommandFactory=void 0;var e=_,n=C,r=A,o=P,i=j,u=rt,a=ot,c=it,s=ut,l=at,f=ct,p=st,d=lt,h=ft,y=pt,m=dt,v=ht,g=Z(),b=I(),w=M(),O=tt(),x=yt,S=mt,E=B,D=T,R=Q,q=k,N=U,V=$,W=F,J=L,K=H,Y=G,et=z,nt=X(),gt=vt,_t=function(){function t(){}return t.prototype.pipeline=function(){return new i.AggregatePipeline},t.prototype.avg=function(t){return new n.AvgAggregateCommand(t)},t.prototype.count=function(){return new r.CountAggregateCommand},t.prototype.max=function(t){return new f.MaxAggregateCommand(t)},t.prototype.min=function(t){return new p.MinAggregateCommand(t)},t.prototype.sum=function(t){return new y.SumAggregateCommand(t)},t.prototype.and=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t=Array.isArray(t[0])?t[0]:t,new e.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 h.OrAggregateCommand(t)},t.prototype.eq=function(t){return new o.EqAggregateCommand(t)},t.prototype.neq=function(t){return new d.NeqAggregateCommand(t)},t.prototype.lt=function(t){return new s.LtAggregateCommand(t)},t.prototype.lte=function(t){return new l.LteAggregateCommand(t)},t.prototype.gt=function(t){return new a.GtAggregateCommand(t)},t.prototype.gte=function(t){return new c.GteAggregateCommand(t)},t}();t.AggregateCommandFactory=_t;var bt=function(){function t(){this.aggregate=new _t}return t.prototype.set=function(t){return new m.SetCommand(t)},t.prototype.inc=function(t){return new v.IncCommand(t)},t.prototype.expr=function(t){return new u.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 w.AndCommand(t.map(O.CommandUtils.unchain));return new g.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 b.OrCommand(t.map(O.CommandUtils.unchain));return new g.QueryChain(n)},t.prototype.not=function(t){var e=new x.NotCommand(O.CommandUtils.unchain(t));return new g.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 S.NorCommand(t.map(O.CommandUtils.unchain));return new g.QueryChain(n)},t.prototype.eq=function(t){return new g.QueryChain(new E.EqCommand(t))},t.prototype.neq=function(t){return new g.QueryChain(new D.NeqCommand(t))},t.prototype.lt=function(t){return new g.QueryChain(new R.LtCommand(t))},t.prototype.lte=function(t){return new g.QueryChain(new q.LteCommand(t))},t.prototype.gt=function(t){return new g.QueryChain(new N.GtCommand(t))},t.prototype.gte=function(t){return new g.QueryChain(new V.GteCommand(t))},t.prototype.in=function(t){return new g.QueryChain(new W.InCommand(t))},t.prototype.nin=function(t){return new g.QueryChain(new J.NinCommand(t))},t.prototype.exists=function(t){return new g.QueryChain(new K.ExistsCommand(t))},t.prototype.mod=function(t,e){return new g.QueryChain(new Y.ModCommand(t,e))},t.prototype.all=function(t){return new g.QueryChain(new et.AllCommand(t))},t.prototype.elemMatch=function(t){return new g.QueryChain(new nt.ElemMatchCommand(O.CommandUtils.unchain(t)))},t.prototype.size=function(t){return new g.QueryChain(new gt.SizeCommand(t))},t}();t.Command=bt}(g);var gt={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ActionBuilder=void 0;var e=nt,n=function(){function t(){}return t.buildCollectionAction=function(t,n){return{target:e.Target.collection,action:t,collectionName:n}},t.buildCollectionListQueryAction=function(t){return{target:e.Target.collection,action:e.CollectionAction.queryList,options:t}},t.buildDocumentAction=function(t,n,r){return{target:e.Target.document,action:t,collectionName:n,options:r}},t}();t.ActionBuilder=n}(gt);var _t={},bt={};!function(t){var e,n=i&&i.__extends||(e=function(t,n){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,n)},function(t,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=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AggregateBuilder=void 0;var r=nt,o=gt,u=function(t){function e(e){var n=t.call(this)||this;return n.collectionName=e,n}return n(e,t),e.prototype.end=function(){var t={$aggregate:this.done()};return o.ActionBuilder.buildDocumentAction(r.DocumentAction.aggregate,this.collectionName,t)},e}(j.AggregatePipeline);t.AggregateBuilder=u}(bt);var wt={},Ot={},Ct={},At={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Operator=void 0;var e=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}();t.Operator=e}(At),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateRequest=void 0;var n=O,r=b,o=At,i=function(){function t(t,e){void 0===e&&(e=""),this.data=t,this.prefix=e}return t.prototype.stringify=function(i){for(var u in i=i||new o.Operator,this.data){var a=this.prefix?"".concat(this.prefix,".").concat(u):u,c=this.data[u],s=e(c);if(c instanceof r.AbstractCommand){if(!(c instanceof r.UpdateCommand))throw n.DbBuildError.invalidCommand("Command 不是更新操作");i.applyOperator(c.operator,a,c.stringify())}else if("number"===s)i.set(a,c);else if("boolean"===s)i.set(a,c);else if("string"===s)i.set(a,c);else if("bigint"===s)i.set(a,c);else{if("function"===s)throw n.DbBuildError.invalidParam(a,"不支持函数");if("symbol"===s)throw n.DbBuildError.invalidParam(a,"不支持 symbol");if("undefined"===s)throw n.DbBuildError.invalidParam(a,"不支持 undefined");if(null===c)i.set(a,c);else if(Array.isArray(c))i.set(a,c);else{new t(c,a).stringify(i)}}}return i},t.prototype.toJSON=function(){return this.stringify().emit()},t}();t.UpdateRequest=i}(Ct),function(t){var n=i&&i.__assign||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)};Object.defineProperty(t,"__esModule",{value:!0}),t.QueryBuilder=void 0;var r=et(),o=Ct,u=nt,a=gt,c=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(u.DocumentAction.update,n(n({},this.baseOptions()),{$update:new o.UpdateRequest(t.data).toJSON()}))},t.prototype.set=function(t){return this.build(u.DocumentAction.replace,n(n({},this.baseOptions()),{$replace:t.data}))},t.prototype.remove=function(){return this.build(u.DocumentAction.delete,this.baseOptions())},t.prototype.get=function(){return this.build(u.DocumentAction.queryList,n({$limit:100},this.findOptions()))},t.prototype.count=function(){return this.build(u.DocumentAction.count,this.baseOptions())},t.prototype.baseOptions=function(){var t={};if(e(this.criteria.match)<"u"){var n=new r.QueryRequest(this.criteria.match);t.$match=n.toJSON()}return e(this.criteria.limit)<"u"&&(t.$limit=this.criteria.limit),t},t.prototype.findOptions=function(){var t=this.baseOptions();if(e(this.criteria.projection)<"u"&&(t.$project=this.criteria.projection),e(this.criteria.sort)<"u"){t.$sort={};for(var n=0,r=this.criteria.sort;n<r.length;n++){var o=r[n];t.$sort[o.field]=o.sort===u.Sort.DESC?-1:1}}return e(this.criteria.skip)<"u"&&(t.$skip=this.criteria.skip),t},t.prototype.build=function(t,e){return a.ActionBuilder.buildDocumentAction(t,this.collectionName,e)},t}();t.QueryBuilder=c}(Ot),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentBuilder=void 0;var e=nt,n=Ot,r=function(){function t(t,e){this.collectionName=t,this.id=e}return t.prototype.update=function(t){return new n.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).update(t)},t.prototype.set=function(t){return new n.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).set(t)},t.prototype.remove=function(){return new n.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).remove()},t.prototype.get=function(){var t=new n.QueryBuilder(this.collectionName).where({_id:String(this.id)}).limit(1).get();return t.action=e.DocumentAction.query,t},t}();t.DocumentBuilder=r}(wt),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CollectionBuilder=void 0;var e=nt,n=O,r=gt,o=bt,i=wt,u=Ot,a=function(){function t(t){this.collectionName=t}return t.prototype.add=function(t){return Array.isArray(t.data)?this.batchAdd(t):r.ActionBuilder.buildDocumentAction(e.DocumentAction.create,this.collectionName,t.data)},t.prototype.batchAdd=function(t){if(t.data.length>200)throw n.DbBuildError.invalidParam("data","最大长度 200");var o={$create:t.data};return"boolean"==typeof t.ordered&&(o.$ordered=t.ordered),r.ActionBuilder.buildDocumentAction(e.DocumentAction.batchCreate,this.collectionName,o)},t.prototype.doc=function(t){return new i.DocumentBuilder(this.collectionName,t)},t.prototype.limit=function(t){return new u.QueryBuilder(this.collectionName).limit(t)},t.prototype.skip=function(t){return new u.QueryBuilder(this.collectionName).skip(t)},t.prototype.where=function(t){return new u.QueryBuilder(this.collectionName).where(t)},t.prototype.projection=function(t){return new u.QueryBuilder(this.collectionName).projection(t)},t.prototype.orderBy=function(t,e){return new u.QueryBuilder(this.collectionName).orderBy(t,e)},t.prototype.aggregate=function(){return new o.AggregateBuilder(this.collectionName)},t.prototype.get=function(){return new u.QueryBuilder(this.collectionName).get()},t.prototype.count=function(){return new u.QueryBuilder(this.collectionName).count()},t}();t.CollectionBuilder=a}(_t),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.MongoBuilder=void 0;var e=g,n=nt,r=gt,o=_t,i=function(){function t(){this.command=new e.Command}return t.prototype.collection=function(t){return new o.CollectionBuilder(t)},t.prototype.createCollection=function(t){return r.ActionBuilder.buildCollectionAction(n.CollectionAction.create,t)},t.prototype.getCollection=function(t){return r.ActionBuilder.buildCollectionAction(n.CollectionAction.query,t)},t.prototype.listCollection=function(t,e){return r.ActionBuilder.buildCollectionListQueryAction({$limit:null!=t?t:10,$skip:null!=e?e:0})},t.prototype.deleteCollection=function(t){return r.ActionBuilder.buildCollectionAction(n.CollectionAction.delete,t)},t}();t.MongoBuilder=i}(v),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(m,t);var r=v;Object.defineProperty(t,"MongoBuilder",{enumerable:!0,get:function(){return r.MongoBuilder}});var o=_t;Object.defineProperty(t,"CollectionBuilder",{enumerable:!0,get:function(){return o.CollectionBuilder}});var u=wt;Object.defineProperty(t,"DocumentBuilder",{enumerable:!0,get:function(){return u.DocumentBuilder}});var a=Ot;Object.defineProperty(t,"QueryBuilder",{enumerable:!0,get:function(){return a.QueryBuilder}});var c=bt;Object.defineProperty(t,"AggregateBuilder",{enumerable:!0,get:function(){return c.AggregateBuilder}});var s=et();Object.defineProperty(t,"QueryRequest",{enumerable:!0,get:function(){return s.QueryRequest}});var l=Ct;Object.defineProperty(t,"UpdateRequest",{enumerable:!0,get:function(){return l.UpdateRequest}});var f=w;Object.defineProperty(t,"AggregateRequest",{enumerable:!0,get:function(){return f.AggregateRequest}});var p=g;Object.defineProperty(t,"Command",{enumerable:!0,get:function(){return p.Command}});var d=tt();Object.defineProperty(t,"CommandUtils",{enumerable:!0,get:function(){return d.CommandUtils}});var h=O;Object.defineProperty(t,"DbBuildError",{enumerable:!0,get:function(){return h.DbBuildError}}),n(nt,t)}(y);var Pt={};!function(t){var e=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},n=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Aggregate=void 0;var r=y,o=l,u=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new r.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 e(this,void 0,void 0,(function(){var t,e,r;return n(this,(function(n){switch(n.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 r=n.sent(),[2,o.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},t}();t.Aggregate=u}(Pt);var xt={},jt={};!function(t){var e=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},n=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Query=void 0;var r=y,o=l,u=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new r.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 e(this,void 0,void 0,(function(){var e,r,i;return n(this,(function(n){switch(n.label){case 0:return"POST",e="".concat(this.getCollectionPath(),"?update"),r=this.builder.update(t).options,[4,this.options.httpclient.request({method:"POST",path:e,data:r})];case 1:return i=n.sent(),[2,o.ResponseUtil.handleResponse(i)]}}))}))},t.prototype.set=function(t){return e(this,void 0,void 0,(function(){var e,r,i;return n(this,(function(n){switch(n.label){case 0:return"POST",e="".concat(this.getCollectionPath(),"?replace"),r=this.builder.set(t).options,[4,this.options.httpclient.request({method:"POST",path:e,data:r})];case 1:return i=n.sent(),[2,o.ResponseUtil.handleResponse(i)]}}))}))},t.prototype.remove=function(){return e(this,void 0,void 0,(function(){var t,e,r;return n(this,(function(n){switch(n.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 r=n.sent(),[2,o.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.get=function(){return e(this,void 0,void 0,(function(){var t,e,r;return n(this,(function(n){switch(n.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 r=n.sent(),[2,o.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.count=function(){return e(this,void 0,void 0,(function(){var t,e,r;return n(this,(function(n){switch(n.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 r=n.sent(),[2,{total:o.ResponseUtil.handleResponse(r).count}]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},t}();t.Query=u}(jt),function(t){var e=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},n=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Document=void 0;var r=f,o=jt,u=function(){function t(t,e,n){this.collectionName=t,this.id=e,this.options=n}return t.prototype.update=function(t){return e(this,void 0,void 0,(function(){return n(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 e(this,void 0,void 0,(function(){return n(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 e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.query.remove()];case 1:return[2,t.sent()]}}))}))},t.prototype.get=function(){return e(this,void 0,void 0,(function(){var t,e;return n(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 r.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}),t}();t.Document=u}(xt),function(t){var e=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},n=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Collection=void 0;var r=y,o=l,u=Pt,a=xt,c=jt,s=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new r.CollectionBuilder(t)}return t.prototype.add=function(t){return e(this,void 0,void 0,(function(){var e,r,i;return n(this,(function(n){switch(n.label){case 0:return e=this.builder.add(t).options,"POST",r=this.getDocumentPath(t.data._id),[4,this.options.httpclient.request({method:"POST",path:r,data:e})];case 1:return i=n.sent(),[2,o.ResponseUtil.handleResponse(i)]}}))}))},t.prototype.doc=function(t){return new a.Document(this.collectionName,t,this.options)},t.prototype.limit=function(t){return new c.Query(this.collectionName,this.options).limit(t)},t.prototype.skip=function(t){return new c.Query(this.collectionName,this.options).skip(t)},t.prototype.where=function(t){return new c.Query(this.collectionName,this.options).where(t)},t.prototype.projection=function(t){return new c.Query(this.collectionName,this.options).projection(t)},t.prototype.field=function(t){return new c.Query(this.collectionName,this.options).field(t)},t.prototype.orderBy=function(t,e){return new c.Query(this.collectionName,this.options).orderBy(t,e)},t.prototype.aggregate=function(){return new u.Aggregate(this.collectionName,this.options)},t.prototype.get=function(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,new c.Query(this.collectionName,this.options).get()];case 1:return[2,t.sent()]}}))}))},t.prototype.count=function(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,new c.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||"")},t}();t.Collection=s}(h),function(t){var e=i&&i.__assign||function(){return e=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},e.apply(this,arguments)},n=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},r=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Database=void 0;var o=h,u=function(){function t(t){this.httpclient=t}return t.prototype.request=function(t){var o=t.method,i=t.path,u=t.data,a=t.headers;return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.httpclient.request({method:o,path:i,data:u,headers:e({"x-alipay-cloud-mode":"mongo","x-data-api-type":"mongo","x-expire-timestamp":"".concat(Date.now()+6e4)},a)})];case 1:return[2,t.sent()]}}))}))},t}(),a=function(){function t(t){this.options=e(e({},t),{httpclient:new u(t.httpclient)})}return t.prototype.collection=function(t){return new o.Collection(t,this.options)},t}();t.Database=a}(d);var St={};!function(t){var e=i&&i.__assign||function(){return e=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},e.apply(this,arguments)},n=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},r=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Storage=void 0;var o=f,u=l,a=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),i=e.substring(n+1);return r!==this.options.toEnvId&&console.warn("file ".concat(t," does not belong to env ").concat(this.options.toEnvId)),i},t.prototype.uploadFile=function(t){return n(this,void 0,void 0,(function(){var e,n,i,a,c,s;return r(this,(function(r){switch(r.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 i=r.sent(),a=u.ResponseUtil.handleResponse(i),c=this.formatFileID(a.file_id),[4,this.options.fileUploader.upload({fileID:c,uploadURL:a.upload_url,fileContent:t.fileContent})];case 2:if(200!==(s=r.sent()).statusCode)throw o.FaasError.STORAGE_ERR(-1,"文件下载失败",i.requestID);return[2,{fileID:c,statusCode:s.statusCode}]}}))}))},t.prototype.downloadFile=function(t){return n(this,void 0,void 0,(function(){var e,n,i,a,c,s;return r(this,(function(r){switch(r.label){case 0:if(e=this.checkFileID(t.fileID))throw o.FaasError.INVALID_PARAM_ERR("fileID",e);return n=this.getCloudPathFromFileID(t.fileID),i=this.getDownloadPath(n),[4,this.request({method:"GET",path:i})];case 1:return a=r.sent(),c=u.ResponseUtil.handleResponse(a),[4,this.options.fileUploader.download({fileID:t.fileID,downloadURL:c.download_url})];case 2:if(200!==(s=r.sent()).statusCode)throw o.FaasError.STORAGE_ERR(-1,"文件下载失败",a.requestID);return[2,s]}}))}))},t.prototype.deleteFile=function(t){return n(this,void 0,void 0,(function(){var e,n,i,a,c,s,l,f,p,d=this;return r(this,(function(r){switch(r.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=[],i=0,a=e;i<a.length;i++){if(c=a[i],s=this.checkFileID(c))throw o.FaasError.INVALID_PARAM_ERR("fileID",s);l=this.getCloudPathFromFileID(c),n.push(l)}return f=this.getBatchDeletePath(),[4,this.request({method:"POST",path:f,data:{file_list:n}})];case 1:return p=r.sent(),[2,{fileList:u.ResponseUtil.handleResponse(p).file_list.map((function(t){return{fileID:d.formatFileID(t.file_id),status:t.status?0:-1,errMsg:t.status?"ok":t.result_message}}))}]}}))}))},t.prototype.getTempFileURL=function(t){return n(this,void 0,void 0,(function(){var e,n,i,a,c,s,l,f,p,d=this;return r(this,(function(r){switch(r.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=[],i=0,a=e;i<a.length;i++){if(c=a[i],s=this.checkFileID(c))throw o.FaasError.INVALID_PARAM_ERR("fileID",s);l=this.getCloudPathFromFileID(c),n.push({file_id:l,expire:600})}return f=this.getBatchDownloadPath(),[4,this.request({method:"POST",path:f,data:{file_list:n}})];case 1:return p=r.sent(),[2,{fileList:u.ResponseUtil.handleResponse(p).file_list.map((function(t){return{fileID:d.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 o=t.method,i=t.path,u=t.data,a=t.headers;return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.options.httpclient.request({method:o,path:i,data:u,headers:e({"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":"".concat(Date.now()+6e4)},a)})];case 1:return[2,t.sent()]}}))}))},t}();t.Storage=a}(St),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WebSDK=void 0;var e=s,n=p,r=d,o=St,i=function(){function t(){}return t.createCallFunction=function(t){return(0,n.createCallFunction)(t)},t.createCallContainer=function(t){return(0,e.createCallContainer)(t)},t.createDatabase=function(t){return new r.Database(t)},t.createStorage=function(t){return new o.Storage(t)},t}();t.WebSDK=i}(c);var Et={};Object.defineProperty(Et,"__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=c;Object.defineProperty(t,"WebSDK",{enumerable:!0,get:function(){return r.WebSDK}});var o=St;Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return o.Storage}});var u=d;Object.defineProperty(t,"Database",{enumerable:!0,get:function(){return u.Database}});var a=xt;Object.defineProperty(t,"Document",{enumerable:!0,get:function(){return a.Document}});var s=h;Object.defineProperty(t,"Collection",{enumerable:!0,get:function(){return s.Collection}});var p=Pt;Object.defineProperty(t,"Aggregate",{enumerable:!0,get:function(){return p.Aggregate}});var y=jt;Object.defineProperty(t,"Query",{enumerable:!0,get:function(){return y.Query}});var m=f;Object.defineProperty(t,"FaasError",{enumerable:!0,get:function(){return m.FaasError}});var v=l;Object.defineProperty(t,"ResponseUtil",{enumerable:!0,get:function(){return v.ResponseUtil}}),n(Et,t)}(a);var Dt={exports:{}};var Rt,Mt={exports:{}};function qt(){return Rt||(Rt=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}}(),u={},a=u.lib={},c=a.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=a.WordArray=c.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||f).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 u=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=u<<24-(r+i)%4*8}else for(var a=0;a<o;a+=4)e[r+a>>>2]=n[a>>>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=u.enc={},f=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)}},p=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(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},h=a.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,u=this.blockSize,a=i/(4*u),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*u,l=t.min(4*c,i);if(c){for(var f=0;f<c;f+=u)this._doProcessBlock(o,f);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});a.Hasher=h.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.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 y.HMAC.init(t,n).finalize(e)}}});var y=u.algo={};return u}(Math),n)}(Mt)),Mt.exports}!function(t,e){t.exports=qt().enc.Hex}(Dt);var Nt=u(Dt.exports),It={exports:{}},Bt={exports:{}};!function(t,e){var n;t.exports=(n=qt(),function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,u=e.algo,a=[],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&&(a[o]=n(t.pow(r,.5))),c[o]=n(t.pow(r,1/3)),o++),r++}();var s=[],l=u.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],u=n[3],a=n[4],l=n[5],f=n[6],p=n[7],d=0;d<64;d++){if(d<16)s[d]=0|t[e+d];else{var h=s[d-15],y=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,m=s[d-2],v=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;s[d]=y+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=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+c[d]+s[d];p=f,f=l,l=a,a=u+b|0,u=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]+u|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+p|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)}(Bt);var Tt,Qt=Bt.exports,kt=u(Qt),Ut={exports:{}};!function(t,e){var n;t.exports=(n=qt(),Tt||(Tt=1,function(t,e){var n,r,o;t.exports=(r=(n=qt()).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(),u=this._iKey=e.clone(),a=i.words,c=u.words,s=0;s<n;s++)a[s]^=1549556828,c[s]^=909522486;i.sigBytes=u.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))}})))}(Ut)),n.HmacSHA256)}(It);var $t,Ft=u(It.exports);!function(t){t.WEB="WEB",t.ALIPAY_MINI="ALIPAY_MINI",t.WEICHAT_MINI="WEICHAT_MINI"}($t||($t={}));var Lt=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 u=i[o],a=e.headers[u];r+="".concat(u,":").concat(a,"\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",f=t.createHash(s),p="".concat(l,"\n").concat(e.timestamp,"\n").concat(f,"\n"),d=t.createSha256(p,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=""),Ft(t,e).toString(Nt)},t.createHash=function(t){return kt(t).toString(Nt)},t}(),Ht=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))?$t.WEB:$t.WEICHAT_MINI:$t.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===$t.WEB)return new URL(t);var n=t.match(/^(https?):\/\/([^/]+)(\/[^?]+)?(\?[^#]+)?/)||[],r=n[1],o=n[2],i=n[3],u=n[4];return{protocol:r||"",host:o||"",pathname:"".concat(i||""),search:u||""}},t}();var Gt=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}(),zt=function(){function t(){}return t.prototype.request=function(t,e){return r(this,void 0,void 0,(function(){var r,i,u;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})),u={status:r.status},[4,r.json()];case 2:return[2,(u.data=o.sent(),u.headers=i,u)]}}))}))},t}(),Vt=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}(),Wt=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}(),Jt=function(){function t(){}return t.default=function(t){if(!this.singleton)switch(t){case $t.ALIPAY_MINI:this.singleton=new Vt;break;case $t.WEB:this.singleton=new zt;break;case $t.WEICHAT_MINI:this.singleton=new Wt;break;default:throw new Error("未知运行环境".concat(t))}return this.singleton},t}();function Kt(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||Jt.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 Yt(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(),a.FaasError.NETWORK_ERR(n,t.requestId);case 3:return[2]}}))}))}function Xt(t){return function(e,i){return r(this,void 0,void 0,(function(){var r,u,a,c,s;return o(this,(function(o){switch(o.label){case 0:return r=Date.now(),u=Ht.parseUrl(e.req.url,e.config.runtime),a={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&&(a[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:u.pathname,query:u.search.substring(1),secretId:e.config.secretId,secretKey:e.config.secretKey,method:e.req.requestOptions.method,headers:a,body:e.req.requestOptions.body,timestamp:r,signedHeaders:c},a.authorization=Lt.sign(s),e.req.requestOptions.headers=n(n({},a),e.req.requestOptions.headers),[4,i()];case 1:return o.sent(),[2]}}))}))}}var Zt=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 u=n[i];if(i===n.length&&(u=e),!u)return Promise.resolve();try{return Promise.resolve(u(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,u=t.headers;return r(this,void 0,void 0,(function(){var t,r,a,c;return o(this,(function(o){switch(o.label){case 0:return t=this.config.endpoint+n,r=i?JSON.stringify(i):i,a=Ht.generateUUID(),u=Object.assign({"x-alipay-callid":a,"x-request-id":a,"x-alipay-source":"web,web-sdk","content-type":"application/json"},u),c=new Gt({url:t,requestOptions:{method:e,body:r,headers:u}},this.config),[4,this.handler(c)];case 1:return o.sent(),[2,c.result]}}))}))},t.createFunctionHttpclient=function(e){return new t(e,[Yt,Xt(["x-to-function-name"]),Kt])},t}(),te=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||Ht.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=Zt.createFunctionHttpclient(r),[4,a.WebSDK.createCallFunction({type:"web",httpclient:i})(t)];case 1:return[2,o.sent()]}}))}))},t}();t.Cloud=te}));
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 u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;var i="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 a,c={},s={},l={},p={},f={},d=i&&i.__extends||(a=function(t,e){return(a=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}a(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 h=function(t){function e(n,r){var o=t.call(this,r)||this;return 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(70001,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=h;var y=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){return function(e){if(!((null==e?void 0:e.complete)||(null==e?void 0:e.success)||(null==e?void 0:e.fail)))return t(e);var n=e.complete,r=e.success,o=e.fail,i=y(e,["complete","success","fail"]);t(i).then((function(t){return null==r||r(t),t}),(function(t){return null==o||o(t),t})).then((function(t){null==n||n(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 u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},_=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,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 u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},C=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(w,"__esModule",{value:!0}),w.createCallFunction=void 0;var A=f,P=p;w.createCallFunction=function(t){var e=t.httpclient;return(0,P.wrapCallback)((function(t){return O(void 0,void 0,void 0,(function(){var n,r,o,i,u;return C(this,(function(a){switch(a.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=a.sent()).status)throw o=-1,i="",(u=r.data)&&(o=u.errCode,i=u.errMsg,u.errDetail&&(i+=",详情:".concat(u.errDetail))),A.FaasError.SERVER_ERR(o,i,r.requestID,r.status);return[2,{requestID:r.requestID,result:r.data}]}}))}))}))};var x={},j={},S={},E={};Object.defineProperty(E,"__esModule",{value:!0});var D,R={},M={},q={},N={},I=i&&i.__extends||(D=function(t,e){return(D=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}D(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 I(e,t),e}(B);N.UpdateCommand=T;var Q=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e}(B);N.QueryCommand=Q;var k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e}(B);N.AggregateCommand=k;var U,$,F,L={},H={},G=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(H,"__esModule",{value:!0}),H.DbBuildError=H.ErrorCode=void 0,(F=$||(H.ErrorCode=$={})).INVALID_PARAM="INVALID_PARAM",F.INVALID_COMMAND="INVALID_COMMAND";var z=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return G(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($.INVALID_PARAM,'无效入参 "'.concat(t,'", ').concat(n))},e.invalidCommand=function(t){return e.create($.INVALID_COMMAND,t)},e}(Error);H.DbBuildError=z,Object.defineProperty(L,"__esModule",{value:!0}),L.AggregateRequest=void 0;var V=H,W=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 W.AbstractCommand){if(!(this.data instanceof W.AggregateCommand))throw V.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 V.DbBuildError.invalidParam(this.prefix,"不支持函数");case"symbol":throw V.DbBuildError.invalidParam(this.prefix,"不支持 symbol");case"undefined":throw V.DbBuildError.invalidParam(this.prefix,"不支持 undefined");default:var r={};for(var o in this.data){var i=this.prefix?"".concat(this.prefix,".").concat(o):o,u=new t(this.data[o],i);r[o]=u.stringify()}return r}},t.prototype.toJSON=function(){return this.stringify()},t}();L.AggregateRequest=J;var K,Y=i&&i.__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(q,"__esModule",{value:!0}),q.AndAggregateCommand=void 0;var X=L,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);q.AndAggregateCommand=Z;var tt,et={},nt=i&&i.__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=L,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={},ut=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.CountAggregateCommand=void 0;var at=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ut(e,t),e.prototype.stringify=function(){return{$count:{}}},e}(N.AggregateCommand);it.CountAggregateCommand=at;var ct={},st=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.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={},ht={},yt={},mt={};function vt(){if(pt)return mt;pt=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(mt,"__esModule",{value:!0}),mt.AndCommand=void 0;var n=N,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 mt.AndCommand=o,mt}var gt,_t={};function bt(){if(gt)return _t;gt=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(_t,"__esModule",{value:!0}),_t.OrCommand=void 0;var e=N,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 _t.OrCommand=r,_t}var wt={},Ot=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.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 At={},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(At,"__esModule",{value:!0}),At.NeqCommand=void 0;var xt=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}(N.QueryCommand);At.NeqCommand=xt;var jt={},St=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 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);jt.LtCommand=Et;var Dt={},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(Dt,"__esModule",{value:!0}),Dt.LteCommand=void 0;var Mt=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}(N.QueryCommand);Dt.LteCommand=Mt;var qt={},Nt=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(qt,"__esModule",{value:!0}),qt.GtCommand=void 0;var It=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);qt.GtCommand=It;var Bt={},Tt=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.GteCommand=void 0;var Qt=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=Qt;var kt={},Ut=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.InCommand=void 0;var $t=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Ut(e,t),e.prototype.stringify=function(){return{$in:this.val}},e}(N.QueryCommand);kt.InCommand=$t;var Ft={},Lt=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(Ft,"__esModule",{value:!0}),Ft.NinCommand=void 0;var Ht=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Lt(e,t),e.prototype.stringify=function(){return{$nin:this.val}},e}(N.QueryCommand);Ft.NinCommand=Ht;var Gt={},zt=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.ExistsCommand=void 0;var Vt=function(t){function e(e){var n=t.call(this)||this;return n.exists=e,n}return zt(e,t),e.prototype.stringify=function(){return{$exists:this.exists}},e}(N.QueryCommand);Gt.ExistsCommand=Vt;var Wt={},Jt=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(Wt,"__esModule",{value:!0}),Wt.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);Wt.ModCommand=Kt;var Yt={},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(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=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(oe,"__esModule",{value:!0}),oe.ElemMatchCommand=void 0;var e=N,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 oe.ElemMatchCommand=r,oe}function ue(){if(ee)return yt;ee=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.QueryChain=void 0;var t=vt(),e=bt(),n=wt,r=At,o=jt,i=Dt,u=qt,a=Bt,c=kt,s=Ft,l=Gt,p=Wt,f=Yt,d=ie(),h=ae(),y=function(){function y(t){this.lastCmd=t}return y.prototype.appendCommand=function(e){return e=h.CommandUtils.unchain(e),this.lastCmd instanceof t.AndCommand?this.lastCmd.pushCommand(e):this.lastCmd=new t.AndCommand([this.lastCmd,e]),this},y.prototype.and=function(t){return this.appendCommand(t)},y.prototype.or=function(t){return t=h.CommandUtils.unchain(t),this.lastCmd instanceof e.OrCommand?this.lastCmd.pushCommand(t):this.lastCmd=new e.OrCommand([this.lastCmd,t]),this},y.prototype.not=function(t){return this.appendCommand(t)},y.prototype.nor=function(t){return this.appendCommand(t)},y.prototype.eq=function(t){return this.appendCommand(new n.EqCommand(t))},y.prototype.neq=function(t){return this.appendCommand(new r.NeqCommand(t))},y.prototype.lt=function(t){return this.appendCommand(new o.LtCommand(t))},y.prototype.lte=function(t){return this.appendCommand(new i.LteCommand(t))},y.prototype.gt=function(t){return this.appendCommand(new u.GtCommand(t))},y.prototype.gte=function(t){return this.appendCommand(new a.GteCommand(t))},y.prototype.in=function(t){return this.appendCommand(new c.InCommand(t))},y.prototype.nin=function(t){return this.appendCommand(new s.NinCommand(t))},y.prototype.exists=function(t){return this.appendCommand(new l.ExistsCommand(t))},y.prototype.mod=function(t,e){return this.appendCommand(new p.ModCommand(t,e))},y.prototype.all=function(t){return this.appendCommand(new f.AllCommand(t))},y.prototype.elemMatch=function(t){return this.appendCommand(new d.ElemMatchCommand(h.CommandUtils.unchain(t)))},y.prototype.size=function(t){return this.appendCommand(t)},y}();return yt.QueryChain=y,yt}function ae(){if(ne)return ht;ne=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.CommandUtils=void 0;var t=N,e=ce(),n=ue(),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 ht.CommandUtils=r,ht}function ce(){if(re)return dt;re=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.QueryRequest=void 0;var t=N,n=H,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,u={},a=r.CommandUtils.unchain(this.query),c=e(a);if(a instanceof t.QueryCommand)return a.stringify();if(Array.isArray(a))return a.map((function(t,e){return new o(t,"".concat(i.prefix,".$.").concat(e)).stringify()}));if("number"===c)return a;if("boolean"===c)return a;if("string"===c)return a;if("bigint"===c)return a;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===a)return a;for(var s in a){var l=this.prefix?"".concat(this.prefix,".").concat(s):s,p=new o(a[s],l);u[s]=p.stringify()}return u},o.prototype.toJSON=function(){return this.stringify()},o}();return dt.QueryRequest=o,dt}var se,le,pe,fe,de,he={};Object.defineProperty(he,"__esModule",{value:!0}),he.PipelineStageName=he.Target=he.DocumentAction=he.CollectionAction=he.Sort=void 0,function(t){t.DESC="desc",t.ASC="asc"}(se||(he.Sort=se={})),function(t){t.update="update",t.delete="delete",t.query="query",t.queryList="queryList",t.create="create"}(le||(he.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||(he.DocumentAction=pe={})),function(t){t.collection="collection",t.document="document"}(fe||(he.Target=fe={})),function(t){t.match="$match",t.group="$group",t.sample="$sample",t.lookup="$lookup"}(de||(he.PipelineStageName=de={})),Object.defineProperty(ft,"__esModule",{value:!0}),ft.AggregatePipeline=void 0;var ye=L,me=ce(),ve=he,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 ye.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=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(be,"__esModule",{value:!0}),be.ExprCommand=void 0;var Oe=L,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 Ae={},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(Ae,"__esModule",{value:!0}),Ae.GtAggregateCommand=void 0;var xe=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}(N.AggregateCommand);Ae.GtAggregateCommand=xe;var je={},Se=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 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);je.GteAggregateCommand=Ee;var De={},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(De,"__esModule",{value:!0}),De.LtAggregateCommand=void 0;var Me=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}(N.AggregateCommand);De.LtAggregateCommand=Me;var qe={},Ne=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.LteAggregateCommand=void 0;var Ie=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);qe.LteAggregateCommand=Ie;var Be={},Te=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(Be,"__esModule",{value:!0}),Be.MaxAggregateCommand=void 0;var Qe=L,ke=function(t){function e(e){var n=t.call(this)||this;return n.val=new Qe.AggregateRequest(e).toJSON(),n}return Te(e,t),e.prototype.stringify=function(){return{$max:this.val}},e}(N.AggregateCommand);Be.MaxAggregateCommand=ke;var Ue={},$e=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(Ue,"__esModule",{value:!0}),Ue.MinAggregateCommand=void 0;var Fe=L,Le=function(t){function e(e){var n=t.call(this)||this;return n.val=new Fe.AggregateRequest(e).toJSON(),n}return $e(e,t),e.prototype.stringify=function(){return{$min:this.val}},e}(N.AggregateCommand);Ue.MinAggregateCommand=Le;var He={},Ge=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(He,"__esModule",{value:!0}),He.NeqAggregateCommand=void 0;var ze=function(t){function e(e){var n=t.call(this)||this;return n.val=e,n}return Ge(e,t),e.prototype.stringify=function(){return{$ne:this.val}},e}(N.AggregateCommand);He.NeqAggregateCommand=ze;var Ve={},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(Ve,"__esModule",{value:!0}),Ve.OrAggregateCommand=void 0;var Je=L,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 We(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);Ve.OrAggregateCommand=Ke;var Ye={},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(Ye,"__esModule",{value:!0}),Ye.SumAggregateCommand=void 0;var Ze=L,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=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(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={},un=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(on,"__esModule",{value:!0}),on.IncCommand=void 0;var an=function(t){function e(e){var n=t.call(this)||this;return n.num=e,n}return un(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=an;var cn,sn={},ln=i&&i.__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=ae(),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 hn={},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(hn,"__esModule",{value:!0}),hn.NorCommand=void 0;var mn=N,vn=ae(),gn=function(t){function e(e){var n=t.call(this)||this;return n.commands=e.map(vn.CommandUtils.stringify),n}return yn(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);hn.NorCommand=gn;var _n={},bn=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(_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=q,Cn=et,An=it,Pn=ct,xn=ft,jn=be,Sn=Ae,En=je,Dn=De,Rn=qe,Mn=Be,qn=Ue,Nn=He,In=Ve,Bn=Ye,Tn=en,Qn=on,kn=ue(),Un=bt(),$n=vt(),Fn=ae(),Ln=sn,Hn=hn,Gn=wt,zn=At,Vn=jt,Wn=Dt,Jn=qt,Kn=Bt,Yn=kt,Xn=Ft,Zn=Gt,tr=Wt,er=Yt,nr=ie(),rr=_n,or=function(){function t(){}return t.prototype.pipeline=function(){return new xn.AggregatePipeline},t.prototype.avg=function(t){return new Cn.AvgAggregateCommand(t)},t.prototype.count=function(){return new An.CountAggregateCommand},t.prototype.max=function(t){return new Mn.MaxAggregateCommand(t)},t.prototype.min=function(t){return new qn.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 In.OrAggregateCommand(t)},t.prototype.eq=function(t){return new Pn.EqAggregateCommand(t)},t.prototype.neq=function(t){return new Nn.NeqAggregateCommand(t)},t.prototype.lt=function(t){return new Dn.LtAggregateCommand(t)},t.prototype.lte=function(t){return new Rn.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 Qn.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 $n.AndCommand(t.map(Fn.CommandUtils.unchain));return new kn.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 Un.OrCommand(t.map(Fn.CommandUtils.unchain));return new kn.QueryChain(n)},t.prototype.not=function(t){var e=new Ln.NotCommand(Fn.CommandUtils.unchain(t));return new kn.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(Fn.CommandUtils.unchain));return new kn.QueryChain(n)},t.prototype.eq=function(t){return new kn.QueryChain(new Gn.EqCommand(t))},t.prototype.neq=function(t){return new kn.QueryChain(new zn.NeqCommand(t))},t.prototype.lt=function(t){return new kn.QueryChain(new Vn.LtCommand(t))},t.prototype.lte=function(t){return new kn.QueryChain(new Wn.LteCommand(t))},t.prototype.gt=function(t){return new kn.QueryChain(new Jn.GtCommand(t))},t.prototype.gte=function(t){return new kn.QueryChain(new Kn.GteCommand(t))},t.prototype.in=function(t){return new kn.QueryChain(new Yn.InCommand(t))},t.prototype.nin=function(t){return new kn.QueryChain(new Xn.NinCommand(t))},t.prototype.exists=function(t){return new kn.QueryChain(new Zn.ExistsCommand(t))},t.prototype.mod=function(t,e){return new kn.QueryChain(new tr.ModCommand(t,e))},t.prototype.all=function(t){return new kn.QueryChain(new er.AllCommand(t))},t.prototype.elemMatch=function(t){return new kn.QueryChain(new nr.ElemMatchCommand(Fn.CommandUtils.unchain(t)))},t.prototype.size=function(t){return new kn.QueryChain(new rr.SizeCommand(t))},t}();M.Command=ir;var ur={};Object.defineProperty(ur,"__esModule",{value:!0}),ur.ActionBuilder=void 0;var ar=he,cr=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}();ur.ActionBuilder=cr;var sr={},lr={},pr=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(lr,"__esModule",{value:!0}),lr.AggregateBuilder=void 0;var fr=he,dr=ur,hr=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=hr;var yr={},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],u=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"===u)n.set(o,i);else if("boolean"===u)n.set(o,i);else if("string"===u)n.set(o,i);else if("bigint"===u)n.set(o,i);else{if("function"===u)throw br.DbBuildError.invalidParam(o,"不支持函数");if("symbol"===u)throw br.DbBuildError.invalidParam(o,"不支持 symbol");if("undefined"===u)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 Ar=i&&i.__assign||function(){return Ar=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},Ar.apply(this,arguments)};Object.defineProperty(mr,"__esModule",{value:!0}),mr.QueryBuilder=void 0;var Pr=ce(),xr=vr,jr=he,Sr=ur,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(jr.DocumentAction.update,Ar(Ar({},this.baseOptions()),{$update:new xr.UpdateRequest(t.data).toJSON()}))},t.prototype.set=function(t){return this.build(jr.DocumentAction.replace,Ar(Ar({},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,Ar({$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 Sr.ActionBuilder.buildDocumentAction(t,this.collectionName,e)},t}();mr.QueryBuilder=Er,Object.defineProperty(yr,"__esModule",{value:!0}),yr.DocumentBuilder=void 0;var Dr=he,Rr=mr,Mr=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=Dr.DocumentAction.query,t},t}();yr.DocumentBuilder=Mr,Object.defineProperty(sr,"__esModule",{value:!0}),sr.CollectionBuilder=void 0;var qr=he,Nr=H,Ir=ur,Br=lr,Tr=yr,Qr=mr,kr=function(){function t(t){this.collectionName=t}return t.prototype.add=function(t){return Array.isArray(t.data)?this.batchAdd(t):Ir.ActionBuilder.buildDocumentAction(qr.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),Ir.ActionBuilder.buildDocumentAction(qr.DocumentAction.batchCreate,this.collectionName,e)},t.prototype.doc=function(t){return new Tr.DocumentBuilder(this.collectionName,t)},t.prototype.limit=function(t){return new Qr.QueryBuilder(this.collectionName).limit(t)},t.prototype.skip=function(t){return new Qr.QueryBuilder(this.collectionName).skip(t)},t.prototype.where=function(t){return new Qr.QueryBuilder(this.collectionName).where(t)},t.prototype.projection=function(t){return new Qr.QueryBuilder(this.collectionName).projection(t)},t.prototype.orderBy=function(t,e){return new Qr.QueryBuilder(this.collectionName).orderBy(t,e)},t.prototype.aggregate=function(){return new Br.AggregateBuilder(this.collectionName)},t.prototype.get=function(){return new Qr.QueryBuilder(this.collectionName).get()},t.prototype.count=function(){return new Qr.QueryBuilder(this.collectionName).count()},t}();sr.CollectionBuilder=kr,Object.defineProperty(R,"__esModule",{value:!0}),R.MongoBuilder=void 0;var Ur=M,$r=he,Fr=ur,Lr=sr,Hr=function(){function t(){this.command=new Ur.Command}return t.prototype.collection=function(t){return new Lr.CollectionBuilder(t)},t.prototype.createCollection=function(t){return Fr.ActionBuilder.buildCollectionAction($r.CollectionAction.create,t)},t.prototype.getCollection=function(t){return Fr.ActionBuilder.buildCollectionAction($r.CollectionAction.query,t)},t.prototype.listCollection=function(t,e){return Fr.ActionBuilder.buildCollectionListQueryAction({$limit:null!=t?t:10,$skip:null!=e?e:0})},t.prototype.deleteCollection=function(t){return Fr.ActionBuilder.buildCollectionAction($r.CollectionAction.delete,t)},t}();R.MongoBuilder=Hr,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(E,t);var r=R;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 u=yr;Object.defineProperty(t,"DocumentBuilder",{enumerable:!0,get:function(){return u.DocumentBuilder}});var a=mr;Object.defineProperty(t,"QueryBuilder",{enumerable:!0,get:function(){return a.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=L;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=ae();Object.defineProperty(t,"CommandUtils",{enumerable:!0,get:function(){return d.CommandUtils}});var h=H;Object.defineProperty(t,"DbBuildError",{enumerable:!0,get:function(){return h.DbBuildError}}),n(he,t)}(S);var Gr={},zr=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},Vr=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.Aggregate=void 0;var Wr=S,Jr=p,Kr=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new Wr.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 Vr(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,Jr.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},t}();Gr.Aggregate=Kr;var Yr={},Xr={},Zr=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},to=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.Query=void 0;var eo=S,no=p,ro=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new eo.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 Zr(this,void 0,void 0,(function(){var e,n,r;return to(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,no.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.set=function(t){return Zr(this,void 0,void 0,(function(){var e,n,r;return to(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,no.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.remove=function(){return Zr(this,void 0,void 0,(function(){var t,e,n;return to(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,no.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.get=function(){return Zr(this,void 0,void 0,(function(){var t,e,n;return to(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,no.ResponseUtil.handleResponse(n)]}}))}))},t.prototype.count=function(){return Zr(this,void 0,void 0,(function(){var t,e,n;return to(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:no.ResponseUtil.handleResponse(n).count}]}}))}))},t.prototype.getCollectionPath=function(){return"/".concat(this.options.databaseName||"faas","/").concat(this.collectionName)},t}();Xr.Query=ro;var oo=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},io=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.Document=void 0;var uo=f,ao=Xr,co=function(){function t(t,e,n){this.collectionName=t,this.id=e,this.options=n}return t.prototype.update=function(t){return oo(this,void 0,void 0,(function(){return io(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 oo(this,void 0,void 0,(function(){return io(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 oo(this,void 0,void 0,(function(){return io(this,(function(t){switch(t.label){case 0:return[4,this.query.remove()];case 1:return[2,t.sent()]}}))}))},t.prototype.get=function(){return oo(this,void 0,void 0,(function(){var t,e;return io(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 uo.FaasError.NOT_FOUND_ERR("不存在_id 为 ".concat(this.id," 的文档"));return[2,null]}return[2,e]}}))}))},Object.defineProperty(t.prototype,"query",{get:function(){return new ao.Query(this.collectionName,this.options).where({_id:String(this.id)}).limit(1)},enumerable:!1,configurable:!0}),t}();Yr.Document=co;var so=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},lo=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(j,"__esModule",{value:!0}),j.Collection=void 0;var po=S,fo=p,ho=Gr,yo=Yr,mo=Xr,vo=function(){function t(t,e){this.collectionName=t,this.options=e,this.builder=new po.CollectionBuilder(t)}return t.prototype.add=function(t){return so(this,void 0,void 0,(function(){var e,n,r;return lo(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,fo.ResponseUtil.handleResponse(r)]}}))}))},t.prototype.doc=function(t){return new yo.Document(this.collectionName,t,this.options)},t.prototype.limit=function(t){return new mo.Query(this.collectionName,this.options).limit(t)},t.prototype.skip=function(t){return new mo.Query(this.collectionName,this.options).skip(t)},t.prototype.where=function(t){return new mo.Query(this.collectionName,this.options).where(t)},t.prototype.projection=function(t){return new mo.Query(this.collectionName,this.options).projection(t)},t.prototype.field=function(t){return new mo.Query(this.collectionName,this.options).field(t)},t.prototype.orderBy=function(t,e){return new mo.Query(this.collectionName,this.options).orderBy(t,e)},t.prototype.aggregate=function(){return new ho.Aggregate(this.collectionName,this.options)},t.prototype.get=function(){return so(this,void 0,void 0,(function(){return lo(this,(function(t){switch(t.label){case 0:return[4,new mo.Query(this.collectionName,this.options).get()];case 1:return[2,t.sent()]}}))}))},t.prototype.count=function(){return so(this,void 0,void 0,(function(){return lo(this,(function(t){switch(t.label){case 0:return[4,new mo.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||"")},t}();j.Collection=vo;var go=i&&i.__assign||function(){return go=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},go.apply(this,arguments)},_o=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},bo=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(x,"__esModule",{value:!0}),x.Database=void 0;var wo=j,Oo=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 _o(this,void 0,void 0,(function(){return bo(this,(function(t){switch(t.label){case 0:return[4,this.httpclient.request({method:e,path:n,data:r,headers:go({"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}(),Co=function(){function t(t){this.options=go(go({},t),{httpclient:new Oo(t.httpclient)})}return t.prototype.collection=function(t){return new wo.Collection(t,this.options)},t}();x.Database=Co;var Ao={},Po=i&&i.__assign||function(){return Po=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},Po.apply(this,arguments)},xo=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(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(u,a)}c((r=r.apply(t,e||[])).next())}))},jo=i&&i.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=e.call(t,u)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.Storage=void 0;var So=f,Eo=p,Do=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 So.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 xo(this,void 0,void 0,(function(){var e,n,r,o,i,u;return jo(this,(function(a){switch(a.label){case 0:if(e=this.checkCloudPath(t.cloudPath))throw So.FaasError.INVALID_PARAM_ERR("cloudPath",e);return n=this.getUploadPath(t.cloudPath.trim()),[4,this.request({method:"GET",path:n})];case 1:return r=a.sent(),o=Eo.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!==(u=a.sent()).statusCode)throw So.FaasError.STORAGE_ERR(-1,"文件下载失败",r.requestID);return[2,{fileID:i,statusCode:u.statusCode}]}}))}))},t.prototype.downloadFile=function(t){return xo(this,void 0,void 0,(function(){var e,n,r,o,i,u;return jo(this,(function(a){switch(a.label){case 0:if(e=this.checkFileID(t.fileID))throw So.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=a.sent(),i=Eo.ResponseUtil.handleResponse(o),[4,this.options.fileUploader.download({fileID:t.fileID,downloadURL:i.download_url})];case 2:if(200!==(u=a.sent()).statusCode)throw So.FaasError.STORAGE_ERR(-1,"文件下载失败",o.requestID);return[2,u]}}))}))},t.prototype.deleteFile=function(t){return xo(this,void 0,void 0,(function(){var e,n,r,o,i,u,a,c,s,l=this;return jo(this,(function(p){switch(p.label){case 0:if(e=Array.isArray(t)?t:t.fileList,!Array.isArray(e)||0===e.length)throw So.FaasError.INVALID_PARAM_ERR("fileList","不能为空数组");for(n=[],r=0,o=e;r<o.length;r++){if(i=o[r],u=this.checkFileID(i))throw So.FaasError.INVALID_PARAM_ERR("fileID",u);a=this.getCloudPathFromFileID(i),n.push(a)}return c=this.getBatchDeletePath(),[4,this.request({method:"POST",path:c,data:{file_list:n}})];case 1:return s=p.sent(),[2,{fileList:Eo.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 xo(this,void 0,void 0,(function(){var e,n,r,o,i,u,a,c,s,l=this;return jo(this,(function(p){switch(p.label){case 0:if(e=Array.isArray(t)?t:t.fileList,!Array.isArray(e)||0===e.length)throw So.FaasError.INVALID_PARAM_ERR("fileList","不能为空数组");if(e.length>50)throw So.FaasError.INVALID_PARAM_ERR("fileList","最大长度 50");for(n=[],r=0,o=e;r<o.length;r++){if(i=o[r],u=this.checkFileID(i))throw So.FaasError.INVALID_PARAM_ERR("fileID",u);a=this.getCloudPathFromFileID(i),n.push({file_id:a,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:Eo.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 xo(this,void 0,void 0,(function(){return jo(this,(function(t){switch(t.label){case 0:return[4,this.options.httpclient.request({method:e,path:n,data:r,headers:Po({"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}();Ao.Storage=Do,Object.defineProperty(s,"__esModule",{value:!0}),s.WebSDK=void 0;var Ro=l,Mo=w,qo=x,No=Ao,Io=function(){function t(){}return t.createCallFunction=function(t){return(0,Mo.createCallFunction)(t)},t.createCallContainer=function(t){return(0,Ro.createCallContainer)(t)},t.createDatabase=function(t){return new qo.Database(t)},t.createStorage=function(t){return new No.Storage(t)},t}();s.WebSDK=Io;var Bo={};Object.defineProperty(Bo,"__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=Ao;Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return o.Storage}});var u=x;Object.defineProperty(t,"Database",{enumerable:!0,get:function(){return u.Database}});var a=Yr;Object.defineProperty(t,"Document",{enumerable:!0,get:function(){return a.Document}});var c=j;Object.defineProperty(t,"Collection",{enumerable:!0,get:function(){return c.Collection}});var l=Gr;Object.defineProperty(t,"Aggregate",{enumerable:!0,get:function(){return l.Aggregate}});var d=Xr;Object.defineProperty(t,"Query",{enumerable:!0,get:function(){return d.Query}});var h=f;Object.defineProperty(t,"FaasError",{enumerable:!0,get:function(){return h.FaasError}});var y=p;Object.defineProperty(t,"ResponseUtil",{enumerable:!0,get:function(){return y.ResponseUtil}}),n(Bo,t)}(c);var To={exports:{}};var Qo,ko={exports:{}};function Uo(){return Qo||(Qo=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}}(),u={},a=u.lib={},c=a.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=a.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 u=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=u<<24-(r+i)%4*8}else for(var a=0;a<o;a+=4)e[r+a>>>2]=n[a>>>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=u.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)))}},h=a.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,u=this.blockSize,a=i/(4*u),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*u,l=t.min(4*c,i);if(c){for(var p=0;p<c;p+=u)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});a.Hasher=h.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.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 y.HMAC.init(t,n).finalize(e)}}});var y=u.algo={};return u}(Math),n)}(ko)),ko.exports}!function(t,e){t.exports=Uo().enc.Hex}(To);var $o=u(To.exports),Fo={exports:{}},Lo={exports:{}};!function(t,e){var n;t.exports=(n=Uo(),function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,u=e.algo,a=[],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&&(a[o]=n(t.pow(r,.5))),c[o]=n(t.pow(r,1/3)),o++),r++}();var s=[],l=u.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],u=n[3],a=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 h=s[d-15],y=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,m=s[d-2],v=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;s[d]=y+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+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&p)+c[d]+s[d];f=p,p=l,l=a,a=u+b|0,u=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]+u|0,n[4]=n[4]+a|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)}(Lo);var Ho,Go=Lo.exports,zo=u(Go),Vo={exports:{}};!function(t,e){var n;t.exports=(n=Uo(),Ho||(Ho=1,function(t,e){var n,r,o;t.exports=(r=(n=Uo()).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(),u=this._iKey=e.clone(),a=i.words,c=u.words,s=0;s<n;s++)a[s]^=1549556828,c[s]^=909522486;i.sigBytes=u.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))}})))}(Vo)),n.HmacSHA256)}(Fo);var Wo,Jo=u(Fo.exports);!function(t){t.WEB="WEB",t.ALIPAY_MINI="ALIPAY_MINI",t.WEICHAT_MINI="WEICHAT_MINI"}(Wo||(Wo={}));var Ko=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 u=i[o],a=e.headers[u];r+="".concat(u,":").concat(a,"\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=""),Jo(t,e).toString($o)},t.createHash=function(t){return zo(t).toString($o)},t}(),Yo=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))?Wo.WEB:Wo.WEICHAT_MINI:Wo.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===Wo.WEB)return new URL(t);var n=t.match(/^(https?):\/\/([^/]+)(\/[^?]+)?(\?[^#]+)?/)||[],r=n[1],o=n[2],i=n[3],u=n[4];return{protocol:r||"",host:o||"",pathname:"".concat(i||""),search:u||""}},t}();var Xo=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}(),Zo=function(){function t(){}return t.prototype.request=function(t,e){return r(this,void 0,void 0,(function(){var r,i,u;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})),u={status:r.status},[4,r.json()];case 2:return[2,(u.data=o.sent(),u.headers=i,u)]}}))}))},t}(),ti=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}(),ei=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}(),ni=function(){function t(){}return t.default=function(t){if(!this.singleton)switch(t){case Wo.ALIPAY_MINI:this.singleton=new ti;break;case Wo.WEB:this.singleton=new Zo;break;case Wo.WEICHAT_MINI:this.singleton=new ei;break;default:throw new Error("未知运行环境".concat(t))}return this.singleton},t}();function ri(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||ni.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 oi(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 ii(t){return function(e,i){return r(this,void 0,void 0,(function(){var r,u,a,c,s;return o(this,(function(o){switch(o.label){case 0:return r=Date.now(),u=Yo.parseUrl(e.req.url,e.config.runtime),a={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&&(a[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:u.pathname,query:u.search.substring(1),secretId:e.config.secretId,secretKey:e.config.secretKey,method:e.req.requestOptions.method,headers:a,body:e.req.requestOptions.body,timestamp:r,signedHeaders:c},a.authorization=Ko.sign(s),e.req.requestOptions.headers=n(n({},a),e.req.requestOptions.headers),[4,i()];case 1:return o.sent(),[2]}}))}))}}var ui=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 u=n[i];if(i===n.length&&(u=e),!u)return Promise.resolve();try{return Promise.resolve(u(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,u=t.headers;return r(this,void 0,void 0,(function(){var t,r,a,c;return o(this,(function(o){switch(o.label){case 0:return t=this.config.endpoint+n,r=i?JSON.stringify(i):i,a=Yo.generateUUID(),u=Object.assign({"x-alipay-callid":a,"x-request-id":a,"x-alipay-source":"web,web-sdk","content-type":"application/json"},u),c=new Xo({url:t,requestOptions:{method:e,body:r,headers:u}},this.config),[4,this.handler(c)];case 1:return o.sent(),[2,c.result]}}))}))},t.createFunctionHttpclient=function(e){return new t(e,[oi,ii(["x-to-function-name"]),ri])},t}(),ai=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||Yo.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=ui.createFunctionHttpclient(r),[4,c.WebSDK.createCallFunction({type:"web",httpclient:i})(t)];case 1:return[2,o.sent()]}}))}))},t}();t.Cloud=ai}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/faas-web-sdk",
3
- "version": "1.1.10-alpha.2",
3
+ "version": "1.1.10-alpha.3",
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.10-alpha.2",
21
+ "@alipay/faas-common-sdk": "^1.1.10-alpha.3",
22
22
  "crypto-js": "^4.1.1"
23
23
  },
24
24
  "devDependencies": {