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
7
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.1.2
to
0.1.3
+3
.vscode/settings.json
{
"rdhelper.cas.lastupdatefile": "src/index.ts"
}
+2
-0

@@ -58,2 +58,4 @@ "use strict";

exports.fetch = request_1.fetch;
exports.fetchStream = request_1.fetchStream;
exports.nodeFetch = request_1.nodeFetch;
class CloudApiService {

@@ -60,0 +62,0 @@ constructor(options) {

@@ -9,3 +9,4 @@ "use strict";

const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
async function fetch(url, config, proxy) {
exports.nodeFetch = node_fetch_1.default;
async function fetch(url, config, proxy = '') {
if (proxy) {

@@ -19,1 +20,9 @@ config.agent = https_proxy_agent_1.default(proxy);

exports.fetch = fetch;
async function fetchStream(url, config, proxy = '') {
if (proxy) {
config.agent = https_proxy_agent_1.default(proxy);
}
const escapeUrl = new url_1.URL(url).toString();
return node_fetch_1.default(escapeUrl, config);
}
exports.fetchStream = fetchStream;
+2
-1
{
"name": "@cloudbase/cloud-api",
"version": "0.1.2",
"version": "0.1.3",
"description": "The cloud api request package.",

@@ -16,2 +16,3 @@ "main": "lib/index.js",

"@types/node": "^12.12.31",
"@types/node-fetch": "^2.5.6",
"@typescript-eslint/eslint-plugin": "^2.25.0",

@@ -18,0 +19,0 @@ "@typescript-eslint/parser": "^2.25.0",

@@ -5,3 +5,3 @@ import crypto from 'crypto'

import { fetch as _fetch } from './request'
import { fetch as _fetch, fetchStream as _fetchStream, nodeFetch as _nodeFetch } from './request'
import { CloudBaseError } from './error'

@@ -80,2 +80,4 @@

export const fetch = _fetch
export const fetchStream = _fetchStream
export const nodeFetch = _nodeFetch

@@ -82,0 +84,0 @@ export class CloudApiService {

import { URL } from 'url'
import _fetch from 'node-fetch'
import _fetch, { RequestInit } from 'node-fetch'
import HttpsProxyAgent from 'https-proxy-agent'
export const nodeFetch = _fetch
// 使用 fetch + 代理
export async function fetch(url: string, config: Record<string, any>, proxy) {
export async function fetch(url: string, config: RequestInit, proxy = '') {
if (proxy) {
config.agent = HttpsProxyAgent(proxy)
}
// 解决中文编码问题
const escapeUrl = new URL(url).toString()
const res = await _fetch(escapeUrl, config)
return res.json()
}
export async function fetchStream(url: string, config: RequestInit, proxy = '') {
if (proxy) {
config.agent = HttpsProxyAgent(proxy)
}
const escapeUrl = new URL(url).toString()
return _fetch(escapeUrl, config)
}

@@ -1,2 +0,2 @@

import { fetch as _fetch } from './request';
import { fetch as _fetch, fetchStream as _fetchStream } from './request';
export interface ServiceOptions {

@@ -18,2 +18,4 @@ service: string;

export declare const fetch: typeof _fetch;
export declare const fetchStream: typeof _fetchStream;
export declare const nodeFetch: typeof import("node-fetch").default;
export declare class CloudApiService {

@@ -20,0 +22,0 @@ static serviceCacheMap: Record<string, CloudApiService>;

@@ -1,1 +0,4 @@

export declare function fetch(url: string, config: Record<string, any>, proxy: any): Promise<any>;
import _fetch, { RequestInit } from 'node-fetch';
export declare const nodeFetch: typeof _fetch;
export declare function fetch(url: string, config: RequestInit, proxy?: string): Promise<any>;
export declare function fetchStream(url: string, config: RequestInit, proxy?: string): Promise<import("node-fetch").Response>;