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