@memberjunction/react-runtime
Version:
Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.
54 lines • 2.51 kB
TypeScript
import { ComponentSpec, ComponentObject } from '@memberjunction/interactive-component-types';
import { ComponentCompiler } from '../compiler';
import { RuntimeContext } from '../types';
import { ComponentDependencyInfo, DependencyTree } from './registry-provider';
import { UserInfo } from '@memberjunction/core';
export interface IComponentRegistryClient {
GetRegistryComponent(params: {
registryName: string;
namespace: string;
name: string;
version?: string;
hash?: string;
}): Promise<ComponentSpec | null>;
}
export declare class ComponentRegistryService {
private static instance;
private compiledComponentCache;
private componentReferences;
private compiler;
private runtimeContext;
private componentEngine;
private registryProviders;
private debug;
private graphQLClient?;
private constructor();
static getInstance(compiler: ComponentCompiler, context: RuntimeContext, debug?: boolean, graphQLClient?: IComponentRegistryClient): ComponentRegistryService;
setGraphQLClient(client: IComponentRegistryClient): void;
private cachedProviderClient;
private getGraphQLClient;
initialize(contextUser?: UserInfo): Promise<void>;
private calculateSpecHash;
getCompiledComponent(componentId: string, referenceId?: string, contextUser?: UserInfo): Promise<ComponentObject>;
getCompiledComponentFromRegistry(registryName: string, namespace: string, name: string, version: string, referenceId?: string, contextUser?: UserInfo): Promise<any>;
getComponentSpec(componentId: string, contextUser?: UserInfo): Promise<ComponentSpec>;
private fetchFromExternalRegistry;
private cacheExternalComponent;
loadDependencies(componentId: string, contextUser?: UserInfo): Promise<ComponentDependencyInfo[]>;
resolveDependencyTree(componentId: string, contextUser?: UserInfo, visited?: Set<string>): Promise<DependencyTree>;
getComponentsToLoad(rootComponentId: string, contextUser?: UserInfo): Promise<string[]>;
private addComponentReference;
removeComponentReference(componentKey: string, referenceId: string): void;
private considerCacheEviction;
private getRegistryApiKey;
getCacheStats(): {
compiledComponents: number;
totalUseCount: number;
memoryEstimate: string;
};
clearCache(): void;
forceClearAll(): void;
static reset(): void;
private getComponentKey;
}
//# sourceMappingURL=component-registry-service.d.ts.map