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

oci-common

Package Overview
Dependencies
Maintainers
2
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oci-common - npm Package Compare versions

Comparing version 1.5.7 to 1.6.0

lib/circuit-breaker.d.ts

3

index.d.ts

@@ -17,2 +17,3 @@ /**

import Constants from "./lib/constants";
import CircuitBreaker from "./lib/circuit-breaker";
import { DelayStrategy, TerminationStrategy, ExponentialBackoffDelayStrategy, MaxTimeTerminationStrategy, genericWaiter, genericTerminalConditionWaiter, WaiterConfiguration, MaxAttemptsTerminationStrategy, FixedTimeDelayStrategy } from "./lib/waiter";

@@ -47,2 +48,2 @@ import { GenericRetrier, RetryConfiguration } from "./lib/retrier";

export import Range = range.Range;
export { Region, Realm, EndpointBuilder, DelayStrategy, TerminationStrategy, ExponentialBackoffDelayStrategy, MaxTimeTerminationStrategy, genericWaiter, genericTerminalConditionWaiter, WaiterConfiguration, RequireOnlyOne, AuthParams, paginateRecords, paginatedResponsesWithLimit, paginatedRecordsWithLimit, genericPaginateRecords, paginateResponses, genericPaginateResponses, Method, composeRequest, composeResponse, HttpRequest, ConfigFileAuthenticationDetailsProvider, ConfigFileReader, InstancePrincipalsAuthenticationDetailsProviderBuilder, ResourcePrincipalAuthenticationDetailsProvider, LOG, GenericRetrier, FixedTimeDelayStrategy, MaxAttemptsTerminationStrategy, RetryConfiguration, BaseRequest, ClientConfiguration, Constants };
export { Region, Realm, EndpointBuilder, DelayStrategy, TerminationStrategy, ExponentialBackoffDelayStrategy, MaxTimeTerminationStrategy, genericWaiter, genericTerminalConditionWaiter, WaiterConfiguration, RequireOnlyOne, AuthParams, paginateRecords, paginatedResponsesWithLimit, paginatedRecordsWithLimit, genericPaginateRecords, paginateResponses, genericPaginateResponses, Method, composeRequest, composeResponse, HttpRequest, ConfigFileAuthenticationDetailsProvider, ConfigFileReader, InstancePrincipalsAuthenticationDetailsProviderBuilder, ResourcePrincipalAuthenticationDetailsProvider, LOG, GenericRetrier, FixedTimeDelayStrategy, MaxAttemptsTerminationStrategy, RetryConfiguration, BaseRequest, ClientConfiguration, Constants, CircuitBreaker };

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

exports.Constants = constants_1.default;
const circuit_breaker_1 = __importDefault(require("./lib/circuit-breaker"));
exports.CircuitBreaker = circuit_breaker_1.default;
const waiter_1 = require("./lib/waiter");

@@ -36,0 +38,0 @@ exports.ExponentialBackoffDelayStrategy = waiter_1.ExponentialBackoffDelayStrategy;

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

const url_based_x509_certificate_supplier_1 = require("./url-based-x509-certificate-supplier");
const circuit_breaker_1 = __importDefault(require("../circuit-breaker"));
class AbstractFederationClientAuthenticationDetailsProviderBuilder {

@@ -145,3 +146,3 @@ constructor() {

headers.append(this.AUTHORIZATION, this.METADATA_AUTH_HEADERS);
const httpClient = new http_1.FetchHttpClient(null);
const httpClient = new http_1.FetchHttpClient(null, circuit_breaker_1.default.internalCircuit);
const response = yield httpClient.send({

@@ -148,0 +149,0 @@ uri: url,

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

const helper_1 = require("../helper");
const circuit_breaker_1 = __importDefault(require("../circuit-breaker"));
/**

@@ -94,3 +95,3 @@ * A class that retrieves certificate based on metadata service url

return __awaiter(this, void 0, void 0, function* () {
const httpClient = new http_1.FetchHttpClient(null);
const httpClient = new http_1.FetchHttpClient(null, circuit_breaker_1.default.internalCircuit);
const response = yield httpClient.send({

@@ -97,0 +98,0 @@ uri: this.url,

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

const helper_1 = require("../helper");
const circuit_breaker_1 = __importDefault(require("../circuit-breaker"));
/**

@@ -178,3 +179,3 @@ * This class gets a security token from the auth service by signing the request with a PKI issued leaf certificate,

const signer = new AuthTokenRequestSigner(this.tenancyId, fingerprint, privateKey);
const httpClient = new http_1.FetchHttpClient(signer);
const httpClient = new http_1.FetchHttpClient(signer, circuit_breaker_1.default.internalCircuit);
// Call Auth Service to get a JSON object which contains the auth token

@@ -181,0 +182,0 @@ const response = yield httpClient.send(requestObj);

@@ -6,2 +6,3 @@ /**

import { RetryConfiguration } from "./retrier";
import CircuitBreaker from "./circuit-breaker";
/**

@@ -18,2 +19,3 @@ * This interface defines the client configuration properties to be used at the client level

"retryConfiguration"?: RetryConfiguration;
circuitBreaker?: CircuitBreaker;
}

@@ -8,2 +8,3 @@ /**

import { HttpRequest } from "./http-request";
declare const Breaker: any;
export interface HttpClient {

@@ -14,4 +15,6 @@ send(req: HttpRequest, forceExcludeBody?: boolean): Promise<Response>;

private readonly signer;
constructor(signer: RequestSigner | null);
private circuitBreaker;
constructor(signer: RequestSigner | null, circuitBreaker?: typeof Breaker);
send(req: HttpRequest, forceExcludeBody?: boolean): Promise<Response>;
}
export {};

@@ -22,2 +22,5 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -27,6 +30,12 @@ const promise = __importStar(require("es6-promise"));

const helper_1 = require("./helper");
const Breaker = require("opossum");
const circuit_breaker_1 = __importDefault(require("./circuit-breaker"));
promise.polyfill();
class FetchHttpClient {
constructor(signer) {
constructor(signer, circuitBreaker) {
this.signer = signer;
this.circuitBreaker = null;
if (circuitBreaker) {
this.circuitBreaker = circuitBreaker;
}
}

@@ -46,8 +55,24 @@ send(req, forceExcludeBody = false) {

}
// Send Request
return fetch(new Request(req.uri, {
const request = new Request(req.uri, {
method: req.method,
headers: req.headers,
body: body.requestBody
}));
});
if (this.circuitBreaker) {
// The circuitBreaker library have .fire return as any, we need to cast it to a Promise<Response> to be consistent with
// a fetch response type.
return this.circuitBreaker.fire(request);
}
else if (circuit_breaker_1.default.enableDefault) {
// else if we opt'd to use a default circuit breaker, an http call by default
// will use the default circuit breaker to make the call
return circuit_breaker_1.default.defaultCircuit.fire(request);
}
else {
return fetch(new Request(req.uri, {
method: req.method,
headers: req.headers,
body: body.requestBody
}));
}
});

@@ -54,0 +79,0 @@ }

{
"name": "oci-common",
"version": "1.5.7",
"version": "1.6.0",
"description": "OCI Common module for NodeJS",

@@ -5,0 +5,0 @@ "repository": {

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

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