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

oso-cloud

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oso-cloud - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

9

CHANGELOG.md
# Changelog
## 2.2.0
- Use Fallback, if configured, for `.get`, `.getPolicyMetadata`, Query Builder, and
local check APIs if Oso Cloud returns an error (Requires Fallback 1.0.0 or later)
- Use Fallback, if configured, for supported endpoints if Oso Cloud returns an
HTTP 400 error
## 2.1.0

@@ -51,3 +58,3 @@

- feat: Add new `oso.bulkActions()` API: https://www.osohq.com/docs/reference/client-apis/node#in-bulk-osobulkactionsactor-resources
- feat: Add new `oso.bulkActions()` API: <https://www.osohq.com/docs/reference/client-apis/node#in-bulk-osobulkactionsactor-resources>

@@ -54,0 +61,0 @@ ## 1.0.3

2

dist/package.json
{
"name": "oso-cloud",
"version": "2.1.0",
"version": "2.2.0",
"description": "Oso Cloud Node.js Client SDK",

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

@@ -148,3 +148,4 @@ /// <reference types="node" />

constructor(url: string, apiKey: string, options: ClientOptions);
fallbackEligible(path: string): boolean | "" | undefined;
fallbackEligible(method: string, path: string): boolean | "" | undefined;
fallbackEligibleStatusCode(statusCode: number): boolean;
printDebugInfo(msg: string): Promise<void>;

@@ -151,0 +152,0 @@ private printRequestTimingInfo;

@@ -25,4 +25,4 @@ "use strict";

const retryOptions = {
retries: 5,
retryOn: [429, 500, 501, 502, 503, 504],
retries: 2,
retryOn: [400, 429, 500, 501, 502, 503, 504],
retryDelay: function (attempt, _error, _response) {

@@ -80,7 +80,32 @@ return Math.pow(2, attempt) * 10;

}
fallbackEligible(path) {
return (this.fallbackAgent &&
this.fallbackUrl &&
["/authorize", "/list", "/actions", "/evaluate_query"].includes(path));
fallbackEligible(method, path) {
let eligiblePath = false;
switch (method.toLowerCase()) {
case "post": {
eligiblePath = [
"/authorize",
"/list",
"/actions",
// distributed check api's
"/actions_query",
"/authorize_query",
"/list_query",
"/evaluate_query_local",
// query builder api's
"/evaluate_query",
].includes(path);
break;
}
case "get": {
eligiblePath = ["/facts", "/policy_metadata"].includes(path);
break;
}
}
return this.fallbackAgent && this.fallbackUrl && eligiblePath;
}
fallbackEligibleStatusCode(statusCode) {
// HTTP400 and HTTP5xx indicates errors experienced by the server in
// handling the request, so these should be retried against fallback
return statusCode == 400 || statusCode >= 500;
}
printDebugInfo(msg) {

@@ -146,3 +171,3 @@ return __awaiter(this, void 0, void 0, function* () {

if (["ECONNREFUSED", "ETIMEDOUT"].includes(e.code) &&
this.fallbackEligible(path)) {
this.fallbackEligible(method, path)) {
let url = `${this.fallbackUrl}/api${path}`;

@@ -157,3 +182,4 @@ request.agent = this.fallbackAgent;

this.printRequestTimingInfo(result, startTime, path);
if (result.status >= 500 && this.fallbackEligible(path)) {
if (this.fallbackEligibleStatusCode(result.status) &&
this.fallbackEligible(method, path)) {
const fallbackStartTime = Date.now();

@@ -160,0 +186,0 @@ let url = `${this.fallbackUrl}/api${path}`;

{
"name": "oso-cloud",
"version": "2.1.0",
"version": "2.2.0",
"description": "Oso Cloud Node.js Client SDK",

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

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