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

@mcma/client

Package Overview
Dependencies
Maintainers
3
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcma/client - npm Package Compare versions

Comparing version 0.15.0 to 0.16.0

3

dist/lib/auth/access-tokens/access-token-authenticator.js

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

class AccessTokenAuthenticator {
tokenProvider;
authContext;
accessToken;
constructor(tokenProvider, authContext) {

@@ -8,0 +11,0 @@ this.tokenProvider = tokenProvider;

6

dist/lib/auth/auth-provider.js

@@ -6,5 +6,3 @@ "use strict";

class AuthProvider {
constructor() {
this.registeredAuthTypes = {};
}
registeredAuthTypes = {};
add(authTypeOrRegistration, authenticator) {

@@ -16,3 +14,3 @@ let authType;

}
if (typeof (authenticator === null || authenticator === void 0 ? void 0 : authenticator.sign) !== "function") {
if (typeof authenticator?.sign !== "function") {
throw new core_1.McmaException("authenticator must have a sign function.");

@@ -19,0 +17,0 @@ }

@@ -5,3 +5,3 @@ import { AxiosResponse, AxiosRequestConfig } from "axios";

import { HttpRequestConfig } from "./http-request-config";
export declare type HttpClientConfig = {
export type HttpClientConfig = {
maxAttempts?: number;

@@ -8,0 +8,0 @@ retryInterval?: number;

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

class HttpClient {
authenticator;
config;
client;
constructor(authenticator, config) {

@@ -55,3 +58,3 @@ this.authenticator = authenticator;

}
if (!url && (body === null || body === void 0 ? void 0 : body.id)) {
if (!url && body?.id) {
url = body.id;

@@ -77,3 +80,2 @@ }

async request(config) {
var _a, _b, _c;
if (!config) {

@@ -129,3 +131,3 @@ throw new core_1.McmaException("HttpClient: Missing configuration for making HTTP request");

// retrying 404 errors as well as 5xx errors. 404 errors can be caused by eventual consistency issues as a resource might be created but not yet available.
if ((((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 404 || ((_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status) >= 500) && attempts < this.config.maxAttempts - 1) {
if ((error?.response?.status === 404 || error?.response?.status >= 500) && attempts < this.config.maxAttempts - 1) {
await core_1.Utils.sleep(this.config.retryInterval);

@@ -135,6 +137,6 @@ }

let response;
if ((_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) {
if (error?.response?.data) {
response = error.response.data;
}
else if (error === null || error === void 0 ? void 0 : error.response) {
else if (error?.response) {
response = error.response;

@@ -141,0 +143,0 @@ }

@@ -7,2 +7,7 @@ "use strict";

class ResourceEndpointClient {
resourceEndpoint;
authProvider;
httpClientConfig;
serviceAuthType;
_httpClient;
constructor(resourceEndpoint, authProvider, httpClientConfig, serviceAuthType) {

@@ -40,3 +45,3 @@ this.resourceEndpoint = resourceEndpoint;

}
if (!url && (body === null || body === void 0 ? void 0 : body.id)) {
if (!url && body?.id) {
url = body.id;

@@ -43,0 +48,0 @@ }

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

class ResourceManagerProvider {
authProvider;
defaultConfig;
constructor(authProvider, defaultConfig) {

@@ -14,3 +16,3 @@ this.authProvider = authProvider;

get(config) {
config = config !== null && config !== void 0 ? config : this.defaultConfig;
config = config ?? this.defaultConfig;
if (!config) {

@@ -17,0 +19,0 @@ config = core_1.ConfigVariables.getInstance();

@@ -13,6 +13,9 @@ "use strict";

class ResourceManager {
config;
authProvider;
httpClient;
serviceClients = [];
constructor(config, authProvider) {
this.config = config;
this.authProvider = authProvider;
this.serviceClients = [];
if (!config.serviceRegistryUrl) {

@@ -189,6 +192,5 @@ throw new core_1.McmaException("Missing property 'serviceRegistryUrl' in ResourceManager config");

async sendNotification(resource) {
var _a;
if (resource.notificationEndpoint) {
try {
let http = (_a = await this.getResourceEndpointClient(resource.notificationEndpoint.httpEndpoint)) !== null && _a !== void 0 ? _a : this.httpClient;
let http = await this.getResourceEndpointClient(resource.notificationEndpoint.httpEndpoint) ?? this.httpClient;
let notification = new core_1.Notification({

@@ -195,0 +197,0 @@ source: resource.id,

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

class ServiceClient {
endpointsMap = {};
constructor(service, authProvider, httpClientConfig) {
this.endpointsMap = {};
for (const resourceEndpoint of service.resources) {

@@ -10,0 +10,0 @@ this.endpointsMap[resourceEndpoint.resourceType] =

{
"name": "@mcma/client",
"version": "0.15.0",
"version": "0.16.0",
"description": "Node module with classes and functions used to access services in an MCMA environment",
"engines": {
"node": "^16.0.0"
"node": "^18.0.0"
},

@@ -35,9 +35,9 @@ "type": "commonjs",

"peerDependencies": {
"@mcma/core": "0.15.0"
"@mcma/core": "0.16.0"
},
"devDependencies": {
"@mcma/core": "0.15.0",
"@types/node": "^16.11.60",
"@mcma/core": "0.16.0",
"@types/node": "^18.15.10",
"jasmine": "^3.3.1"
}
}
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