New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

flex-plugins-api-utils

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-plugins-api-utils - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

11

dist/http.d.ts
import { AxiosInstance } from 'axios';
interface RequestOption {
cacheable?: boolean;
cacheAge?: number;
}
export interface AuthConfig {

@@ -12,2 +16,3 @@ username: string;

protected readonly client: AxiosInstance;
protected readonly cacheAge: number;
constructor(config: HttpConfig);

@@ -19,6 +24,8 @@ private static prettyPrint;

private static transformResponseError;
list<R>(uri: string): Promise<R[]>;
get<R>(uri: string): Promise<R>;
list<R>(uri: string, option?: RequestOption): Promise<R[]>;
get<R>(uri: string, option?: RequestOption): Promise<R>;
post<R>(uri: string, data: object): Promise<R>;
delete(uri: string): Promise<void>;
private getRequestOption;
}
export {};

@@ -62,2 +62,3 @@ "use strict";

var qs_1 = __importDefault(require("qs"));
var axios_cache_adapter_1 = require("axios-cache-adapter");
var axios_1 = __importDefault(require("axios"));

@@ -68,2 +69,4 @@ var logger_1 = __importDefault(require("./logger"));

function Http(config) {
this.cacheAge = 15 * 60 * 1000;
var cache = axios_cache_adapter_1.setupCache({ maxAge: 0 });
this.client = axios_1.default.create({

@@ -78,2 +81,3 @@ baseURL: config.baseURL,

},
adapter: cache.adapter,
});

@@ -112,3 +116,7 @@ this.client.interceptors.request.use(Http.transformRequest);

var data = resp.data;
logger_1.default.debug("Request resulted in " + resp.status + " with data\n" + Http.prettyPrint(data));
var servedFromCache = resp.request.fromCache === true ? '(served from cache) ' : '';
var pretty = Http.prettyPrint(data);
var url = resp.config.baseURL + "/" + resp.config.url;
var method = resp.request.method || '';
logger_1.default.debug(method + " request to " + url + " " + servedFromCache + "responded with statusCode " + resp.status + " and data\n" + pretty + "\n");
return data;

@@ -130,13 +138,13 @@ };

};
Http.prototype.list = function (uri) {
Http.prototype.list = function (uri, option) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2, this.get(uri)];
return [2, this.get(uri, option)];
});
});
};
Http.prototype.get = function (uri) {
Http.prototype.get = function (uri, option) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2, this.client.get(uri)];
return [2, this.client.get(uri, this.getRequestOption(option))];
});

@@ -159,2 +167,14 @@ });

};
Http.prototype.getRequestOption = function (option) {
var opt = {};
if (!option) {
return opt;
}
if (option.cacheable) {
opt.cache = {
maxAge: option.cacheAge || this.cacheAge,
};
}
return opt;
};
return Http;

@@ -161,0 +181,0 @@ }());

5

package.json
{
"name": "flex-plugins-api-utils",
"version": "0.3.1",
"version": "0.4.0",
"description": "Flex Plugins API Utils",

@@ -53,2 +53,3 @@ "keywords": [

"axios": "^0.19.2",
"axios-cache-adapter": "^2.5.0",
"chalk": "^4.0.0",

@@ -61,3 +62,3 @@ "qs": "^6.9.4",

},
"gitHead": "c8acd1233b79ee5c27c2fbffb2da06ebef8fb36f"
"gitHead": "7b5ef71a5953deae4234abc8ebf2c0e6bf86c6a4"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc