Socket
Socket
Sign inDemoInstall

oci-common

Package Overview
Dependencies
Maintainers
2
Versions
192
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.3.0 to 1.4.0

lib/base-request.d.ts

8

index.d.ts

@@ -16,3 +16,4 @@ /**

import { LOG } from "./lib/log";
import { DelayStrategy, TerminationStrategy, ExponentialBackoffDelayStrategy, MaxTimeTerminationStrategy, genericWaiter, genericTerminalConditionWaiter, WaiterConfiguration } from "./lib/waiter";
import { DelayStrategy, TerminationStrategy, ExponentialBackoffDelayStrategy, MaxTimeTerminationStrategy, genericWaiter, genericTerminalConditionWaiter, WaiterConfiguration, MaxAttemptsTerminationStrategy, FixedTimeDelayStrategy } from "./lib/waiter";
import { GenericRetrier, RetryConfiguration } from "./lib/retrier";
import { RequireOnlyOne, AuthParams } from "./lib/types";

@@ -22,2 +23,4 @@ import { HttpRequest } from "./lib/http-request";

import ResourcePrincipalAuthenticationDetailsProvider from "./lib/auth/resource-principal-authentication-details-provider";
import { BaseRequest } from "./lib/base-request";
import { ClientConfiguration } from "./lib/client-configuration";
import { paginateRecords, genericPaginateRecords, paginatedRecordsWithLimit, paginateResponses, genericPaginateResponses, paginatedResponsesWithLimit } from "./lib/paginators";

@@ -37,2 +40,3 @@ import { ConfigFileAuthenticationDetailsProvider } from "./lib/auth/config-file-auth";

export import DefaultRequestSigner = signer.DefaultRequestSigner;
export import getStringFromResponseBody = helper.getStringFromResponseBody;
export import handleErrorResponse = helper.handleErrorResponse;

@@ -44,2 +48,2 @@ export import mapContainer = helper.mapContainer;

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 };
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 };

@@ -37,2 +37,6 @@ "use strict";

exports.genericTerminalConditionWaiter = waiter_1.genericTerminalConditionWaiter;
exports.MaxAttemptsTerminationStrategy = waiter_1.MaxAttemptsTerminationStrategy;
exports.FixedTimeDelayStrategy = waiter_1.FixedTimeDelayStrategy;
const retrier_1 = require("./lib/retrier");
exports.GenericRetrier = retrier_1.GenericRetrier;
const instance_principals_authentication_detail_provider_1 = __importDefault(require("./lib/auth/instance-principals-authentication-detail-provider"));

@@ -62,2 +66,3 @@ exports.InstancePrincipalsAuthenticationDetailsProviderBuilder = instance_principals_authentication_detail_provider_1.default;

exports.DefaultRequestSigner = signer.DefaultRequestSigner;
exports.getStringFromResponseBody = helper.getStringFromResponseBody;
exports.handleErrorResponse = helper.handleErrorResponse;

@@ -64,0 +69,0 @@ exports.mapContainer = helper.mapContainer;

@@ -22,2 +22,11 @@ /**

constructor(configurationFilePath?: string, profile?: string);
/**
* Get a region based on regionId, if corresponding region is not found from regionId,
* create a new region by registering regionId with Realm.OC1
*
* @param regionId: string
* @param region: any
* @return: Region
*/
retrieveRegionFromRegionId(regionId: string): Region;
createConfigFileAuth(file: ConfigFile): SimpleAuthenticationDetailsProvider;

@@ -24,0 +33,0 @@ getPvtKey(filePath: string): string;

@@ -43,2 +43,21 @@ "use strict";

}
/**
* Get a region based on regionId, if corresponding region is not found from regionId,
* create a new region by registering regionId with Realm.OC1
*
* @param regionId: string
* @param region: any
* @return: Region
*/
retrieveRegionFromRegionId(regionId) {
let region;
try {
return (region = region_1.Region.fromRegionId(regionId));
}
catch (e) {
console.warn(`Found regionId ${regionId} in config file, but not supported by this version of the SDK`);
// Proceed by assuming the region id in the config file belongs to OC1 realm.
return (region = region_1.Region.register(regionId, realm_1.Realm.OC1));
}
}
createConfigFileAuth(file) {

@@ -52,15 +71,9 @@ const fingerprint = utils_1.checkNotNull(file.get("fingerprint"), "missing fingerprint in config");

let region = null;
const regionId = file.get("region");
if (regionId !== null) {
try {
region = region_1.Region.fromRegionId(regionId);
}
catch (e) {
console.warn(`Found regionId ${regionId} in config file, but not supported by this version of the SDK`);
// Proceed by assuming the region id in the config file belongs to OC1 realm.
region = region_1.Region.register(regionId, realm_1.Realm.OC1);
}
const regionEnvVar = process.env.OCI_REGION;
let regionId = file.get("region") || regionEnvVar;
if (regionId) {
region = this.retrieveRegionFromRegionId(regionId);
}
else {
throw Error("Region not specified in Config file. Can not proceed without setting a region.");
throw Error("Region not specified in Config file or OCI_REGION env variable. Can not proceed without setting a region.");
}

@@ -67,0 +80,0 @@ return new auth_1.SimpleAuthenticationDetailsProvider(tenantId, user, fingerprint, privateKey, passPhrase, region);

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

static UK_GOV_LONDON_1: Region;
static UK_GOV_CARDIFF_1: Region;
static fromRegionId(regionId: string): Region;

@@ -47,0 +48,0 @@ static register(regionId: string, realm: Realm): Region;

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

"tus": "us-gov-phoenix-1",
"sjc": "us-sanjose-1"
"sjc": "us-sanjose-1",
"brs": "uk-gov-cardiff-1"
};

@@ -115,2 +116,3 @@ Region.KNOWN_REGIONS = new Map();

Region.UK_GOV_LONDON_1 = Region.register("uk-gov-london-1", realm_1.Realm.OC4);
Region.UK_GOV_CARDIFF_1 = Region.register("uk-gov-cardiff-1", realm_1.Realm.OC4);
//# sourceMappingURL=region.js.map

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

})
.filter(key => key !== undefined && key !== null)
.join("&");

@@ -88,0 +89,0 @@ }

@@ -16,6 +16,10 @@ /**

}
interface WaitContext {
export interface WaitContext {
readonly startTime: Date;
readonly attemptCount: number;
}
export declare class WaitContextImpl implements WaitContext {
readonly startTime: Date;
attemptCount: number;
}
export declare class ExponentialBackoffDelayStrategy implements DelayStrategy {

@@ -27,2 +31,12 @@ private maxDelayInSeconds;

}
export declare class FixedTimeDelayStrategy implements DelayStrategy {
private timeBetweenAttempsInSeconds;
constructor(timeBetweenAttempsInSeconds: number);
delay(context: WaitContext): number;
}
export declare class MaxAttemptsTerminationStrategy implements TerminationStrategy {
private maxAttempts;
constructor(maxAttempts: number);
shouldTerminate(context: WaitContext): boolean;
}
export declare class MaxTimeTerminationStrategy implements TerminationStrategy {

@@ -38,4 +52,4 @@ private maxTimeInSeconds;

export declare type WaiterConfiguration = Partial<WaiterConfigurationDetails>;
export declare function delay(second: number): Promise<unknown>;
export declare function genericTerminalConditionWaiter<Response>(config: WaiterConfiguration | undefined, serviceCall: () => Promise<Response>, terminationPredicate: (response: Response) => boolean, allow404?: boolean): Promise<Response | null>;
export declare function genericWaiter<Response>(config: WaiterConfiguration | undefined, serviceCall: () => Promise<Response>, terminationPredicate: (response: Response) => boolean): Promise<Response>;
export {};

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

}
exports.WaitContextImpl = WaitContextImpl;
class ExponentialBackoffDelayStrategy {

@@ -45,2 +46,20 @@ constructor(maxDelayInSeconds) {

exports.ExponentialBackoffDelayStrategy = ExponentialBackoffDelayStrategy;
class FixedTimeDelayStrategy {
constructor(timeBetweenAttempsInSeconds) {
this.timeBetweenAttempsInSeconds = timeBetweenAttempsInSeconds;
}
delay(context) {
return this.timeBetweenAttempsInSeconds;
}
}
exports.FixedTimeDelayStrategy = FixedTimeDelayStrategy;
class MaxAttemptsTerminationStrategy {
constructor(maxAttempts) {
this.maxAttempts = maxAttempts - 1;
}
shouldTerminate(context) {
return context.attemptCount >= this.maxAttempts;
}
}
exports.MaxAttemptsTerminationStrategy = MaxAttemptsTerminationStrategy;
class MaxTimeTerminationStrategy {

@@ -51,4 +70,4 @@ constructor(maxTimeInSeconds) {

shouldTerminate(context) {
const endTime = context.startTime;
endTime.setSeconds(endTime.getSeconds() + this.maxTimeInSeconds);
const endTime = new Date();
endTime.setTime(context.startTime.getTime() + this.maxTimeInSeconds * 1000);
return new Date() >= endTime;

@@ -67,2 +86,3 @@ }

}
exports.delay = delay;
function genericTerminalConditionWaiter(config, serviceCall, terminationPredicate, allow404 = false) {

@@ -69,0 +89,0 @@ return __awaiter(this, void 0, void 0, function* () {

{
"name": "oci-common",
"version": "1.3.0",
"version": "1.4.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

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