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

@mcma/client

Package Overview
Dependencies
Maintainers
3
Versions
109
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.4.2 to 0.4.3

lib/auth-provider.js

22

index.d.ts

@@ -11,4 +11,7 @@ import { AxiosRequestConfig, AxiosPromise } from "axios";

export interface AuthenticatorProvider {
getAuthenticator(authType: string, authContext: any): Authenticator;
export type AuthenticatorFactory = (authContext?: any) => Authenticator;
export class AuthProvider {
add(authType: string, authenticatorFactory: AuthenticatorFactory): void;
get(authType: string, authContext: any): Authenticator;
}

@@ -36,3 +39,3 @@

export class ServiceClient {
constructor(service: Service, authProvider?: AuthenticatorProvider);
constructor(service: Service, authProvider?: AuthProvider);

@@ -45,3 +48,3 @@ hasResourceEndpoint(resourceType: string): boolean;

export class ResourceEndpointClient implements Http {
constructor(resourceEndpoint: ResourceEndpoint, authProvider?: AuthenticatorProvider, serviceAuthType?: string, serviceAuthContext?: any);
constructor(resourceEndpoint: ResourceEndpoint, authProvider?: AuthProvider, serviceAuthType?: string, serviceAuthContext?: any);

@@ -62,3 +65,2 @@ httpEndpoint: string;

servicesAuthContext?: any;
authProvider?: AuthenticatorProvider;
}

@@ -79,8 +81,12 @@

export type ResourceManagerProvider = (contextVariableProvider: ContextVariableProvider) => ResourceManager;
declare module "@mcma/core" {
interface ContextVariableProvider {
getResourceManagerFromContext(authProvider: AuthenticatorProvider): ResourceManager;
getResourceManagerFromContext(authProvider: AuthProvider): ResourceManager;
}
}
export class ResourceManagerProvider {
constructor(authProvider: AuthProvider, defaultConfig?: ResourceManagerConfig);
get(config: ResourceManagerConfig): ResourceManager;
}

@@ -5,3 +5,3 @@ const { HttpClient } = require("./lib/http-client");

const { ResourceManager } = require("./lib/resource-manager");
const { AuthenticatorProvider } = require("./lib/authenticator-provider");
const { AuthProvider } = require("./lib/auth-provider");
require("./lib/context-variable-provider-ext");

@@ -14,3 +14,4 @@

ResourceManager,
AuthenticatorProvider
ResourceManagerProvider,
AuthProvider
};
const { ContextVariableProvider } = require("@mcma/core");
const { ResourceManager } = require("./resource-manager");
ContextVariableProvider.prototype.getResourceManagerFromContext = function getResourceManagerFromContext(authProvider) {
return new ResourceManager({
ContextVariableProvider.prototype.getResourceManagerConfig = function getResourceManagerConfig() {
return {
servicesUrl: this.getRequiredContextVariable("ServicesUrl"),
servicesAuthType: this.getOptionalContextVariable("ServicesAuthType"),
servicesAuthContext: this.getOptionalContextVariable("ServicesAuthContext"),
authProvider
});
servicesAuthContext: this.getOptionalContextVariable("ServicesAuthContext")
};
}

@@ -7,3 +7,3 @@ const { Service, ResourceEndpoint } = require("@mcma/core");

class ResourceManager {
constructor(config) {
constructor(config, authProvider) {
const httpClient = new HttpClient();

@@ -33,3 +33,3 @@

let serviceRegistryClient = new ServiceClient(serviceRegistry, config.authProvider);
let serviceRegistryClient = new ServiceClient(serviceRegistry, authProvider);

@@ -44,3 +44,3 @@ serviceClients.push(serviceRegistryClient);

try {
serviceClients.push(new ServiceClient(new Service(service), config.authProvider));
serviceClients.push(new ServiceClient(new Service(service), authProvider));
} catch (error) {

@@ -223,4 +223,17 @@ console.warn("Failed to instantiate json " + JSON.stringify(service) + " as a Service due to error " + error.message);

class ResourceManagerProvider {
constructor(authProvider, defaultConfig) {
this.get = (config) => {
config = config || defaultConfig;
if (!config) {
throw new Error("Config for resource manager not provided, and there is no default config available");
}
return new ResourceManager(config, authProvider);
};
}
}
module.exports = {
ResourceManager
ResourceManager,
ResourceManagerProvider
};
{
"name": "@mcma/client",
"version": "0.4.2",
"version": "0.4.3",
"description": "Node module with classes and functions used to access services in an MCMA environment",

@@ -27,3 +27,3 @@ "engines": {

"axios": "^0.18.0",
"@mcma/core": "0.4.2"
"@mcma/core": "0.4.3"
},

@@ -30,0 +30,0 @@ "devDependencies": {

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