Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

defender-base-client

Package Overview
Dependencies
Maintainers
8
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defender-base-client - npm Package Compare versions

Comparing version 1.37.0 to 1.38.0-rc.1

6

lib/api/api.d.ts

@@ -0,6 +1,8 @@

/// <reference types="node" />
import { AxiosError, AxiosInstance } from 'axios';
import https from 'https';
import { PoolData, UserPass } from './auth';
export declare function rejectWithDefenderApiError(axiosError: AxiosError): Promise<never>;
export declare function createApi(key: string, token: string, apiUrl: string): AxiosInstance;
export declare function createAuthenticatedApi(userPass: UserPass, poolData: PoolData, apiUrl: string): Promise<AxiosInstance>;
export declare function createApi(key: string, token: string, apiUrl: string, httpsAgent?: https.Agent): AxiosInstance;
export declare function createAuthenticatedApi(userPass: UserPass, poolData: PoolData, apiUrl: string, httpsAgent?: https.Agent): Promise<AxiosInstance>;
//# sourceMappingURL=api.d.ts.map

@@ -14,3 +14,3 @@ "use strict";

exports.rejectWithDefenderApiError = rejectWithDefenderApiError;
function createApi(key, token, apiUrl) {
function createApi(key, token, apiUrl, httpsAgent) {
const instance = axios_1.default.create({

@@ -23,2 +23,3 @@ baseURL: apiUrl,

},
httpsAgent,
});

@@ -29,7 +30,7 @@ instance.interceptors.response.use(({ data }) => data, rejectWithDefenderApiError);

exports.createApi = createApi;
async function createAuthenticatedApi(userPass, poolData, apiUrl) {
async function createAuthenticatedApi(userPass, poolData, apiUrl, httpsAgent) {
const token = await auth_1.authenticate(userPass, poolData);
const api = createApi(userPass.Username, token, apiUrl);
const api = createApi(userPass.Username, token, apiUrl, httpsAgent);
return api;
}
exports.createAuthenticatedApi = createAuthenticatedApi;

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

/// <reference types="node" />
import { AxiosInstance } from 'axios';
import https from 'https';
export declare abstract class BaseApiClient {

@@ -6,2 +8,3 @@ private api;

private apiSecret;
private httpsAgent?;
protected abstract getPoolId(): string;

@@ -13,2 +16,3 @@ protected abstract getPoolClientId(): string;

apiSecret: string;
httpsAgent?: https.Agent;
});

@@ -15,0 +19,0 @@ protected init(): Promise<AxiosInstance>;

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

this.apiSecret = params.apiSecret;
this.httpsAgent = params.httpsAgent;
}

@@ -19,3 +20,3 @@ async init() {

const poolData = { UserPoolId: this.getPoolId(), ClientId: this.getPoolClientId() };
this.api = api_1.createAuthenticatedApi(userPass, poolData, this.getApiUrl());
this.api = api_1.createAuthenticatedApi(userPass, poolData, this.getApiUrl(), this.httpsAgent);
}

@@ -22,0 +23,0 @@ return this.api;

{
"name": "defender-base-client",
"version": "1.37.0",
"version": "1.38.0-rc.1",
"description": "",

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

},
"gitHead": "4b153fb8b16facd6713921faa4499af0b55c9e6e"
"gitHead": "6c2082ed372e93ccad04347786cf233d3186c8d8"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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