New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@cloudbase/cloud-api

Package Overview
Dependencies
Maintainers
15
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudbase/cloud-api - npm Package Compare versions

Comparing version
0.5.0
to
0.5.1
+9
-8
lib/weda-api-request.js

@@ -41,7 +41,8 @@ "use strict";

async function wedaRequest(params, config) {
debuglog('raw params: ', params, 'config', config);
const logger = (config === null || config === void 0 ? void 0 : config.logger) || debuglog;
logger('[wedaRequest] raw params: ', params, 'config', config);
const commonConfig = Object.assign(Object.assign({}, DEFAULT_CONFIG), (config || {}));
let url = commonConfig.url;
if (commonConfig.target) {
if (/^https?:\/\//i.test(commonConfig.target)) {
if (commonConfig.target || commonConfig.serviceType) {
if (commonConfig.target && /^https?:\/\//i.test(commonConfig.target)) {
url = commonConfig.target;

@@ -51,3 +52,3 @@ }

const targetMap = WEDA_API_URL[commonConfig.serviceType] || WEDA_API_URL.runtime;
url = targetMap[commonConfig.target];
url = targetMap[commonConfig.target] || targetMap.prod;
}

@@ -92,7 +93,7 @@ }

try {
debuglog(`before request, request target: ${commonConfig.url}, method: ${requestConfig.method}, action: ${params.action}`);
debuglog('before request, raw requestConfig:', requestConfig);
debuglog('before request, raw commonConfig:', commonConfig);
logger(`[wedaRequest] request, request target: ${commonConfig.url}, method: ${requestConfig.method}, action: ${params.action}`);
logger('[wedaRequest] request, raw requestConfig:', requestConfig);
logger('[wedaRequest] request, raw commonConfig:', commonConfig);
const data = await request_1.fetch(commonConfig.url, requestConfig, commonConfig.proxy);
debuglog('after request, requestId:', data.Response.RequestId, 'raw response:', data);
logger('[wedaRequest] after request, requestId:', data.Response.RequestId, 'raw response:', data);
if (data.Response.Error) {

@@ -99,0 +100,0 @@ const tcError = new error_1.CloudBaseError(data.Response.Error.Message, {

{
"name": "@cloudbase/cloud-api",
"version": "0.5.0",
"version": "0.5.1",
"description": "The cloud api request package.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -176,3 +176,3 @@ # @cloudbase/cloud-api

*/
uidSource: 1
source: 1
}).then(res => console.log(res))

@@ -179,0 +179,0 @@

@@ -118,14 +118,17 @@ // @ts-ignore

proxy?: string
/** 自定义日志处理函数 */
logger?: (...args: any[]) => void
}
export async function wedaRequest(params: IWedaRequestParams, config?: Partial<IWedaConfig>) {
debuglog('raw params: ', params, 'config', config);
const logger = config?.logger || debuglog;
logger('[wedaRequest] raw params: ', params, 'config', config);
const commonConfig = { ...DEFAULT_CONFIG, ...(config||{})};
let url = commonConfig.url;
if (commonConfig.target) {
if (/^https?:\/\//i.test(commonConfig.target)) {
if (commonConfig.target || commonConfig.serviceType) {
if (commonConfig.target && /^https?:\/\//i.test(commonConfig.target)) {
url = commonConfig.target;
} else {
const targetMap = WEDA_API_URL[commonConfig.serviceType] || WEDA_API_URL.runtime;
url = targetMap[commonConfig.target];
url = targetMap[commonConfig.target] || targetMap.prod;
}

@@ -187,7 +190,7 @@ }

try {
debuglog(`before request, request target: ${commonConfig.url}, method: ${requestConfig.method}, action: ${params.action}`);
debuglog('before request, raw requestConfig:', requestConfig);
debuglog('before request, raw commonConfig:', commonConfig);
logger(`[wedaRequest] request, request target: ${commonConfig.url}, method: ${requestConfig.method}, action: ${params.action}`);
logger('[wedaRequest] request, raw requestConfig:', requestConfig);
logger('[wedaRequest] request, raw commonConfig:', commonConfig);
const data = await fetch(commonConfig.url, requestConfig, commonConfig.proxy);
debuglog('after request, requestId:', data.Response.RequestId, 'raw response:', data);
logger('[wedaRequest] after request, requestId:', data.Response.RequestId, 'raw response:', data);
if (data.Response.Error) {

@@ -194,0 +197,0 @@ const tcError = new CloudBaseError(data.Response.Error.Message, {

@@ -78,4 +78,6 @@ interface ICredentials {

proxy?: string;
/** 自定义日志处理函数 */
logger?: (...args: any[]) => void;
}
export declare function wedaRequest(params: IWedaRequestParams, config?: Partial<IWedaConfig>): Promise<any>;
export {};