@alipay/faas-common-sdk
Advanced tools
Comparing version 1.1.20-alpha.2 to 1.1.20-alpha.3
@@ -1,1 +0,1 @@ | ||
var h=function(){h=Object.assign||function(o){for(var s,n=1,i=arguments.length;n<i;n++){s=arguments[n];for(var r in s)if(Object.prototype.hasOwnProperty.call(s,r))o[r]=s[r]}return o};return h.apply(this,arguments)};var y=function(o,s,n,i){function r(e){return e instanceof n?e:new n(function(c){c(e)})}return new(n||(n=Promise))(function(e,c){function u(a){try{t(i.next(a))}catch(f){c(f)}}function l(a){try{t(i["throw"](a))}catch(f){c(f)}}function t(a){a.done?e(a.value):r(a.value).then(u,l)}t((i=i.apply(o,s||[])).next())})};var v=function(o,s){var n={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]},i,r,e,c;return c={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(t){return function(a){return l([t,a])}}function l(t){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,t[0]&&(n=0)),n)try{if(i=1,r&&(e=t[0]&2?r["return"]:t[0]?r["throw"]||((e=r["return"])&&e.call(r),0):r.next)&&!(e=e.call(r,t[1])).done)return e;if(r=0,e)t=[t[0]&2,e.value];switch(t[0]){case 0:case 1:e=t;break;case 4:n.label++;return{value:t[1],done:false};case 5:n.label++;r=t[1];t=[0];continue;case 7:t=n.ops.pop();n.trys.pop();continue;default:if(!(e=n.trys,e=e.length>0&&e[e.length-1])&&(t[0]===6||t[0]===2)){n=0;continue}if(t[0]===3&&(!e||t[1]>e[0]&&t[1]<e[3])){n.label=t[1];break}if(t[0]===6&&n.label<e[1]){n.label=e[1];e=t;break}if(e&&n.label<e[2]){n.label=e[2];n.ops.push(t);break}if(e[2])n.ops.pop();n.trys.pop();continue}t=s.call(o,n)}catch(a){t=[6,a];r=0}finally{i=e=0}if(t[0]&5)throw t[1];return{value:t[0]?t[1]:void 0,done:true}}};import{FaasError as d}from"./error";import{wrapCallback as b}from"./utils";export var createCallFunction=function(o){var s=o.httpclient;var n=function(i){return y(void 0,void 0,void 0,function(){var r,e,c,u,l,t,a;return v(this,function(f){switch(f.label){case 0:if(!i.name){throw d.INVALID_PARAM_ERR("name","\u7F3A\u5931")}r=h(h({},i.headers),{"x-to-function-name":i.name,"x-alipay-cloud-mode":"function"});if(i.async){r["x-function-invoke-type"]="async"}e="POST";c="/functions/invokeFunction";return[4,s.request({method:e,path:c,data:i.data,headers:r,responseDataType:i.resultDataType})];case 1:u=f.sent();if(u.status!==200){l=-1;t="";a=u.data;if(a){l=a.errCode,t=a.errMsg;if(a.errDetail){t+="\uFF0C\u8BE6\u60C5\uFF1A".concat(a.errDetail)}}throw d.SERVER_ERR(l,t,u.requestID,u.status)}return[2,{requestID:u.requestID,result:u.data,headers:u.headers}]}})})};return b(n)}; | ||
var h=function(){h=Object.assign||function(o){for(var s,n=1,a=arguments.length;n<a;n++){s=arguments[n];for(var r in s)if(Object.prototype.hasOwnProperty.call(s,r))o[r]=s[r]}return o};return h.apply(this,arguments)};var y=function(o,s,n,a){function r(e){return e instanceof n?e:new n(function(c){c(e)})}return new(n||(n=Promise))(function(e,c){function u(i){try{t(a.next(i))}catch(f){c(f)}}function l(i){try{t(a["throw"](i))}catch(f){c(f)}}function t(i){i.done?e(i.value):r(i.value).then(u,l)}t((a=a.apply(o,s||[])).next())})};var v=function(o,s){var n={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]},a,r,e,c;return c={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(t){return function(i){return l([t,i])}}function l(t){if(a)throw new TypeError("Generator is already executing.");while(c&&(c=0,t[0]&&(n=0)),n)try{if(a=1,r&&(e=t[0]&2?r["return"]:t[0]?r["throw"]||((e=r["return"])&&e.call(r),0):r.next)&&!(e=e.call(r,t[1])).done)return e;if(r=0,e)t=[t[0]&2,e.value];switch(t[0]){case 0:case 1:e=t;break;case 4:n.label++;return{value:t[1],done:false};case 5:n.label++;r=t[1];t=[0];continue;case 7:t=n.ops.pop();n.trys.pop();continue;default:if(!(e=n.trys,e=e.length>0&&e[e.length-1])&&(t[0]===6||t[0]===2)){n=0;continue}if(t[0]===3&&(!e||t[1]>e[0]&&t[1]<e[3])){n.label=t[1];break}if(t[0]===6&&n.label<e[1]){n.label=e[1];e=t;break}if(e&&n.label<e[2]){n.label=e[2];n.ops.push(t);break}if(e[2])n.ops.pop();n.trys.pop();continue}t=s.call(o,n)}catch(i){t=[6,i];r=0}finally{a=e=0}if(t[0]&5)throw t[1];return{value:t[0]?t[1]:void 0,done:true}}};import{FaasError as d}from"./error";import{wrapCallback as b}from"./utils";export var createCallFunction=function(o){var s=o.httpclient;var n=function(a){return y(void 0,void 0,void 0,function(){var r,e,c,u,l,t,i;return v(this,function(f){switch(f.label){case 0:if(!a.name){throw d.INVALID_PARAM_ERR("name","\u7F3A\u5931")}r=h(h({},a.headers),{"x-to-function-name":a.name,"x-alipay-cloud-mode":"function"});if(a.async){r["x-function-invoke-type"]="async"}e="POST";c="/functions/invokeFunction";return[4,s.request({method:e,path:c,data:a.data,headers:r,responseDataType:a.resultDataType,timeout:a.timeout})];case 1:u=f.sent();if(u.status!==200){l=-1;t="";i=u.data;if(i){l=i.errCode,t=i.errMsg;if(i.errDetail){t+="\uFF0C\u8BE6\u60C5\uFF1A".concat(i.errDetail)}}throw d.SERVER_ERR(l,t,u.requestID,u.status)}return[2,{requestID:u.requestID,result:u.data,headers:u.headers}]}})})};return b(n)}; |
@@ -29,2 +29,3 @@ import { DocumentData, UpdateData } from '@alipay/faas-db-builder'; | ||
responseDataType?: ResponseDataType; | ||
timeout?: number; | ||
} | ||
@@ -59,2 +60,3 @@ export interface HttpResponse<T> { | ||
headers?: Record<string, string>; | ||
timeout?: number; | ||
} | ||
@@ -61,0 +63,0 @@ export type CallFunction<T> = FunctionCall<CallFunctionParam, CallFunctionResult<T>>; |
@@ -1,1 +0,1 @@ | ||
"use strict";var __assign=this&&this.__assign||function(){__assign=Object.assign||function(l){for(var c,r=1,i=arguments.length;r<i;r++){c=arguments[r];for(var n in c)if(Object.prototype.hasOwnProperty.call(c,n))l[n]=c[n]}return l};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(l,c,r,i){function n(t){return t instanceof r?t:new r(function(s){s(t)})}return new(r||(r=Promise))(function(t,s){function u(a){try{e(i.next(a))}catch(f){s(f)}}function o(a){try{e(i["throw"](a))}catch(f){s(f)}}function e(a){a.done?t(a.value):n(a.value).then(u,o)}e((i=i.apply(l,c||[])).next())})};var __generator=this&&this.__generator||function(l,c){var r={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,n,t,s;return s={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(e){return function(a){return o([e,a])}}function o(e){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,e[0]&&(r=0)),r)try{if(i=1,n&&(t=e[0]&2?n["return"]:e[0]?n["throw"]||((t=n["return"])&&t.call(n),0):n.next)&&!(t=t.call(n,e[1])).done)return t;if(n=0,t)e=[e[0]&2,t.value];switch(e[0]){case 0:case 1:t=e;break;case 4:r.label++;return{value:e[1],done:false};case 5:r.label++;n=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(t=r.trys,t=t.length>0&&t[t.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!t||e[1]>t[0]&&e[1]<t[3])){r.label=e[1];break}if(e[0]===6&&r.label<t[1]){r.label=t[1];t=e;break}if(t&&r.label<t[2]){r.label=t[2];r.ops.push(e);break}if(t[2])r.ops.pop();r.trys.pop();continue}e=c.call(l,r)}catch(a){e=[6,a];n=0}finally{i=t=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});exports.createCallFunction=void 0;var error_1=require("./error");var utils_1=require("./utils");var createCallFunction=function(l){var c=l.httpclient;var r=function(i){return __awaiter(void 0,void 0,void 0,function(){var n,t,s,u,o,e,a;return __generator(this,function(f){switch(f.label){case 0:if(!i.name){throw error_1.FaasError.INVALID_PARAM_ERR("name","\u7F3A\u5931")}n=__assign(__assign({},i.headers),{"x-to-function-name":i.name,"x-alipay-cloud-mode":"function"});if(i.async){n["x-function-invoke-type"]="async"}t="POST";s="/functions/invokeFunction";return[4,c.request({method:t,path:s,data:i.data,headers:n,responseDataType:i.resultDataType})];case 1:u=f.sent();if(u.status!==200){o=-1;e="";a=u.data;if(a){o=a.errCode,e=a.errMsg;if(a.errDetail){e+="\uFF0C\u8BE6\u60C5\uFF1A".concat(a.errDetail)}}throw error_1.FaasError.SERVER_ERR(o,e,u.requestID,u.status)}return[2,{requestID:u.requestID,result:u.data,headers:u.headers}]}})})};return(0,utils_1.wrapCallback)(r)};exports.createCallFunction=createCallFunction; | ||
"use strict";var __assign=this&&this.__assign||function(){__assign=Object.assign||function(o){for(var c,r=1,a=arguments.length;r<a;r++){c=arguments[r];for(var n in c)if(Object.prototype.hasOwnProperty.call(c,n))o[n]=c[n]}return o};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(o,c,r,a){function n(t){return t instanceof r?t:new r(function(s){s(t)})}return new(r||(r=Promise))(function(t,s){function u(i){try{e(a.next(i))}catch(f){s(f)}}function l(i){try{e(a["throw"](i))}catch(f){s(f)}}function e(i){i.done?t(i.value):n(i.value).then(u,l)}e((a=a.apply(o,c||[])).next())})};var __generator=this&&this.__generator||function(o,c){var r={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},a,n,t,s;return s={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(e){return function(i){return l([e,i])}}function l(e){if(a)throw new TypeError("Generator is already executing.");while(s&&(s=0,e[0]&&(r=0)),r)try{if(a=1,n&&(t=e[0]&2?n["return"]:e[0]?n["throw"]||((t=n["return"])&&t.call(n),0):n.next)&&!(t=t.call(n,e[1])).done)return t;if(n=0,t)e=[e[0]&2,t.value];switch(e[0]){case 0:case 1:t=e;break;case 4:r.label++;return{value:e[1],done:false};case 5:r.label++;n=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(t=r.trys,t=t.length>0&&t[t.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!t||e[1]>t[0]&&e[1]<t[3])){r.label=e[1];break}if(e[0]===6&&r.label<t[1]){r.label=t[1];t=e;break}if(t&&r.label<t[2]){r.label=t[2];r.ops.push(e);break}if(t[2])r.ops.pop();r.trys.pop();continue}e=c.call(o,r)}catch(i){e=[6,i];n=0}finally{a=t=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});exports.createCallFunction=void 0;var error_1=require("./error");var utils_1=require("./utils");var createCallFunction=function(o){var c=o.httpclient;var r=function(a){return __awaiter(void 0,void 0,void 0,function(){var n,t,s,u,l,e,i;return __generator(this,function(f){switch(f.label){case 0:if(!a.name){throw error_1.FaasError.INVALID_PARAM_ERR("name","\u7F3A\u5931")}n=__assign(__assign({},a.headers),{"x-to-function-name":a.name,"x-alipay-cloud-mode":"function"});if(a.async){n["x-function-invoke-type"]="async"}t="POST";s="/functions/invokeFunction";return[4,c.request({method:t,path:s,data:a.data,headers:n,responseDataType:a.resultDataType,timeout:a.timeout})];case 1:u=f.sent();if(u.status!==200){l=-1;e="";i=u.data;if(i){l=i.errCode,e=i.errMsg;if(i.errDetail){e+="\uFF0C\u8BE6\u60C5\uFF1A".concat(i.errDetail)}}throw error_1.FaasError.SERVER_ERR(l,e,u.requestID,u.status)}return[2,{requestID:u.requestID,result:u.data,headers:u.headers}]}})})};return(0,utils_1.wrapCallback)(r)};exports.createCallFunction=createCallFunction; |
@@ -29,2 +29,3 @@ import { DocumentData, UpdateData } from '@alipay/faas-db-builder'; | ||
responseDataType?: ResponseDataType; | ||
timeout?: number; | ||
} | ||
@@ -59,2 +60,3 @@ export interface HttpResponse<T> { | ||
headers?: Record<string, string>; | ||
timeout?: number; | ||
} | ||
@@ -61,0 +63,0 @@ export type CallFunction<T> = FunctionCall<CallFunctionParam, CallFunctionResult<T>>; |
{ | ||
"name": "@alipay/faas-common-sdk", | ||
"version": "1.1.20-alpha.2", | ||
"version": "1.1.20-alpha.3", | ||
"description": "云函数服务通用 SDK", | ||
@@ -33,3 +33,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@alipay/faas-db-builder": "^1.1.20-alpha.2" | ||
"@alipay/faas-db-builder": "^1.1.20-alpha.3" | ||
}, | ||
@@ -36,0 +36,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112983
728