@alipay/faas-server-sdk
Advanced tools
Comparing version 1.1.16-alpha.3 to 1.1.16-alpha.4
@@ -1,1 +0,1 @@ | ||
"use strict";var __importDefault=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Httpclient=void 0;const node_assert_1=__importDefault(require("node:assert")),node_crypto_1=require("node:crypto"),node_diagnostics_channel_1=__importDefault(require("node:diagnostics_channel")),koa_compose_1=__importDefault(require("koa-compose")),faas_server_utils_1=require("@alipay/faas-server-utils"),constant_1=require("../constant"),HttpRequestContext_1=require("./HttpRequestContext"),call_middleware_1=require("./middlewares/call_middleware"),error_handler_middleware_1=require("./middlewares/error_handler_middleware"),init_call_dataproxy_headers_middleware_1=require("./middlewares/init_call_dataproxy_headers_middleware"),init_call_functiongateway_headers_middleware_1=require("./middlewares/init_call_functiongateway_headers_middleware"),sign_middleware_factory_1=require("./middlewares/sign_middleware_factory"),debug=(0,faas_server_utils_1.debuglog)("faas-server-sdk:httpRequest");class Httpclient{#t;#e;#r;constructor(t,e,r){(0,node_assert_1.default)(e,"cloud config not set"),this.#t=t,this.#e=e,this.#r=(0,koa_compose_1.default)(r)}async request(t){return(await this.requestRaw(t)).result}async requestRaw({method:t,path:e,data:r,headers:a}){const l=this.#e[this.#t]+e,c=r&&JSON.stringify(r),i=(0,faas_server_utils_1.getAlipayContext)();a=a||{},a["x-alipay-callid"]=a["x-request-id"]=i.TRACEID||(0,node_crypto_1.randomUUID)();let n=process.env.RUNTIME_CURRENT_SOURCE||"alipay_unknown";process.env.RUNTIME_FUNCTION_NAME&&(n=`${n}:${i.ENV}:${process.env.RUNTIME_FUNCTION_NAME}`);const u=i.SOURCE||"alipay_unknown";a["x-alipay-source"]=`${u},${n}`,a["user-agent"]=constant_1.SDK_USER_AGENT,a["x-alipay-req-source"]=i.REQUEST_SOURCE,a.soure_app=i.SOURCE_APP;const o={method:t,contentType:"application/json",content:c,dataType:"json",headers:a};this.#e.timeout!==void 0&&(o.timeout=this.#e.timeout),debug("requestRaw(url:%o, options:%o)",l,o);const _={url:new URL(l),requestOptions:o},d=new HttpRequestContext_1.HttpRequestContext(_,this.#e);return await this.#r(d),d}static createFunctionHttpclient(t){const e=[error_handler_middleware_1.errorHandlerMiddleware,(0,init_call_functiongateway_headers_middleware_1.createInitCallFunctionGatewayHeadersMiddleware)(),(0,sign_middleware_factory_1.signMiddlewareFactory)(["x-to-function-name"]),call_middleware_1.callMiddleware];return new Httpclient("functionGatewayEndpoint",t,e)}static createDatabaseHttpclient(t){const e=[error_handler_middleware_1.errorHandlerMiddleware,(0,init_call_dataproxy_headers_middleware_1.createInitCallDataProxyHeadersMiddleware)("mongo"),(0,sign_middleware_factory_1.signMiddlewareFactory)(["x-data-api-type","x-expire-timestamp"]),call_middleware_1.callMiddleware];return new Httpclient("functionDatabaseEndpoint",t,e)}static createStorageHttpclient(t){const e=[error_handler_middleware_1.errorHandlerMiddleware,(0,init_call_dataproxy_headers_middleware_1.createInitCallDataProxyHeadersMiddleware)("oss"),(0,sign_middleware_factory_1.signMiddlewareFactory)(["x-data-api-type","x-expire-timestamp"]),call_middleware_1.callMiddleware];return new Httpclient("functionStorageEndpoint",t,e)}static createOpenapiHttpclient(t){const e=[error_handler_middleware_1.errorHandlerMiddleware,(0,init_call_functiongateway_headers_middleware_1.createInitCallFunctionGatewayHeadersMiddleware)(),(0,sign_middleware_factory_1.signMiddlewareFactory)(["x-openapi","x-openapi-version"]),call_middleware_1.callMiddleware];return new Httpclient("functionGatewayEndpoint",t,e)}}exports.Httpclient=Httpclient,debug.enabled&&(node_diagnostics_channel_1.default.subscribe("urllib:request",s=>{const{request:t}=s;debug("[urllib:request] request#%s %s %o, headers: %o",t.requestId,t.args.method,t.url,t.args.headers)}),node_diagnostics_channel_1.default.subscribe("urllib:response",s=>{const{request:t,response:e,error:r}=s;debug("[urllib:response] request#%s got response %s, status: %o, size: %o, headers: %o, rt: %o, timing: %o, socket: %o, requestUrls: %o",t.requestId,r?"error":"success",e.status,e.size,e.headers,e.rt,e.timing,e.socket,e.requestUrls),r&&debug("[urllib:response] %s",r)})); | ||
"use strict";var __importDefault=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Httpclient=void 0;const node_assert_1=__importDefault(require("node:assert")),node_crypto_1=require("node:crypto"),node_diagnostics_channel_1=__importDefault(require("node:diagnostics_channel")),koa_compose_1=__importDefault(require("koa-compose")),faas_server_utils_1=require("@alipay/faas-server-utils"),constant_1=require("../constant"),HttpRequestContext_1=require("./HttpRequestContext"),bson_middleware_1=require("./middlewares/bson_middleware"),call_middleware_1=require("./middlewares/call_middleware"),error_handler_middleware_1=require("./middlewares/error_handler_middleware"),init_call_dataproxy_headers_middleware_1=require("./middlewares/init_call_dataproxy_headers_middleware"),init_call_functiongateway_headers_middleware_1=require("./middlewares/init_call_functiongateway_headers_middleware"),sign_middleware_factory_1=require("./middlewares/sign_middleware_factory"),debug=(0,faas_server_utils_1.debuglog)("faas-server-sdk:httpRequest");class Httpclient{#t;#e;#r;constructor(t,e,r){(0,node_assert_1.default)(e,"cloud config not set"),this.#t=t,this.#e=e,this.#r=(0,koa_compose_1.default)(r)}async request(t){return(await this.requestRaw(t)).result}async requestRaw({method:t,path:e,data:r,headers:a}){const d=this.#e[this.#t]+e,c=r&&JSON.stringify(r),i=(0,faas_server_utils_1.getAlipayContext)();a=a||{},a["x-alipay-callid"]=a["x-request-id"]=i.TRACEID||(0,node_crypto_1.randomUUID)();let n=process.env.RUNTIME_CURRENT_SOURCE||"alipay_unknown";process.env.RUNTIME_FUNCTION_NAME&&(n=`${n}:${i.ENV}:${process.env.RUNTIME_FUNCTION_NAME}`);const u=i.SOURCE||"alipay_unknown";a["x-alipay-source"]=`${u},${n}`,a["user-agent"]=constant_1.SDK_USER_AGENT,a["x-alipay-req-source"]=i.REQUEST_SOURCE,a.soure_app=i.SOURCE_APP;const o={method:t,contentType:"application/json",content:c,dataType:"json",headers:a};this.#e.timeout!==void 0&&(o.timeout=this.#e.timeout),debug("requestRaw(url:%o, options:%o)",d,o);const _={url:new URL(d),requestOptions:o},l=new HttpRequestContext_1.HttpRequestContext(_,this.#e);return await this.#r(l),l}static createFunctionHttpclient(t){const e=[error_handler_middleware_1.errorHandlerMiddleware,(0,init_call_functiongateway_headers_middleware_1.createInitCallFunctionGatewayHeadersMiddleware)(),(0,sign_middleware_factory_1.signMiddlewareFactory)(["x-to-function-name"]),call_middleware_1.callMiddleware];return new Httpclient("functionGatewayEndpoint",t,e)}static createDatabaseHttpclient(t){const e=[error_handler_middleware_1.errorHandlerMiddleware,(0,init_call_dataproxy_headers_middleware_1.createInitCallDataProxyHeadersMiddleware)("mongo"),(0,sign_middleware_factory_1.signMiddlewareFactory)(["x-data-api-type","x-expire-timestamp"]),bson_middleware_1.bsonMiddleware,call_middleware_1.callMiddleware];return new Httpclient("functionDatabaseEndpoint",t,e)}static createStorageHttpclient(t){const e=[error_handler_middleware_1.errorHandlerMiddleware,(0,init_call_dataproxy_headers_middleware_1.createInitCallDataProxyHeadersMiddleware)("oss"),(0,sign_middleware_factory_1.signMiddlewareFactory)(["x-data-api-type","x-expire-timestamp"]),call_middleware_1.callMiddleware];return new Httpclient("functionStorageEndpoint",t,e)}static createOpenapiHttpclient(t){const e=[error_handler_middleware_1.errorHandlerMiddleware,(0,init_call_functiongateway_headers_middleware_1.createInitCallFunctionGatewayHeadersMiddleware)(),(0,sign_middleware_factory_1.signMiddlewareFactory)(["x-openapi","x-openapi-version"]),call_middleware_1.callMiddleware];return new Httpclient("functionGatewayEndpoint",t,e)}}exports.Httpclient=Httpclient,debug.enabled&&(node_diagnostics_channel_1.default.subscribe("urllib:request",s=>{const{request:t}=s;debug("[urllib:request] request#%s %s %o, headers: %o",t.requestId,t.args.method,t.url,t.args.headers)}),node_diagnostics_channel_1.default.subscribe("urllib:response",s=>{const{request:t,response:e,error:r}=s;debug("[urllib:response] request#%s got response %s, status: %o, size: %o, headers: %o, rt: %o, timing: %o, socket: %o, requestUrls: %o",t.requestId,r?"error":"success",e.status,e.size,e.headers,e.rt,e.timing,e.socket,e.requestUrls),r&&debug("[urllib:response] %s",r)})); |
@@ -37,6 +37,3 @@ /// <reference types="node" /> | ||
export interface CollectionDescription { | ||
coll_id: number; | ||
coll_name: string; | ||
db_id: number; | ||
create_time: number; | ||
} | ||
@@ -43,0 +40,0 @@ export interface AddOneDocumentResult { |
{ | ||
"name": "@alipay/faas-server-sdk", | ||
"version": "1.1.16-alpha.3", | ||
"version": "1.1.16-alpha.4", | ||
"description": "云函数服务 SDK", | ||
@@ -37,5 +37,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@alipay/faas-common-sdk": "^1.1.16-alpha.3", | ||
"@alipay/faas-db-builder": "^1.1.16-alpha.3", | ||
"@alipay/faas-server-utils": "^1.1.16-alpha.3", | ||
"@alipay/faas-common-sdk": "^1.1.16-alpha.4", | ||
"@alipay/faas-db-builder": "^1.1.16-alpha.4", | ||
"@alipay/faas-server-utils": "^1.1.16-alpha.4", | ||
"ali-rds": "^6.2.0", | ||
@@ -42,0 +42,0 @@ "ioredis": "^5.3.2", |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
247641
354
22