@memberjunction/react-runtime 2.93.0 โ†’ 2.94.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +180 -2
  4. package/dist/compiler/component-compiler.d.ts.map +1 -1
  5. package/dist/compiler/component-compiler.js +206 -57
  6. package/dist/compiler/component-compiler.js.map +1 -1
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +13 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/registry/component-registry-service.d.ts +4 -3
  12. package/dist/registry/component-registry-service.d.ts.map +1 -1
  13. package/dist/registry/component-registry-service.js +27 -11
  14. package/dist/registry/component-registry-service.js.map +1 -1
  15. package/dist/registry/component-registry.d.ts +4 -3
  16. package/dist/registry/component-registry.d.ts.map +1 -1
  17. package/dist/registry/component-registry.js.map +1 -1
  18. package/dist/registry/component-resolver.d.ts +2 -1
  19. package/dist/registry/component-resolver.d.ts.map +1 -1
  20. package/dist/registry/component-resolver.js +42 -10
  21. package/dist/registry/component-resolver.js.map +1 -1
  22. package/dist/runtime/component-hierarchy.d.ts.map +1 -1
  23. package/dist/runtime/component-hierarchy.js +8 -2
  24. package/dist/runtime/component-hierarchy.js.map +1 -1
  25. package/dist/runtime/prop-builder.d.ts +2 -2
  26. package/dist/runtime/prop-builder.d.ts.map +1 -1
  27. package/dist/runtime/prop-builder.js +32 -14
  28. package/dist/runtime/prop-builder.js.map +1 -1
  29. package/dist/runtime.umd.js +1 -1
  30. package/dist/types/dependency-types.d.ts +62 -0
  31. package/dist/types/dependency-types.d.ts.map +1 -0
  32. package/dist/types/dependency-types.js +3 -0
  33. package/dist/types/dependency-types.js.map +1 -0
  34. package/dist/types/index.d.ts +8 -10
  35. package/dist/types/index.d.ts.map +1 -1
  36. package/dist/types/index.js +1 -0
  37. package/dist/types/index.js.map +1 -1
  38. package/dist/utilities/index.d.ts +1 -0
  39. package/dist/utilities/index.d.ts.map +1 -1
  40. package/dist/utilities/index.js +1 -0
  41. package/dist/utilities/index.js.map +1 -1
  42. package/dist/utilities/library-dependency-resolver.d.ts +19 -0
  43. package/dist/utilities/library-dependency-resolver.d.ts.map +1 -0
  44. package/dist/utilities/library-dependency-resolver.js +410 -0
  45. package/dist/utilities/library-dependency-resolver.js.map +1 -0
  46. package/dist/utilities/library-loader.d.ts +9 -0
  47. package/dist/utilities/library-loader.d.ts.map +1 -1
  48. package/dist/utilities/library-loader.js +143 -0
  49. package/dist/utilities/library-loader.js.map +1 -1
  50. package/package.json +5 -5
  51. package/src/compiler/component-compiler.ts +227 -77
  52. package/src/index.ts +18 -4
  53. package/src/registry/component-registry-service.ts +32 -14
  54. package/src/registry/component-registry.ts +8 -7
  55. package/src/registry/component-resolver.ts +51 -10
  56. package/src/runtime/component-hierarchy.ts +12 -4
  57. package/src/runtime/prop-builder.ts +38 -18
  58. package/src/types/dependency-types.ts +110 -0
  59. package/src/types/index.ts +17 -21
  60. package/src/utilities/index.ts +1 -0
  61. package/src/utilities/library-dependency-resolver.ts +603 -0
  62. package/src/utilities/library-loader.ts +252 -0
@@ -1 +1 @@
1
- {"version":3,"file":"component-compiler.js","sourceRoot":"","sources":["../../src/compiler/component-compiler.ts"],"names":[],"mappings":";;;AAeA,oEAAgE;AAMhE,MAAM,uBAAuB,GAAmB;IAC9C,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,OAAO,CAAC;QAClB,OAAO,EAAE,EAAE;KACZ;IACD,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;IACjB,KAAK,EAAE,IAAI;IACX,YAAY,EAAE,GAAG;CAClB,CAAC;AAMF,MAAa,iBAAiB;IAU5B,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE,CAAC;QACxD,IAAI,CAAC,gBAAgB,G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,KAAU,EAAE,aAAqB;QAC9D,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,2BAA2B;YACrD,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,aAAa;YACb,KAAK,EAAE,aAAa;YACpB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAKD,UAAU;QACR,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IAMD,YAAY;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;IACpC,CAAC;IAMD,YAAY,CAAC,MAA+B;QAC1C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9C,CAAC;CACF;AAxmBD,8CAwmBC","sourcesContent":["/**\n * @fileoverview Platform-agnostic React component compiler.\n * Compiles React component source code into executable components using Babel.\n * @module @memberjunction/react-runtime/compiler\n */\n\nimport { UserInfo } from '@memberjunction/core';\nimport { \n CompileOptions, \n CompiledComponent, \n CompilationResult,\n CompilerConfig,\n ComponentError,\n RuntimeContext\n} from '../types';\nimport { LibraryRegistry } from '../utilities/library-registry';\nimport { ComponentLibraryEntity } from '@memberjunction/core-entities';\n\n/**\n * Default compiler configuration\n */\nconst DEFAULT_COMPILER_CONFIG: CompilerConfig = {\n babel: {\n presets: ['react'],\n plugins: []\n },\n minify: false,\n sourceMaps: false,\n cache: true,\n maxCacheSize: 100\n};\n\n/**\n * Platform-agnostic React component compiler.\n * Transforms JSX/React component source code into executable JavaScript.\n */\nexport class ComponentCompiler {\n private config: CompilerConfig;\n private compilationCache: Map<string, CompiledComponent>;\n private cacheAccessOrder: string[]; // Track access order for LRU\n private babelInstance: any;\n\n /**\n * Creates a new ComponentCompiler instance\n * @param config - Optional compiler configuration\n */\n constructor(config?: Partial<CompilerConfig>) {\n this.config = { ...DEFAULT_COMPILER_CONFIG, ...config };\n this.compilationCache = new Map();\n }\n\n /**\n * Sets the Babel instance to use for compilation\n * @param babel - The Babel standalone instance\n */\n setBabelInstance(babel: any): void {\n this.babelInstance = babel;\n }\n\n /**\n * Compiles a React component from source code\n * @param options - Compilation options\n * @returns Promise resolving to compilation result\n */\n async compile(options: CompileOptions): Promise<CompilationResult> {\n const startTime = Date.now();\n\n try {\n // Check cache first if enabled\n if (this.config.cache) {\n const cached = this.getCachedComponent(options.componentName, options.componentCode);\n if (cached) {\n return {\n success: true,\n component: cached,\n duration: Date.now() - startTime\n };\n }\n }\n\n // Validate inputs\n this.validateCompileOptions(options);\n\n // Load required libraries if specified\n const loadedLibraries = await this.loadRequiredLibraries(options.libraries!, options.allLibraries);\n\n // Transpile the component code\n const transpiledCode = this.transpileComponent(\n options.componentCode,\n options.componentName,\n options\n );\n\n // Create the component factory with loaded libraries\n const componentFactory = this.createComponentFactory(\n transpiledCode,\n options.componentName,\n loadedLibraries\n );\n\n // Build the compiled component\n const compiledComponent: CompiledComponent = {\n component: componentFactory,\n id: this.generateComponentId(options.componentName),\n name: options.componentName,\n compiledAt: new Date(),\n warnings: []\n };\n\n // Cache if enabled\n if (this.config.cache) {\n this.cacheComponent(compiledComponent, options.componentCode);\n }\n\n return {\n success: true,\n component: compiledComponent,\n duration: Date.now() - startTime,\n size: transpiledCode.length\n };\n\n } catch (error) {\n return {\n success: false,\n error: this.createCompilationError(error, options.componentName),\n duration: Date.now() - startTime\n };\n }\n }\n\n /**\n * Transpiles JSX/React code to JavaScript\n * @param code - Source code to transpile\n * @param componentName - Name of the component\n * @param options - Compilation options\n * @returns Transpiled JavaScript code\n */\n private transpileComponent(\n code: string,\n componentName: string,\n options: CompileOptions\n ): string {\n if (!this.babelInstance) {\n throw new Error('Babel instance not set. Call setBabelInstance() first.');\n }\n\n const wrappedCode = this.wrapComponentCode(code, componentName, options.libraries, options.dependencies);\n\n try {\n const result = this.babelInstance.transform(wrappedCode, {\n presets: options.babelPresets || this.config.babel.presets,\n plugins: options.babelPlugins || this.config.babel.plugins,\n filename: `${componentName}.jsx`,\n sourceMaps: this.config.sourceMaps,\n minified: this.config.minify\n });\n\n return result.code;\n } catch (error: any) {\n throw new Error(`Transpilation failed: ${error.message}`);\n }\n }\n\n /**\n * Wraps component code in a factory function for execution\n * @param componentCode - Raw component code\n * @param componentName - Name of the component\n * @param libraries - Optional library dependencies\n * @param dependencies - Optional child component dependencies\n * @returns Wrapped component code\n */\n private wrapComponentCode(componentCode: string, componentName: string, libraries?: any[], dependencies?: Array<{ name: string }>): string {\n // Generate library declarations if libraries are provided\n const libraryDeclarations = libraries && libraries.length > 0\n ? libraries\n .filter(lib => lib.globalVariable) // Only include libraries with globalVariable\n .map(lib => `const ${lib.globalVariable} = libraries['${lib.globalVariable}'];`)\n .join('\\n ')\n : '';\n \n // Generate component declarations if dependencies are provided\n const componentDeclarations = dependencies && dependencies.length > 0\n ? dependencies\n .map(dep => `const ${dep.name} = components['${dep.name}'];`)\n .join('\\n ')\n : '';\n\n return `\n function createComponent(\n React, ReactDOM, \n useState, useEffect, useCallback, useMemo, useRef, useContext, useReducer, useLayoutEffect,\n libraries, styles, console, components\n ) {\n ${libraryDeclarations ? libraryDeclarations + '\\n ' : ''}${componentDeclarations ? componentDeclarations + '\\n ' : ''}${componentCode}\n \n // Ensure the component exists\n if (typeof ${componentName} === 'undefined') {\n throw new Error('Component \"${componentName}\" is not defined in the provided code');\n }\n \n // Return the component with utilities\n return {\n component: ${componentName},\n print: function() { \n if (typeof window !== 'undefined' && window.print) {\n window.print(); \n }\n },\n refresh: function(data) { \n // Refresh functionality is handled by the host environment\n }\n };\n }\n `;\n }\n\n /**\n * Load required libraries from the registry\n * @param libraries - Array of library dependencies\n * @param contextUser - Context user for accessing library registry\n * @returns Map of loaded libraries\n */\n private async loadRequiredLibraries(libraries: any[], componentLibraries: ComponentLibraryEntity[]): Promise<Map<string, any>> {\n const loadedLibraries = new Map<string, any>();\n \n console.log('๐Ÿ” loadRequiredLibraries called with:', {\n librariesCount: libraries?.length || 0,\n libraries: libraries?.map(l => ({ name: l.name, version: l.version, globalVariable: l.globalVariable }))\n });\n \n if (!libraries || libraries.length === 0) {\n console.log('๐Ÿ“š No libraries to load, returning empty map');\n return loadedLibraries;\n }\n\n // Only works in browser environment\n if (typeof window === 'undefined') {\n console.warn('Library loading is only supported in browser environments');\n return loadedLibraries;\n }\n\n // Initialize LibraryRegistry with componentLibraries if provided\n if (componentLibraries) {\n await LibraryRegistry.Config(false, componentLibraries);\n } else {\n console.warn('โš ๏ธ No componentLibraries provided for LibraryRegistry initialization');\n }\n\n const loadPromises = libraries.map(async (lib) => {\n console.log(`๐Ÿ“ฆ Processing library: ${lib.name}`);\n \n // Check if library is approved\n const isApproved = LibraryRegistry.isApproved(lib.name);\n console.log(` โœ“ Approved check for ${lib.name}: ${isApproved}`);\n \n if (!isApproved) {\n console.error(` โŒ Library '${lib.name}' is not approved`);\n throw new Error(`Library '${lib.name}' is not approved. Only approved libraries can be used.`);\n }\n\n // Get library definition for complete info\n const libraryDef = LibraryRegistry.getLibrary(lib.name);\n console.log(` โœ“ Library definition found for ${lib.name}: ${!!libraryDef}`);\n \n if (!libraryDef) {\n console.error(` โŒ Library '${lib.name}' not found in registry`);\n throw new Error(`Library '${lib.name}' not found in registry`);\n }\n\n // Get CDN URL for the library\n const resolvedVersion = LibraryRegistry.resolveVersion(lib.name, lib.version);\n console.log(` โœ“ Resolved version for ${lib.name}: ${resolvedVersion}`);\n \n const cdnUrl = LibraryRegistry.getCdnUrl(lib.name, resolvedVersion);\n console.log(` โœ“ CDN URL for ${lib.name}: ${cdnUrl}`);\n \n if (!cdnUrl) {\n console.error(` โŒ No CDN URL found for library '${lib.name}' version '${lib.version || 'default'}'`);\n throw new Error(`No CDN URL found for library '${lib.name}' version '${lib.version || 'default'}'`);\n }\n\n // Check if already loaded\n if ((window as any)[lib.globalVariable]) {\n console.log(` โ„น๏ธ Library ${lib.name} already loaded globally as ${lib.globalVariable}`);\n loadedLibraries.set(lib.globalVariable, (window as any)[lib.globalVariable]);\n return;\n }\n\n // Load CSS files if the library requires them\n const versionInfo = libraryDef.versions[resolvedVersion || libraryDef.defaultVersion];\n if (versionInfo?.cssUrls) {\n await this.loadStyles(versionInfo.cssUrls);\n }\n\n // Load the library dynamically (cdnUrl is guaranteed to be non-null here due to check above)\n console.log(` ๐Ÿ“ฅ Loading script from CDN for ${lib.name}...`);\n await this.loadScript(cdnUrl!, lib.globalVariable);\n \n // Capture the library value from global scope\n // Note: Libraries loaded from CDN typically attach to window automatically\n // We capture them here to pass through the component's closure\n const libraryValue = (window as any)[lib.globalVariable];\n console.log(` โœ“ Library ${lib.name} loaded successfully, global variable ${lib.globalVariable} is:`, typeof libraryValue);\n \n if (libraryValue) {\n loadedLibraries.set(lib.globalVariable, libraryValue);\n console.log(` โœ… Added ${lib.name} to loaded libraries map`);\n } else {\n console.error(` โŒ Library '${lib.name}' failed to expose global variable '${lib.globalVariable}'`);\n throw new Error(`Library '${lib.name}' failed to load or did not expose '${lib.globalVariable}'`);\n }\n });\n\n await Promise.all(loadPromises);\n \n console.log(`โœ… All libraries loaded successfully. Total: ${loadedLibraries.size}`);\n console.log('๐Ÿ“š Loaded libraries map:', Array.from(loadedLibraries.keys()));\n \n return loadedLibraries;\n }\n\n /**\n * Load CSS stylesheets dynamically\n * @param urls - Array of CSS URLs to load\n * @returns Promise that resolves when all stylesheets are loaded\n */\n private async loadStyles(urls: string[]): Promise<void> {\n const loadPromises = urls.map(url => {\n return new Promise<void>((resolve) => {\n // Check if stylesheet already exists\n const existingLink = document.querySelector(`link[href=\"${url}\"]`);\n if (existingLink) {\n resolve();\n return;\n }\n\n // Create new link element\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = url;\n \n // CSS load events are not reliable cross-browser, so resolve immediately\n // The CSS will load asynchronously but won't block component rendering\n document.head.appendChild(link);\n resolve();\n });\n });\n\n await Promise.all(loadPromises);\n }\n\n /**\n * Load a script dynamically\n * @param url - Script URL\n * @param globalName - Expected global variable name\n * @returns Promise that resolves when script is loaded\n */\n private loadScript(url: string, globalName: string): Promise<void> {\n return new Promise((resolve, reject) => {\n // Check if script already exists\n const existingScript = document.querySelector(`script[src=\"${url}\"]`);\n if (existingScript) {\n // Wait for it to finish loading with exponential backoff\n let attempts = 0;\n const maxAttempts = 50; // 5 seconds total with 100ms intervals\n const checkLoaded = () => {\n if ((window as any)[globalName]) {\n resolve();\n } else if (attempts >= maxAttempts) {\n reject(new Error(`${globalName} not found after ${maxAttempts * 100}ms waiting for existing script`));\n } else {\n attempts++;\n setTimeout(checkLoaded, 100);\n }\n };\n checkLoaded();\n return;\n }\n\n // Create new script element\n const script = document.createElement('script');\n script.src = url;\n script.async = true;\n \n script.onload = () => {\n // More robust checking with multiple attempts\n let attempts = 0;\n const maxAttempts = 20; // 2 seconds total\n const checkInterval = 100; // Check every 100ms\n \n const checkGlobal = () => {\n if ((window as any)[globalName]) {\n console.log(` โœ“ Global variable ${globalName} found after ${attempts * checkInterval}ms`);\n resolve();\n } else if (attempts >= maxAttempts) {\n // Final check - some libraries might use a different global name pattern\n console.error(` โŒ ${globalName} not found after ${attempts * checkInterval}ms`);\n console.log(` โ„น๏ธ Window properties:`, Object.keys(window).filter(k => k.toLowerCase().includes(globalName.toLowerCase())));\n reject(new Error(`${globalName} not found after loading script from ${url}`));\n } else {\n attempts++;\n setTimeout(checkGlobal, checkInterval);\n }\n };\n \n // Start checking immediately (don't wait 100ms first)\n checkGlobal();\n };\n \n script.onerror = () => {\n reject(new Error(`Failed to load script: ${url}`));\n };\n \n document.head.appendChild(script);\n });\n }\n\n /**\n * Creates a component factory function from transpiled code\n * @param transpiledCode - Transpiled JavaScript code\n * @param componentName - Name of the component\n * @param loadedLibraries - Map of loaded libraries\n * @returns Component factory function\n */\n private createComponentFactory(\n transpiledCode: string, \n componentName: string,\n loadedLibraries: Map<string, any>\n ): Function {\n try {\n // Create the factory function with all React hooks\n const factoryCreator = new Function(\n 'React', 'ReactDOM',\n 'useState', 'useEffect', 'useCallback', 'useMemo', 'useRef', 'useContext', 'useReducer', 'useLayoutEffect',\n 'libraries', 'styles', 'console', 'components',\n `${transpiledCode}; return createComponent;`\n );\n\n // Return a function that executes the factory with runtime context\n return (context: RuntimeContext, styles: any = {}, components: Record<string, any> = {}) => {\n const { React, ReactDOM, libraries = {} } = context;\n \n // Merge loaded libraries with context libraries\n const mergedLibraries = { ...libraries };\n loadedLibraries.forEach((value, key) => {\n mergedLibraries[key] = value;\n });\n\n // Execute the factory creator to get the createComponent function\n const createComponentFn = factoryCreator(\n React,\n ReactDOM,\n React.useState,\n React.useEffect,\n React.useCallback,\n React.useMemo,\n React.useRef,\n React.useContext,\n React.useReducer,\n React.useLayoutEffect,\n mergedLibraries,\n styles,\n console,\n components\n );\n\n // Call createComponent to get the actual component\n const Component = createComponentFn(\n React,\n ReactDOM,\n React.useState,\n React.useEffect,\n React.useCallback,\n React.useMemo,\n React.useRef,\n React.useContext,\n React.useReducer,\n React.useLayoutEffect,\n mergedLibraries,\n styles,\n console,\n components\n );\n\n // Return the component directly\n return Component;\n };\n } catch (error: any) {\n throw new Error(`Failed to create component factory: ${error.message}`);\n }\n }\n\n\n /**\n * Validates compilation options\n * @param options - Options to validate\n * @throws Error if validation fails\n */\n private validateCompileOptions(options: CompileOptions): void {\n // Check if options object exists\n if (!options) {\n throw new Error(\n 'Component compilation failed: No options provided.\\n' +\n 'Expected an object with componentName and componentCode properties.\\n' +\n 'Example: { componentName: \"MyComponent\", componentCode: \"function MyComponent() { ... }\" }'\n );\n }\n\n // Check component name\n if (!options.componentName) {\n const providedKeys = Object.keys(options).join(', ');\n throw new Error(\n 'Component compilation failed: Component name is required.\\n' +\n `Received options with keys: [${providedKeys}]\\n` +\n 'Please ensure your component spec includes a \"name\" property.\\n' +\n 'Example: { name: \"MyComponent\", code: \"...\" }'\n );\n }\n\n // Check component code\n if (!options.componentCode) {\n throw new Error(\n `Component compilation failed: Component code is required for \"${options.componentName}\".\\n` +\n 'Please ensure your component spec includes a \"code\" property with the component source code.\\n' +\n 'Example: { name: \"MyComponent\", code: \"function MyComponent() { return <div>Hello</div>; }\" }'\n );\n }\n\n // Check code type\n if (typeof options.componentCode !== 'string') {\n const actualType = typeof options.componentCode;\n throw new Error(\n `Component compilation failed: Component code must be a string for \"${options.componentName}\".\\n` +\n `Received type: ${actualType}\\n` +\n `Received value: ${JSON.stringify(options.componentCode).substring(0, 100)}...\\n` +\n 'Please ensure the code property contains a string of JavaScript/JSX code.'\n );\n }\n\n // Check if code is empty or whitespace only\n if (options.componentCode.trim().length === 0) {\n throw new Error(\n `Component compilation failed: Component code is empty for \"${options.componentName}\".\\n` +\n 'The code property must contain valid JavaScript/JSX code defining a React component.'\n );\n }\n\n // Basic syntax check\n if (!options.componentCode.includes(options.componentName)) {\n throw new Error(\n `Component compilation failed: Component code must define a component named \"${options.componentName}\".\\n` +\n 'The function/component name in the code must match the componentName property.\\n' +\n `Expected to find: function ${options.componentName}(...) or const ${options.componentName} = ...\\n` +\n 'Code preview: ' + options.componentCode.substring(0, 200) + '...'\n );\n }\n }\n\n /**\n * Generates a unique component ID\n * @param componentName - Name of the component\n * @returns Unique component ID\n */\n private generateComponentId(componentName: string): string {\n return `${componentName}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n }\n\n /**\n * Gets a cached component if available\n * @param componentName - Name of the component\n * @param code - Component source code\n * @returns Cached component or undefined\n */\n private getCachedComponent(componentName: string, code: string): CompiledComponent | undefined {\n // Create cache key based on name AND content hash\n const cacheKey = this.createCacheKey(componentName, code);\n return this.compilationCache.get(cacheKey);\n }\n\n /**\n * Creates a cache key based on component name and code content\n * @param componentName - Name of the component\n * @param code - Component source code\n * @returns Cache key\n */\n private createCacheKey(componentName: string, code: string): string {\n // Simple hash function for code content\n let hash = 0;\n for (let i = 0; i < code.length; i++) {\n const char = code.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32-bit integer\n }\n return `${componentName}_${hash.toString(36)}`;\n }\n\n /**\n * Caches a compiled component\n * @param component - Component to cache\n * @param code - Original source code\n */\n private cacheComponent(component: CompiledComponent, code: string): void {\n // Enforce cache size limit\n if (this.compilationCache.size >= this.config.maxCacheSize) {\n // Remove oldest entry (first in map)\n const firstKey = this.compilationCache.keys().next().value;\n if (firstKey)\n this.compilationCache.delete(firstKey);\n }\n\n const cacheKey = this.createCacheKey(component.name, code);\n this.compilationCache.set(cacheKey, component);\n }\n\n /**\n * Creates a standardized compilation error\n * @param error - Original error\n * @param componentName - Name of the component\n * @returns Formatted component error\n */\n private createCompilationError(error: any, componentName: string): ComponentError {\n return {\n message: error.message || 'Unknown compilation error',\n stack: error.stack,\n componentName,\n phase: 'compilation',\n details: error\n };\n }\n\n /**\n * Clears the compilation cache\n */\n clearCache(): void {\n this.compilationCache.clear();\n }\n\n /**\n * Gets current cache size\n * @returns Number of cached components\n */\n getCacheSize(): number {\n return this.compilationCache.size;\n }\n\n /**\n * Updates compiler configuration\n * @param config - New configuration options\n */\n updateConfig(config: Partial<CompilerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n}"]}
1
+ {"version":3,"file":"component-compiler.js","sourceRoot":"","sources":["../../src/compiler/component-compiler.ts"],"names":[],"mappings":";;;AAgBA,oEAAgE;AAChE,gEAA4D;AAM5D,MAAM,uBAAuB,GAAmB;IAC9C,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,OAAO,CAAC;QAClB,OAAO,EAAE,EAAE;KACZ;IACD,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;IACjB,KAAK,EAAE,IAAI;IACX,YAAY,EAAE,GAAG;IACjB,KAAK,EAAE,KAAK;CACb,CAAC;AAMF,MAAa,iBAAiB;IAU5B,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE,CAAC;QACxD,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;IACpC,CAAC;IAMD,gBAAgB,CAAC,KAAU;QACzB,IAA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;IAOO,cAAc,CAAC,SAA4B,EAAE,IAAY;QAE/D,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAE3D,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;YAC3D,IAAI,QAAQ;gBACV,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3D,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;IAQO,sBAAsB,CAAC,KAAU,EAAE,aAAqB;QAC9D,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,2BAA2B;YACrD,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,aAAa;YACb,KAAK,EAAE,aAAa;YACpB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAKD,UAAU;QACR,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IAMD,YAAY;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;IACpC,CAAC;IAMD,YAAY,CAAC,MAA+B;QAC1C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9C,CAAC;CACF;AA3vBD,8CA2vBC","sourcesContent":["/**\n * @fileoverview Platform-agnostic React component compiler.\n * Compiles React component source code into executable components using Babel.\n * @module @memberjunction/react-runtime/compiler\n */\n\nimport { UserInfo } from '@memberjunction/core';\nimport { \n CompileOptions, \n CompiledComponent, \n CompilationResult,\n CompilerConfig,\n ComponentError,\n RuntimeContext\n} from '../types';\nimport { ComponentStyles, ComponentObject } from '@memberjunction/interactive-component-types';\nimport { LibraryRegistry } from '../utilities/library-registry';\nimport { LibraryLoader } from '../utilities/library-loader';\nimport { ComponentLibraryEntity } from '@memberjunction/core-entities';\n\n/**\n * Default compiler configuration\n */\nconst DEFAULT_COMPILER_CONFIG: CompilerConfig = {\n babel: {\n presets: ['react'],\n plugins: []\n },\n minify: false,\n sourceMaps: false,\n cache: true,\n maxCacheSize: 100,\n debug: false\n};\n\n/**\n * Platform-agnostic React component compiler.\n * Transforms JSX/React component source code into executable JavaScript.\n */\nexport class ComponentCompiler {\n private config: CompilerConfig;\n private compilationCache: Map<string, CompiledComponent>;\n private cacheAccessOrder: string[]; // Track access order for LRU\n private babelInstance: any;\n\n /**\n * Creates a new ComponentCompiler instance\n * @param config - Optional compiler configuration\n */\n constructor(config?: Partial<CompilerConfig>) {\n this.config = { ...DEFAULT_COMPILER_CONFIG, ...config };\n this.compilationCache = new Map();\n }\n\n /**\n * Sets the Babel instance to use for compilation\n * @param babel - The Babel standalone instance\n */\n setBabelInstance(babel: any): void {\n this.babelInstance = babel;\n }\n\n /**\n * Compiles a React component from source code\n * @param options - Compilation options\n * @returns Promise resolving to compilation result\n */\n async compile(options: CompileOptions): Promise<CompilationResult> {\n const startTime = Date.now();\n\n try {\n // Check cache first if enabled\n if (this.config.cache) {\n const cached = this.getCachedComponent(options.componentName, options.componentCode);\n if (cached) {\n return {\n success: true,\n component: cached,\n duration: Date.now() - startTime\n };\n }\n }\n\n // Validate inputs\n this.validateCompileOptions(options);\n\n // Load required libraries if specified\n const loadedLibraries = await this.loadRequiredLibraries(options.libraries!, options.allLibraries);\n\n // Transpile the component code\n const transpiledCode = this.transpileComponent(\n options.componentCode,\n options.componentName,\n options\n );\n\n // Create the component factory with loaded libraries\n const componentFactory = this.createComponentFactory(\n transpiledCode,\n options.componentName,\n loadedLibraries\n );\n\n // Build the compiled component\n const compiledComponent: CompiledComponent = {\n factory: componentFactory,\n id: this.generateComponentId(options.componentName),\n name: options.componentName,\n compiledAt: new Date(),\n warnings: []\n };\n\n // Cache if enabled\n if (this.config.cache) {\n this.cacheComponent(compiledComponent, options.componentCode);\n }\n\n return {\n success: true,\n component: compiledComponent,\n duration: Date.now() - startTime,\n size: transpiledCode.length\n };\n\n } catch (error) {\n return {\n success: false,\n error: this.createCompilationError(error, options.componentName),\n duration: Date.now() - startTime\n };\n }\n }\n\n /**\n * Transpiles JSX/React code to JavaScript\n * @param code - Source code to transpile\n * @param componentName - Name of the component\n * @param options - Compilation options\n * @returns Transpiled JavaScript code\n */\n private transpileComponent(\n code: string,\n componentName: string,\n options: CompileOptions\n ): string {\n if (!this.babelInstance) {\n throw new Error('Babel instance not set. Call setBabelInstance() first.');\n }\n\n const wrappedCode = this.wrapComponentCode(code, componentName, options.libraries, options.dependencies);\n\n try {\n const result = this.babelInstance.transform(wrappedCode, {\n presets: options.babelPresets || this.config.babel.presets,\n plugins: options.babelPlugins || this.config.babel.plugins,\n filename: `${componentName}.jsx`,\n sourceMaps: this.config.sourceMaps,\n minified: this.config.minify\n });\n\n return result.code;\n } catch (error: any) {\n throw new Error(`Transpilation failed: ${error.message}`);\n }\n }\n\n /**\n * Wraps component code in a factory function for execution\n * @param componentCode - Raw component code\n * @param componentName - Name of the component\n * @param libraries - Optional library dependencies\n * @param dependencies - Optional child component dependencies\n * @returns Wrapped component code\n */\n private wrapComponentCode(componentCode: string, componentName: string, libraries?: any[], dependencies?: Array<{ name: string }>): string {\n // Generate library declarations if libraries are provided\n const libraryDeclarations = libraries && libraries.length > 0\n ? libraries\n .filter(lib => lib.globalVariable) // Only include libraries with globalVariable\n .map(lib => `const ${lib.globalVariable} = libraries['${lib.globalVariable}'];`)\n .join('\\n ')\n : '';\n \n // Generate component declarations if dependencies are provided\n const componentDeclarations = dependencies && dependencies.length > 0\n ? dependencies\n .map(dep => `const ${dep.name} = components['${dep.name}'];`)\n .join('\\n ')\n : '';\n\n return `\n function createComponent(\n React, ReactDOM, \n useState, useEffect, useCallback, useMemo, useRef, useContext, useReducer, useLayoutEffect,\n libraries, styles, console, components\n ) {\n // Parse the component code once to get the component definition\n ${libraryDeclarations ? libraryDeclarations + '\\n ' : ''}${componentDeclarations ? componentDeclarations + '\\n ' : ''}${componentCode}\n \n // Ensure the component exists\n if (typeof ${componentName} === 'undefined') {\n throw new Error('Component \"${componentName}\" is not defined in the provided code');\n }\n \n // Store the component in a variable so we don't lose it\n const UserComponent = ${componentName};\n \n // Debug logging to understand what we're getting\n console.log('Component ${componentName} type:', typeof UserComponent);\n if (typeof UserComponent === 'object' && UserComponent !== null) {\n console.log('Component ${componentName} keys:', Object.keys(UserComponent));\n console.log('Component ${componentName} has .component:', 'component' in UserComponent);\n if ('component' in UserComponent) {\n console.log('Component ${componentName}.component type:', typeof UserComponent.component);\n }\n }\n \n // Check if the component is already a ComponentObject (has a .component property)\n // If so, extract the actual React component\n const ActualComponent = (typeof UserComponent === 'object' && UserComponent !== null && 'component' in UserComponent)\n ? UserComponent.component\n : UserComponent;\n \n // Validate that we have a function (React component)\n if (typeof ActualComponent !== 'function') {\n console.error('Invalid component type for ${componentName}:', typeof ActualComponent);\n console.error('ActualComponent value:', ActualComponent);\n console.error('Original UserComponent value:', UserComponent);\n throw new Error('Component \"${componentName}\" must be a function (React component) or an object with a .component property that is a function. Got: ' + typeof ActualComponent);\n }\n \n // Create a fresh method registry for each factory call\n const methodRegistry = new Map();\n \n // Create a wrapper component that provides RegisterMethod in callbacks\n const ComponentWithMethodRegistry = React.forwardRef((props, ref) => {\n // Register methods on mount\n React.useEffect(() => {\n // Clear previous methods\n methodRegistry.clear();\n \n // Provide RegisterMethod callback if callbacks exist\n if (props.callbacks && typeof props.callbacks.RegisterMethod === 'function') {\n // Component can now register its methods\n // This will be called from within the component\n }\n }, [props.callbacks]);\n \n // Create enhanced callbacks with RegisterMethod\n const enhancedCallbacks = React.useMemo(() => {\n if (!props.callbacks) return {};\n \n return {\n ...props.callbacks,\n RegisterMethod: (methodName, handler) => {\n if (methodName && handler) {\n methodRegistry.set(methodName, handler);\n }\n }\n };\n }, [props.callbacks]);\n \n // Render the original component with enhanced callbacks\n return React.createElement(ActualComponent, {\n ...props,\n callbacks: enhancedCallbacks\n });\n });\n \n ComponentWithMethodRegistry.displayName = '${componentName}WithMethods';\n \n // Return the component object with method access\n return {\n component: ComponentWithMethodRegistry,\n \n // Legacy methods for backward compatibility\n print: function() { \n const printMethod = methodRegistry.get('print');\n if (printMethod) {\n printMethod();\n } else if (typeof window !== 'undefined' && window.print) {\n window.print(); \n }\n },\n refresh: function(data) { \n const refreshMethod = methodRegistry.get('refresh');\n if (refreshMethod) {\n refreshMethod(data);\n }\n // Refresh functionality is handled by the host environment\n },\n \n // Standard method accessors with type safety\n getCurrentDataState: function() {\n const method = methodRegistry.get('getCurrentDataState');\n return method ? method() : undefined;\n },\n getDataStateHistory: function() {\n const method = methodRegistry.get('getDataStateHistory');\n return method ? method() : [];\n },\n validate: function() {\n const method = methodRegistry.get('validate');\n return method ? method() : true;\n },\n isDirty: function() {\n const method = methodRegistry.get('isDirty');\n return method ? method() : false;\n },\n reset: function() {\n const method = methodRegistry.get('reset');\n if (method) method();\n },\n scrollTo: function(target) {\n const method = methodRegistry.get('scrollTo');\n if (method) method(target);\n },\n focus: function(target) {\n const method = methodRegistry.get('focus');\n if (method) method(target);\n },\n \n // Generic method invoker for custom methods\n invokeMethod: function(methodName, ...args) {\n const method = methodRegistry.get(methodName);\n if (method) {\n return method(...args);\n }\n console.warn(\\`Method '\\${methodName}' is not registered on component ${componentName}\\`);\n return undefined;\n },\n \n // Check if a method exists\n hasMethod: function(methodName) {\n return methodRegistry.has(methodName);\n }\n };\n }\n `;\n }\n\n /**\n * Load required libraries from the registry with dependency resolution\n * @param libraries - Array of library dependencies\n * @param componentLibraries - All available component libraries for dependency resolution\n * @returns Map of loaded libraries\n */\n private async loadRequiredLibraries(libraries: any[], componentLibraries: ComponentLibraryEntity[]): Promise<Map<string, any>> {\n const loadedLibraries = new Map<string, any>();\n \n if (this.config.debug) {\n console.log('๐Ÿ” loadRequiredLibraries called with:', {\n librariesCount: libraries?.length || 0,\n libraries: libraries?.map(l => ({ name: l.name, version: l.version, globalVariable: l.globalVariable }))\n });\n }\n \n if (!libraries || libraries.length === 0) {\n if (this.config.debug) {\n console.log('๐Ÿ“š No libraries to load, returning empty map');\n }\n return loadedLibraries;\n }\n\n // Only works in browser environment\n if (typeof window === 'undefined') {\n console.warn('Library loading is only supported in browser environments');\n return loadedLibraries;\n }\n\n // Initialize LibraryRegistry with componentLibraries if provided\n if (componentLibraries) {\n await LibraryRegistry.Config(false, componentLibraries);\n } else {\n console.warn('โš ๏ธ No componentLibraries provided for LibraryRegistry initialization');\n }\n\n // Extract library names from the requested libraries\n const libraryNames = libraries.map(lib => lib.name);\n \n if (this.config.debug) {\n console.log('๐Ÿ“ฆ Using dependency-aware loading for libraries:', libraryNames);\n }\n\n try {\n // Use the new dependency-aware loading\n const loadedLibraryMap = await LibraryLoader.loadLibrariesWithDependencies(\n libraryNames,\n componentLibraries,\n 'component-compiler',\n { debug: this.config.debug }\n );\n\n // Map the results to match the expected format\n // We need to map from library name to global variable\n for (const lib of libraries) {\n // Check if library is approved first\n const isApproved = LibraryRegistry.isApproved(lib.name);\n if (!isApproved) {\n console.error(`โŒ Library '${lib.name}' is not approved`);\n throw new Error(`Library '${lib.name}' is not approved. Only approved libraries can be used.`);\n }\n\n // Get the loaded library from the map\n const loadedValue = loadedLibraryMap.get(lib.name);\n \n if (loadedValue) {\n // Store by global variable name for component access\n loadedLibraries.set(lib.globalVariable, loadedValue);\n if (this.config.debug) {\n console.log(`โœ… Mapped ${lib.name} to global variable ${lib.globalVariable}`);\n }\n } else {\n // Fallback: check if it's already globally available (might be a dependency)\n const globalValue = (window as any)[lib.globalVariable];\n if (globalValue) {\n loadedLibraries.set(lib.globalVariable, globalValue);\n if (this.config.debug) {\n console.log(`โœ… Found ${lib.name} already loaded as ${lib.globalVariable}`);\n }\n } else {\n console.error(`โŒ Library '${lib.name}' failed to load`);\n throw new Error(`Library '${lib.name}' failed to load or did not expose '${lib.globalVariable}'`);\n }\n }\n }\n } catch (error: any) {\n console.error('Failed to load libraries with dependencies:', error);\n \n // Fallback to old loading method if dependency resolution fails\n if (this.config.debug) {\n console.warn('โš ๏ธ Falling back to non-dependency-aware loading due to error');\n }\n \n // Load each library independently (old method)\n for (const lib of libraries) {\n if ((window as any)[lib.globalVariable]) {\n loadedLibraries.set(lib.globalVariable, (window as any)[lib.globalVariable]);\n } else {\n // Try to load using LibraryRegistry\n const libraryDef = LibraryRegistry.getLibrary(lib.name);\n if (libraryDef) {\n const resolvedVersion = LibraryRegistry.resolveVersion(lib.name, lib.version);\n const cdnUrl = LibraryRegistry.getCdnUrl(lib.name, resolvedVersion);\n \n if (cdnUrl) {\n await this.loadScript(cdnUrl, lib.globalVariable);\n const libraryValue = (window as any)[lib.globalVariable];\n if (libraryValue) {\n loadedLibraries.set(lib.globalVariable, libraryValue);\n }\n }\n }\n }\n }\n }\n \n if (this.config.debug) {\n console.log(`โœ… All libraries loaded successfully. Total: ${loadedLibraries.size}`);\n console.log('๐Ÿ“š Loaded libraries map:', Array.from(loadedLibraries.keys()));\n }\n \n return loadedLibraries;\n }\n\n /**\n * Load CSS stylesheets dynamically\n * @param urls - Array of CSS URLs to load\n * @returns Promise that resolves when all stylesheets are loaded\n */\n private async loadStyles(urls: string[]): Promise<void> {\n const loadPromises = urls.map(url => {\n return new Promise<void>((resolve) => {\n // Check if stylesheet already exists\n const existingLink = document.querySelector(`link[href=\"${url}\"]`);\n if (existingLink) {\n resolve();\n return;\n }\n\n // Create new link element\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = url;\n \n // CSS load events are not reliable cross-browser, so resolve immediately\n // The CSS will load asynchronously but won't block component rendering\n document.head.appendChild(link);\n resolve();\n });\n });\n\n await Promise.all(loadPromises);\n }\n\n /**\n * Load a script dynamically\n * @param url - Script URL\n * @param globalName - Expected global variable name\n * @returns Promise that resolves when script is loaded\n */\n private loadScript(url: string, globalName: string): Promise<void> {\n return new Promise((resolve, reject) => {\n // Check if script already exists\n const existingScript = document.querySelector(`script[src=\"${url}\"]`);\n if (existingScript) {\n // Wait for it to finish loading with exponential backoff\n let attempts = 0;\n const maxAttempts = 50; // 5 seconds total with 100ms intervals\n const checkLoaded = () => {\n if ((window as any)[globalName]) {\n resolve();\n } else if (attempts >= maxAttempts) {\n reject(new Error(`${globalName} not found after ${maxAttempts * 100}ms waiting for existing script`));\n } else {\n attempts++;\n setTimeout(checkLoaded, 100);\n }\n };\n checkLoaded();\n return;\n }\n\n // Create new script element\n const script = document.createElement('script');\n script.src = url;\n script.async = true;\n \n script.onload = () => {\n // More robust checking with multiple attempts\n let attempts = 0;\n const maxAttempts = 20; // 2 seconds total\n const checkInterval = 100; // Check every 100ms\n \n const checkGlobal = () => {\n if ((window as any)[globalName]) {\n if (this.config.debug) {\n console.log(` โœ“ Global variable ${globalName} found after ${attempts * checkInterval}ms`);\n }\n resolve();\n } else if (attempts >= maxAttempts) {\n // Final check - some libraries might use a different global name pattern\n if (this.config.debug) {\n console.error(` โŒ ${globalName} not found after ${attempts * checkInterval}ms`);\n // Only log matching property names, not the entire window object\n const matchingKeys = Object.keys(window).filter(k => k.toLowerCase().includes(globalName.toLowerCase()));\n console.log(` โ„น๏ธ Matching window properties: ${matchingKeys.join(', ') || 'none'}`);\n }\n reject(new Error(`${globalName} not found after loading script from ${url}`));\n } else {\n attempts++;\n setTimeout(checkGlobal, checkInterval);\n }\n };\n \n // Start checking immediately (don't wait 100ms first)\n checkGlobal();\n };\n \n script.onerror = () => {\n reject(new Error(`Failed to load script: ${url}`));\n };\n \n document.head.appendChild(script);\n });\n }\n\n /**\n * Creates a component factory function from transpiled code\n * @param transpiledCode - Transpiled JavaScript code\n * @param componentName - Name of the component\n * @param loadedLibraries - Map of loaded libraries\n * @returns Component factory function\n */\n private createComponentFactory(\n transpiledCode: string, \n componentName: string,\n loadedLibraries: Map<string, any>\n ): (context: RuntimeContext, styles?: ComponentStyles) => ComponentObject {\n try {\n // Create the factory function with all React hooks\n const factoryCreator = new Function(\n 'React', 'ReactDOM',\n 'useState', 'useEffect', 'useCallback', 'useMemo', 'useRef', 'useContext', 'useReducer', 'useLayoutEffect',\n 'libraries', 'styles', 'console', 'components',\n `${transpiledCode}; return createComponent;`\n );\n\n // Return a function that executes the factory with runtime context\n return (context: RuntimeContext, styles: any = {}, components: Record<string, any> = {}) => {\n const { React, ReactDOM, libraries = {} } = context;\n \n // Merge loaded libraries with context libraries\n const mergedLibraries = { ...libraries };\n loadedLibraries.forEach((value, key) => {\n mergedLibraries[key] = value;\n });\n\n // Execute the factory creator to get the createComponent function\n const createComponentFn = factoryCreator(\n React,\n ReactDOM,\n React.useState,\n React.useEffect,\n React.useCallback,\n React.useMemo,\n React.useRef,\n React.useContext,\n React.useReducer,\n React.useLayoutEffect,\n mergedLibraries,\n styles,\n console,\n components\n );\n\n // Call createComponent to get the actual component\n const Component = createComponentFn(\n React,\n ReactDOM,\n React.useState,\n React.useEffect,\n React.useCallback,\n React.useMemo,\n React.useRef,\n React.useContext,\n React.useReducer,\n React.useLayoutEffect,\n mergedLibraries,\n styles,\n console,\n components\n );\n\n // Return the component directly\n return Component;\n };\n } catch (error: any) {\n throw new Error(`Failed to create component factory: ${error.message}`);\n }\n }\n\n\n /**\n * Validates compilation options\n * @param options - Options to validate\n * @throws Error if validation fails\n */\n private validateCompileOptions(options: CompileOptions): void {\n // Check if options object exists\n if (!options) {\n throw new Error(\n 'Component compilation failed: No options provided.\\n' +\n 'Expected an object with componentName and componentCode properties.\\n' +\n 'Example: { componentName: \"MyComponent\", componentCode: \"function MyComponent() { ... }\" }'\n );\n }\n\n // Check component name\n if (!options.componentName) {\n const providedKeys = Object.keys(options).join(', ');\n throw new Error(\n 'Component compilation failed: Component name is required.\\n' +\n `Received options with keys: [${providedKeys}]\\n` +\n 'Please ensure your component spec includes a \"name\" property.\\n' +\n 'Example: { name: \"MyComponent\", code: \"...\" }'\n );\n }\n\n // Check component code\n if (!options.componentCode) {\n throw new Error(\n `Component compilation failed: Component code is required for \"${options.componentName}\".\\n` +\n 'Please ensure your component spec includes a \"code\" property with the component source code.\\n' +\n 'Example: { name: \"MyComponent\", code: \"function MyComponent() { return <div>Hello</div>; }\" }'\n );\n }\n\n // Check code type\n if (typeof options.componentCode !== 'string') {\n const actualType = typeof options.componentCode;\n throw new Error(\n `Component compilation failed: Component code must be a string for \"${options.componentName}\".\\n` +\n `Received type: ${actualType}\\n` +\n `Received value: ${JSON.stringify(options.componentCode).substring(0, 100)}...\\n` +\n 'Please ensure the code property contains a string of JavaScript/JSX code.'\n );\n }\n\n // Check if code is empty or whitespace only\n if (options.componentCode.trim().length === 0) {\n throw new Error(\n `Component compilation failed: Component code is empty for \"${options.componentName}\".\\n` +\n 'The code property must contain valid JavaScript/JSX code defining a React component.'\n );\n }\n\n // Basic syntax check\n if (!options.componentCode.includes(options.componentName)) {\n throw new Error(\n `Component compilation failed: Component code must define a component named \"${options.componentName}\".\\n` +\n 'The function/component name in the code must match the componentName property.\\n' +\n `Expected to find: function ${options.componentName}(...) or const ${options.componentName} = ...\\n` +\n 'Code preview: ' + options.componentCode.substring(0, 200) + '...'\n );\n }\n }\n\n /**\n * Generates a unique component ID\n * @param componentName - Name of the component\n * @returns Unique component ID\n */\n private generateComponentId(componentName: string): string {\n return `${componentName}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n }\n\n /**\n * Gets a cached component if available\n * @param componentName - Name of the component\n * @param code - Component source code\n * @returns Cached component or undefined\n */\n private getCachedComponent(componentName: string, code: string): CompiledComponent | undefined {\n // Create cache key based on name AND content hash\n const cacheKey = this.createCacheKey(componentName, code);\n return this.compilationCache.get(cacheKey);\n }\n\n /**\n * Creates a cache key based on component name and code content\n * @param componentName - Name of the component\n * @param code - Component source code\n * @returns Cache key\n */\n private createCacheKey(componentName: string, code: string): string {\n // Simple hash function for code content\n let hash = 0;\n for (let i = 0; i < code.length; i++) {\n const char = code.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32-bit integer\n }\n return `${componentName}_${hash.toString(36)}`;\n }\n\n /**\n * Caches a compiled component\n * @param component - Component to cache\n * @param code - Original source code\n */\n private cacheComponent(component: CompiledComponent, code: string): void {\n // Enforce cache size limit\n if (this.compilationCache.size >= this.config.maxCacheSize) {\n // Remove oldest entry (first in map)\n const firstKey = this.compilationCache.keys().next().value;\n if (firstKey)\n this.compilationCache.delete(firstKey);\n }\n\n const cacheKey = this.createCacheKey(component.name, code);\n this.compilationCache.set(cacheKey, component);\n }\n\n /**\n * Creates a standardized compilation error\n * @param error - Original error\n * @param componentName - Name of the component\n * @returns Formatted component error\n */\n private createCompilationError(error: any, componentName: string): ComponentError {\n return {\n message: error.message || 'Unknown compilation error',\n stack: error.stack,\n componentName,\n phase: 'compilation',\n details: error\n };\n }\n\n /**\n * Clears the compilation cache\n */\n clearCache(): void {\n this.compilationCache.clear();\n }\n\n /**\n * Gets current cache size\n * @returns Number of cached components\n */\n getCacheSize(): number {\n return this.compilationCache.size;\n }\n\n /**\n * Updates compiler configuration\n * @param config - New configuration options\n */\n updateConfig(config: Partial<CompilerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n}"]}
package/dist/index.d.ts CHANGED
@@ -39,10 +39,11 @@ export declare const DEFAULT_CONFIGS: {
39
39
  export declare function createReactRuntime(babelInstance: any, config?: {
40
40
  compiler?: Partial<import('./types').CompilerConfig>;
41
41
  registry?: Partial<import('./types').RegistryConfig>;
42
- }, runtimeContext?: import('./types').RuntimeContext): {
42
+ }, runtimeContext?: import('./types').RuntimeContext, debug?: boolean): {
43
43
  compiler: ComponentCompiler;
44
44
  registry: ComponentRegistry;
45
45
  resolver: ComponentResolver;
46
46
  version: string;
47
+ debug: boolean;
47
48
  };
48
49
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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cAAc,CAAC,CAAC;CACtD,EACD,cAAc,CAAC,EAAE,OAAO,SAAS,EAAE,cAAc,EACjD,KAAK,GAAE,OAAe;;;;;;EA0BvB"}
package/dist/index.js CHANGED
@@ -93,16 +93,25 @@ exports.DEFAULT_CONFIGS = {
93
93
  enableNamespaces: true
94
94
  }
95
95
  };
96
- function createReactRuntime(babelInstance, config, runtimeContext) {
97
- const compiler = new compiler_1.ComponentCompiler(config?.compiler);
96
+ function createReactRuntime(babelInstance, config, runtimeContext, debug = false) {
97
+ const compilerConfig = {
98
+ ...config?.compiler,
99
+ debug: config?.compiler?.debug ?? debug
100
+ };
101
+ const registryConfig = {
102
+ ...config?.registry,
103
+ debug: config?.registry?.debug ?? debug
104
+ };
105
+ const compiler = new compiler_1.ComponentCompiler(compilerConfig);
98
106
  compiler.setBabelInstance(babelInstance);
99
- const registry = new registry_1.ComponentRegistry(config?.registry);
107
+ const registry = new registry_1.ComponentRegistry(registryConfig);
100
108
  const resolver = new registry_2.ComponentResolver(registry, compiler, runtimeContext);
101
109
  return {
102
110
  compiler,
103
111
  registry,
104
112
  resolver,
105
- version: exports.VERSION
113
+ version: exports.VERSION,
114
+ debug
106
115
  };
107
116
  }
108
117
  exports.createReactRuntime = createReactRuntime;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAOA,yCAA+C;AAC/C,yCAA+C;AAC/C,yCAA+C;AAG/C,0CAAwB;AAGxB,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAC1B,uCAQoB;AAPlB,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,6GAAA,iBAAiB,OAAA;AACjB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AACpB,wGAAA,YAAY,OAAA;AAId,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA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KAAK;QACjB,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,GAAG;KAClB;IACD,QAAQ,EAAE;QACR,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,KAAK;QACtB,MAAM,EAAE,IAAI;QACZ,gBAAgB,EAAE,IAAI;KACvB;CACF,CAAC;AASF,SAAgB,kBAAkB,CAChC,aAAkB,EAClB,MAGC,EACD,cAAiD;IAEjD,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzD,QAAQ,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAE3E,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO,EAAE,eAAO;KACjB,CAAC;AACJ,CAAC;AApBD,gDAoBC","sourcesContent":["/**\n * @fileoverview Main entry point for the MemberJunction React Runtime.\n * Exports all public APIs for platform-agnostic React component compilation and execution.\n * @module @memberjunction/react-runtime\n */\n\n// Import necessary classes for createReactRuntime function\nimport { ComponentCompiler } from './compiler';\nimport { ComponentRegistry } from './registry';\nimport { ComponentResolver } from './registry';\n\n// Export all types\nexport * from './types';\n\n// Export compiler APIs\nexport { ComponentCompiler } from './compiler';\nexport { \n DEFAULT_PRESETS,\n DEFAULT_PLUGINS,\n PRODUCTION_CONFIG,\n DEVELOPMENT_CONFIG,\n getBabelConfig,\n validateBabelPresets,\n getJSXConfig\n} from './compiler';\n\n// Export registry APIs\nexport { ComponentRegistry } from './registry';\nexport { \n ComponentResolver,\n ComponentSpec,\n ResolvedComponents\n} from './registry';\n\n// Export runtime APIs\nexport {\n createErrorBoundary,\n withErrorBoundary,\n formatComponentError,\n createErrorLogger\n} from './runtime';\n\n\nexport {\n buildComponentProps,\n normalizeCallbacks,\n normalizeStyles,\n validateComponentProps,\n mergeProps,\n createPropsTransformer,\n wrapCallbacksWithLogging,\n extractPropPaths,\n PropBuilderOptions\n} from './runtime';\n\nexport {\n ComponentHierarchyRegistrar,\n registerComponentHierarchy,\n validateComponentSpec,\n flattenComponentHierarchy,\n countComponentsInHierarchy,\n HierarchyRegistrationResult,\n ComponentRegistrationError,\n HierarchyRegistrationOptions\n} from './runtime';\n\nexport {\n ReactRootManager,\n reactRootManager,\n ManagedReactRoot\n} from './runtime';\n\n// Export utilities\n\nexport { \n SetupStyles,\n createDefaultComponentStyles \n} from './utilities/component-styles';\n\nexport {\n StandardLibraries,\n StandardLibraryManager,\n createStandardLibraries\n} from './utilities/standard-libraries';\n\nexport {\n LibraryLoader,\n LibraryLoadOptions,\n LibraryLoadResult\n} from './utilities/library-loader';\n\nexport {\n LibraryRegistry,\n LibraryDefinition\n} from './utilities/library-registry';\n\nexport {\n ComponentErrorAnalyzer,\n FailedComponentInfo\n} from './utilities/component-error-analyzer';\n\nexport {\n ResourceManager,\n resourceManager,\n ManagedResource\n} from './utilities/resource-manager';\n\nexport {\n CacheManager,\n CacheEntry,\n CacheOptions\n} from './utilities/cache-manager';\n\n// Version information\nexport const VERSION = '2.69.1';\n\n// Default configurations\nexport const DEFAULT_CONFIGS = {\n compiler: {\n babel: {\n presets: ['react'],\n plugins: []\n },\n minify: false,\n sourceMaps: false,\n cache: true,\n maxCacheSize: 100\n },\n registry: {\n maxComponents: 1000,\n cleanupInterval: 60000,\n useLRU: true,\n enableNamespaces: true\n }\n};\n\n/**\n * Creates a complete React runtime instance with all necessary components\n * @param babelInstance - Babel standalone instance for compilation\n * @param config - Optional configuration overrides\n * @param runtimeContext - Optional runtime context for registry-based components\n * @returns Object containing compiler, registry, and resolver instances\n */\nexport function createReactRuntime(\n babelInstance: any,\n config?: {\n compiler?: Partial<import('./types').CompilerConfig>;\n registry?: Partial<import('./types').RegistryConfig>;\n },\n runtimeContext?: import('./types').RuntimeContext\n) {\n const compiler = new ComponentCompiler(config?.compiler);\n compiler.setBabelInstance(babelInstance);\n \n const registry = new ComponentRegistry(config?.registry);\n const resolver = new ComponentResolver(registry, compiler, runtimeContext);\n\n return {\n compiler,\n registry,\n resolver,\n version: VERSION\n };\n}"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAOA,yCAA+C;AAC/C,yCAA+C;AAC/C,yCAA+C;AAG/C,0CAAwB;AAGxB,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAC1B,uCAQoB;AAPlB,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,6GAAA,iBAAiB,OAAA;AACjB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AACpB,wGAAA,YAAY,OAAA;AAId,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAC1B,uCAIoB;AAHlB,6GAAA,iBAAiB,OAAA;AACjB,yGAAA,aAAa,OAAA;AAKf,qCAKmB;AAJjB,8GAAA,mBAAmB,OAAA;AACnB,4GAAA,iBAAiB,OAAA;AACjB,+GAAA,oBAAoB,OAAA;AACpB,4GAAA,iBAAiB,OAAA;AAInB,qCAUmB;AATjB,8GAAA,mBAAmB,OAAA;AACnB,6GAAA,kBAAkB,OAAA;AAClB,0GAAA,eAAe,OAAA;AACf,iHAAA,sBAAsB,OAAA;AACtB,qGAAA,UAAU,OAAA;AACV,iHAAA,sBAAsB,OAAA;AACtB,mHAAA,wBAAwB,OAAA;AACxB,2GAAA,gBAAgB,OAAA;AAIlB,qCASmB;AARjB,sHAAA,2BAA2B,OAAA;AAC3B,qHAAA,0BAA0B,OAAA;AAC1B,gHAAA,qBAAqB,OAAA;AACrB,oHAAA,yBAAyB,OAAA;AACzB,qHAAA,0BAA0B,OAAA;AAM5B,qCAImB;AAHjB,2GAAA,gBAAgB,OAA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AC,aAAa,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAE3E,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO,EAAE,eAAO;QAChB,KAAK;KACN,CAAC;AACJ,CAAC;AAjCD,gDAiCC","sourcesContent":["/**\n * @fileoverview Main entry point for the MemberJunction React Runtime.\n * Exports all public APIs for platform-agnostic React component compilation and execution.\n * @module @memberjunction/react-runtime\n */\n\n// Import necessary classes for createReactRuntime function\nimport { ComponentCompiler } from './compiler';\nimport { ComponentRegistry } from './registry';\nimport { ComponentResolver } from './registry';\n\n// Export all types\nexport * from './types';\n\n// Export compiler APIs\nexport { ComponentCompiler } from './compiler';\nexport { \n DEFAULT_PRESETS,\n DEFAULT_PLUGINS,\n PRODUCTION_CONFIG,\n DEVELOPMENT_CONFIG,\n getBabelConfig,\n validateBabelPresets,\n getJSXConfig\n} from './compiler';\n\n// Export registry APIs\nexport { ComponentRegistry } from './registry';\nexport { \n ComponentResolver,\n ComponentSpec,\n ResolvedComponents\n} from './registry';\n\n// Export runtime APIs\nexport {\n createErrorBoundary,\n withErrorBoundary,\n formatComponentError,\n createErrorLogger\n} from './runtime';\n\n\nexport {\n buildComponentProps,\n normalizeCallbacks,\n normalizeStyles,\n validateComponentProps,\n mergeProps,\n createPropsTransformer,\n wrapCallbacksWithLogging,\n extractPropPaths,\n PropBuilderOptions\n} from './runtime';\n\nexport {\n ComponentHierarchyRegistrar,\n registerComponentHierarchy,\n validateComponentSpec,\n flattenComponentHierarchy,\n countComponentsInHierarchy,\n HierarchyRegistrationResult,\n ComponentRegistrationError,\n HierarchyRegistrationOptions\n} from './runtime';\n\nexport {\n ReactRootManager,\n reactRootManager,\n ManagedReactRoot\n} from './runtime';\n\n// Export utilities\n\nexport { \n SetupStyles,\n createDefaultComponentStyles \n} from './utilities/component-styles';\n\nexport {\n StandardLibraries,\n StandardLibraryManager,\n createStandardLibraries\n} from './utilities/standard-libraries';\n\nexport {\n LibraryLoader,\n LibraryLoadOptions,\n LibraryLoadResult\n} from './utilities/library-loader';\n\nexport {\n LibraryRegistry,\n LibraryDefinition\n} from './utilities/library-registry';\n\nexport {\n ComponentErrorAnalyzer,\n FailedComponentInfo\n} from './utilities/component-error-analyzer';\n\nexport {\n ResourceManager,\n resourceManager,\n ManagedResource\n} from './utilities/resource-manager';\n\nexport {\n CacheManager,\n CacheEntry,\n CacheOptions\n} from './utilities/cache-manager';\n\n// Version information\nexport const VERSION = '2.69.1';\n\n// Default configurations\nexport const DEFAULT_CONFIGS = {\n compiler: {\n babel: {\n presets: ['react'],\n plugins: []\n },\n minify: false,\n sourceMaps: false,\n cache: true,\n maxCacheSize: 100\n },\n registry: {\n maxComponents: 1000,\n cleanupInterval: 60000,\n useLRU: true,\n enableNamespaces: true\n }\n};\n\n/**\n * Creates a complete React runtime instance with all necessary components\n * @param babelInstance - Babel standalone instance for compilation\n * @param config - Optional configuration overrides\n * @param runtimeContext - Optional runtime context for registry-based components\n * @param debug - Enable debug logging (defaults to false)\n * @returns Object containing compiler, registry, and resolver instances\n */\nexport function createReactRuntime(\n babelInstance: any,\n config?: {\n compiler?: Partial<import('./types').CompilerConfig>;\n registry?: Partial<import('./types').RegistryConfig>;\n },\n runtimeContext?: import('./types').RuntimeContext,\n debug: boolean = false\n) {\n // Merge debug flag into configs\n const compilerConfig = {\n ...config?.compiler,\n debug: config?.compiler?.debug ?? debug\n };\n \n const registryConfig = {\n ...config?.registry,\n debug: config?.registry?.debug ?? debug\n };\n \n const compiler = new ComponentCompiler(compilerConfig);\n compiler.setBabelInstance(babelInstance);\n \n const registry = new ComponentRegistry(registryConfig);\n const resolver = new ComponentResolver(registry, compiler, runtimeContext);\n\n return {\n compiler,\n registry,\n resolver,\n version: VERSION,\n debug\n };\n}"]}
@@ -1,4 +1,4 @@
1
- import { ComponentSpec } from '@memberjunction/interactive-component-types';
1
+ import { ComponentSpec, ComponentObject } from '@memberjunction/interactive-component-types';
2
2
  import { ComponentCompiler } from '../compiler';
3
3
  import { RuntimeContext } from '../types';
4
4
  import { ComponentDependencyInfo, DependencyTree } from './registry-provider';
@@ -11,10 +11,11 @@ export declare class ComponentRegistryService {
11
11
  private runtimeContext;
12
12
  private componentEngine;
13
13
  private registryProviders;
14
+ private debug;
14
15
  private constructor();
15
- static getInstance(compiler: ComponentCompiler, context: RuntimeContext): ComponentRegistryService;
16
+ static getInstance(compiler: ComponentCompiler, context: RuntimeContext, debug?: boolean): ComponentRegistryService;
16
17
  initialize(contextUser?: UserInfo): Promise<void>;
17
- getCompiledComponent(componentId: string, referenceId?: string, contextUser?: UserInfo): Promise<Function>;
18
+ getCompiledComponent(componentId: string, referenceId?: string, contextUser?: UserInfo): Promise<ComponentObject>;
18
19
  getComponentSpec(componentId: string, contextUser?: UserInfo): Promise<ComponentSpec>;
19
20
  private fetchFromExternalRegistry;
20
21
  private cacheExternalComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry-service.d.ts","sourceRoot":"","sources":["../../src/registry/component-registry-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAGL,uBAAuB,EACvB,cAAc,EAEf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAuB1D,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAyC;IAGhE,OAAO,CAAC,sBAAsB,CAA8C;IAC5E,OAAO,CAAC,mBAAmB,CAAkC;IAG7D,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,cAA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B,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,QAAQ,EACtB,OAAO,cAAoB,GAC1B,OAAO,CAAC,cAAc,CAAC;IAmDpB,mBAAmB,CACvB,eAAe,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,QAAQ,GACrB,OAAO,CAAC,MAAM,EAAE,CAAC;IAqBpB,OAAO,CAAC,qBAAqB;IAU7B,wBAAwB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAezE,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,iBAAiB;IAWzB,aAAa,IAAI;QACf,kBAAkB,EAAE,MAAM,CAAC;QAC3B,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB;IAgBD,UAAU,IAAI,IAAI;IAWlB,OAAO,CAAC,eAAe;CAUxB"}
@@ -4,17 +4,19 @@ exports.ComponentRegistryService = void 0;
4
4
  const core_1 = require("@memberjunction/core");
5
5
  const core_entities_1 = require("@memberjunction/core-entities");
6
6
  class ComponentRegistryService {
7
- constructor(compiler, runtimeContext) {
7
+ constructor(compiler, runtimeContext, debug = false) {
8
8
  this.compiledComponentCache = new Map();
9
9
  this.componentReferences = new Map();
10
10
  this.componentEngine = core_entities_1.ComponentMetadataEngine.Instance;
11
11
  this.registryProviders = new Map();
12
+ this.debug = false;
12
13
  this.compiler = compiler;
13
14
  this.runtimeContext = runtimeContext;
15
+ this.debug = debug;
14
16
  }
15
- static getInstance(compiler, context) {
17
+ static getInstance(compiler, context, debug = false) {
16
18
  if (!ComponentRegistryService.instance) {
17
- ComponentRegistryService.instance = new ComponentRegistryService(compiler, context);
19
+ ComponentRegistryService.instance = new ComponentRegistryService(compiler, context, debug);
18
20
  }
19
21
  return ComponentRegistryService.instance;
20
22
  }
@@ -35,10 +37,14 @@ class ComponentRegistryService {
35
37
  if (referenceId) {
36
38
  this.addComponentReference(key, referenceId);
37
39
  }
38
- console.log(`โœ… Reusing compiled component from cache: ${key} (use count: ${cached.useCount})`);
40
+ if (this.debug) {
41
+ console.log(`โœ… Reusing compiled component from cache: ${key} (use count: ${cached.useCount})`);
42
+ }
39
43
  return cached.component;
40
44
  }
41
- console.log(`๐Ÿ”„ Loading and compiling component: ${key}`);
45
+ if (this.debug) {
46
+ console.log(`๐Ÿ”„ Loading and compiling component: ${key}`);
47
+ }
42
48
  const spec = await this.getComponentSpec(componentId, contextUser);
43
49
  const allLibraries = this.componentEngine.ComponentLibraries || [];
44
50
  const compilationResult = await this.compiler.compile({
@@ -68,7 +74,7 @@ class ComponentRegistryService {
68
74
  if (!compilationResult.component) {
69
75
  throw new Error(`Component compilation succeeded but no component returned`);
70
76
  }
71
- const compiledComponent = compilationResult.component.component(this.runtimeContext);
77
+ const compiledComponent = compilationResult.component.factory(this.runtimeContext);
72
78
  this.compiledComponentCache.set(key, {
73
79
  component: compiledComponent,
74
80
  metadata,
@@ -94,7 +100,9 @@ class ComponentRegistryService {
94
100
  return JSON.parse(component.Specification);
95
101
  }
96
102
  if (component.Specification && component.LastSyncedAt) {
97
- console.log(`Using cached external component: ${component.Name} (synced: ${component.LastSyncedAt})`);
103
+ if (this.debug) {
104
+ console.log(`Using cached external component: ${component.Name} (synced: ${component.LastSyncedAt})`);
105
+ }
98
106
  return JSON.parse(component.Specification);
99
107
  }
100
108
  const registry = this.componentEngine.ComponentRegistries?.find(r => r.ID === component.SourceRegistryID);
@@ -116,7 +124,9 @@ class ComponentRegistryService {
116
124
  if (apiKey) {
117
125
  headers['Authorization'] = `Bearer ${apiKey}`;
118
126
  }
119
- console.log(`Fetching from external registry: ${url}`);
127
+ if (this.debug) {
128
+ console.log(`Fetching from external registry: ${url}`);
129
+ }
120
130
  const response = await fetch(url, { headers });
121
131
  if (!response.ok) {
122
132
  throw new Error(`Registry fetch failed: ${response.status} ${response.statusText}`);
@@ -178,7 +188,9 @@ class ComponentRegistryService {
178
188
  if (!result) {
179
189
  throw new Error(`Failed to save cached component: ${componentEntity.Name}\n${componentEntity.LatestResult.Message || componentEntity.LatestResult.Error || componentEntity.LatestResult.Errors?.join(',')}`);
180
190
  }
181
- console.log(`Cached external component: ${componentEntity.Name} at ${componentEntity.LastSyncedAt}`);
191
+ if (this.debug) {
192
+ console.log(`Cached external component: ${componentEntity.Name} at ${componentEntity.LastSyncedAt}`);
193
+ }
182
194
  await this.componentEngine.Config(true, contextUser);
183
195
  }
184
196
  async loadDependencies(componentId, contextUser) {
@@ -267,7 +279,9 @@ class ComponentRegistryService {
267
279
  const timeSinceLastUse = Date.now() - cached.lastUsed.getTime();
268
280
  const evictionThreshold = 5 * 60 * 1000;
269
281
  if (timeSinceLastUse > evictionThreshold) {
270
- console.log(`๐Ÿ—‘๏ธ Evicting unused component from cache: ${componentKey}`);
282
+ if (this.debug) {
283
+ console.log(`๐Ÿ—‘๏ธ Evicting unused component from cache: ${componentKey}`);
284
+ }
271
285
  this.compiledComponentCache.delete(componentKey);
272
286
  }
273
287
  }
@@ -288,7 +302,9 @@ class ComponentRegistryService {
288
302
  };
289
303
  }
290
304
  clearCache() {
291
- console.log('๐Ÿงน Clearing all component caches');
305
+ if (this.debug) {
306
+ console.log('๐Ÿงน Clearing all component caches');
307
+ }
292
308
  this.compiledComponentCache.clear();
293
309
  this.componentReferences.clear();
294
310
  }
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry-service.js","sourceRoot":"","sources":["../../src/registry/component-registry-service.ts"],"names":[],"mappings":";;;AAeA,+CAA0D;AAC1D,iEAMuC;AAgBvC,MAAa,wBAAwB;IAanC,YACE,QAA2B,EAC3B,cAA8B;QAXxB,2BAAsB,GAAG,IAAI,GAAG,EAAmC,CAAC;QACpE,wBAAmB,GAAG,IAAI,GAAG,EAAuB,CAAC;QAKrD,oBAAe,GAAG,uCAAuB,CAAC,QAAQ,CAAC;QACnD,sBAAiB,GAAG,IAAI,GAAG,EAA4B,CAAC;QAM9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,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D,CAAC;QACH,CAAC;IACH,CAAC;IAOO,iBAAiB,CAAC,UAAkB;QAI1C,MAAM,MAAM,GAAG,oBAAoB,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QACjF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAKD,aAAa;QAKX,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC3C,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI;YACpD,aAAa;YACb,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;SAChE,CAAC;IACJ,CAAC;IAKD,UAAU;QACR,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;IAKO,eAAe,CACrB,IAAY,EACZ,SAAoC,EACpC,OAAe,EACf,gBAA2C;QAE3C,MAAM,YAAY,GAAG,gBAAgB,IAAI,OAAO,CAAC;QACjD,MAAM,aAAa,GAAG,SAAS,IAAI,QAAQ,CAAC;QAC5C,OAAO,GAAG,YAAY,IAAI,aAAa,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;IAC/D,CAAC;;AAxgBH,4DAygBC;AAxgBgB,iCAAQ,GAAoC,IAAI,AAAxC,CAAyC","sourcesContent":["/**\n * @fileoverview Service for managing registry-based component loading with caching\n * @module @memberjunction/react-runtime/registry\n */\n\nimport { ComponentSpec } from '@memberjunction/interactive-component-types';\nimport { ComponentCompiler } from '../compiler';\nimport { RuntimeContext } from '../types';\nimport { \n RegistryProvider, \n RegistryComponentResponse,\n ComponentDependencyInfo,\n DependencyTree, \n RegistryComponentMetadata\n} from './registry-provider';\nimport { UserInfo, Metadata } from '@memberjunction/core';\nimport { \n ComponentEntity, \n ComponentRegistryEntity,\n ComponentDependencyEntity,\n ComponentLibraryLinkEntity,\n ComponentMetadataEngine\n} from '@memberjunction/core-entities';\n\n/**\n * Cached compiled component with metadata\n */\ninterface CachedCompiledComponent {\n component: Function;\n metadata: RegistryComponentResponse['metadata'];\n compiledAt: Date;\n lastUsed: Date;\n useCount: number;\n}\n\n/**\n * Service for managing component loading from registries with compilation caching\n */\nexport class ComponentRegistryService {\n private static instance: ComponentRegistryService | null = null;\n \n // Caches\n private compiledComponentCache = new Map<string, CachedCompiledComponent>();\n private componentReferences = new Map<string, Set<string>>();\n \n // Dependencies\n private compiler: ComponentCompiler;\n private runtimeContext: RuntimeContext;\n private componentEngine = ComponentMetadataEngine.Instance;\n private registryProviders = new Map<string, RegistryProvider>();\n \n private constructor(\n compiler: ComponentCompiler,\n runtimeContext: RuntimeContext\n ) {\n this.compiler = compiler;\n this.runtimeContext = runtimeContext;\n }\n \n /**\n * Get or create the singleton instance\n */\n static getInstance(\n compiler: ComponentCompiler, \n context: RuntimeContext\n ): ComponentRegistryService {\n if (!ComponentRegistryService.instance) {\n ComponentRegistryService.instance = new ComponentRegistryService(compiler, context);\n }\n return ComponentRegistryService.instance;\n }\n \n /**\n * Initialize the service with metadata\n */\n async initialize(contextUser?: UserInfo): Promise<void> {\n // Initialize metadata engine\n await this.componentEngine.Config(false, contextUser);\n }\n \n /**\n * Get a compiled component, using cache if available\n */\n async getCompiledComponent(\n componentId: string,\n referenceId?: string,\n contextUser?: UserInfo\n ): Promise<Function> {\n await this.initialize(contextUser);\n \n // Find component in metadata\n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n throw new Error(`Component not found: ${componentId}`);\n }\n \n const key = this.getComponentKey(component.Name, component.Namespace, component.Version, component.SourceRegistryID);\n \n // Check if already compiled and cached\n if (this.compiledComponentCache.has(key)) {\n const cached = this.compiledComponentCache.get(key)!;\n cached.lastUsed = new Date();\n cached.useCount++;\n \n // Track reference if provided\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n console.log(`โœ… Reusing compiled component from cache: ${key} (use count: ${cached.useCount})`);\n return cached.component;\n }\n \n // Not in cache, need to load and compile\n console.log(`๐Ÿ”„ Loading and compiling component: ${key}`);\n \n // Get the component specification\n const spec = await this.getComponentSpec(componentId, contextUser);\n \n // Compile the component\n // Load all libraries from metadata engine\n const allLibraries = this.componentEngine.ComponentLibraries || [];\n \n const compilationResult = await this.compiler.compile({\n componentName: component.Name,\n componentCode: spec.code,\n libraries: spec.libraries,\n allLibraries\n });\n \n if (!compilationResult.success) {\n throw new Error(`Failed to compile component ${component.Name}: ${compilationResult.error}`);\n }\n \n // Cache the compiled component\n const metadata: RegistryComponentMetadata = {\n name: component.Name,\n namespace: component.Namespace || '',\n version: component.Version,\n description: component.Description || '',\n title: component.Title || undefined,\n type: component.Type || undefined,\n status: component.Status || undefined,\n properties: spec.properties,\n events: spec.events,\n libraries: spec.libraries,\n dependencies: spec.dependencies,\n sourceRegistryID: component.SourceRegistryID,\n isLocal: !component.SourceRegistryID\n };\n \n if (!compilationResult.component) {\n throw new Error(`Component compilation succeeded but no component returned`);\n }\n const compiledComponent = compilationResult.component.component(this.runtimeContext);\n this.compiledComponentCache.set(key, {\n component: compiledComponent,\n metadata,\n compiledAt: new Date(),\n lastUsed: new Date(),\n useCount: 1\n });\n \n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n return compiledComponent;\n }\n \n /**\n * Get component specification from database or external registry\n */\n async getComponentSpec(\n componentId: string,\n contextUser?: UserInfo\n ): Promise<ComponentSpec> {\n await this.initialize(contextUser);\n \n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n throw new Error(`Component not found: ${componentId}`);\n }\n \n if (!component.SourceRegistryID) {\n // LOCAL: Use specification from database\n if (!component.Specification) {\n throw new Error(`Local component ${component.Name} has no specification`);\n }\n return JSON.parse(component.Specification);\n }\n \n // EXTERNAL: Check if we have a cached version\n if (component.Specification && component.LastSyncedAt) {\n // For now, always use cached version (no expiration)\n console.log(`Using cached external component: ${component.Name} (synced: ${component.LastSyncedAt})`);\n return JSON.parse(component.Specification);\n }\n \n // Need to fetch from external registry\n const registry = this.componentEngine.ComponentRegistries?.find(\n r => r.ID === component.SourceRegistryID\n );\n \n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n \n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n \n const spec = await this.fetchFromExternalRegistry(\n registry.URI || '',\n component.Name,\n component.Namespace || '',\n component.Version,\n this.getRegistryApiKey(registry.ID) // API keys stored in env vars or secure config\n );\n \n // Store in local database for future use\n await this.cacheExternalComponent(componentId, spec, contextUser);\n \n return spec;\n }\n \n /**\n * Fetch component from external registry via HTTP\n */\n private async fetchFromExternalRegistry(\n uri: string,\n name: string,\n namespace: string,\n version: string,\n apiKey?: string\n ): Promise<ComponentSpec> {\n const url = `${uri}/components/${encodeURIComponent(namespace)}/${encodeURIComponent(name)}/${version}`;\n \n const headers: HeadersInit = {\n 'Accept': 'application/json'\n };\n \n if (apiKey) {\n headers['Authorization'] = `Bearer ${apiKey}`;\n }\n \n console.log(`Fetching from external registry: ${url}`);\n \n const response = await fetch(url, { headers });\n \n if (!response.ok) {\n throw new Error(`Registry fetch failed: ${response.status} ${response.statusText}`);\n }\n \n const spec = await response.json() as ComponentSpec;\n return spec;\n }\n \n /**\n * Cache an external component in the local database\n */\n private async cacheExternalComponent(\n componentId: string,\n spec: ComponentSpec,\n contextUser?: UserInfo\n ): Promise<void> {\n // Get the actual entity object to save\n const md = new Metadata();\n const componentEntity = await md.GetEntityObject<ComponentEntity>('MJ: Components', contextUser);\n \n // Load the existing component\n if (!await componentEntity.Load(componentId)) {\n throw new Error(`Failed to load component entity: ${componentId}`);\n }\n \n // Update with fetched specification and all fields from spec\n componentEntity.Specification = JSON.stringify(spec);\n componentEntity.LastSyncedAt = new Date();\n \n // Set ReplicatedAt only on first fetch\n if (!componentEntity.ReplicatedAt) {\n componentEntity.ReplicatedAt = new Date();\n }\n \n // Update all fields from the spec with strong typing\n if (spec.name) {\n componentEntity.Name = spec.name;\n }\n \n if (spec.namespace) {\n componentEntity.Namespace = spec.namespace;\n }\n \n if (spec.version) {\n componentEntity.Version = spec.version;\n }\n \n if (spec.title) {\n componentEntity.Title = spec.title;\n }\n \n if (spec.description) {\n componentEntity.Description = spec.description;\n }\n \n if (spec.type) {\n // Map spec type to entity type (entity has specific enum values)\n const typeMap: Record<string, ComponentEntity['Type']> = {\n 'report': 'Report',\n 'dashboard': 'Dashboard',\n 'form': 'Form',\n 'table': 'Table',\n 'chart': 'Chart',\n 'navigation': 'Navigation',\n 'search': 'Search',\n 'widget': 'Widget',\n 'utility': 'Utility',\n 'other': 'Other'\n };\n \n const mappedType = typeMap[spec.type.toLowerCase()];\n if (mappedType) {\n componentEntity.Type = mappedType;\n }\n }\n \n if (spec.functionalRequirements) {\n componentEntity.FunctionalRequirements = spec.functionalRequirements;\n }\n \n if (spec.technicalDesign) {\n componentEntity.TechnicalDesign = spec.technicalDesign;\n }\n \n // Save back to database\n const result = await componentEntity.Save();\n if (!result) {\n throw new Error(`Failed to save cached component: ${componentEntity.Name}\\n${componentEntity.LatestResult.Message || componentEntity.LatestResult.Error || componentEntity.LatestResult.Errors?.join(',')}`);\n }\n \n console.log(`Cached external component: ${componentEntity.Name} at ${componentEntity.LastSyncedAt}`);\n \n // Refresh metadata cache after saving\n await this.componentEngine.Config(true, contextUser);\n }\n \n /**\n * Load component dependencies from database\n */\n async loadDependencies(\n componentId: string,\n contextUser?: UserInfo\n ): Promise<ComponentDependencyInfo[]> {\n await this.initialize(contextUser);\n \n // Get dependencies from metadata cache\n const dependencies = this.componentEngine.ComponentDependencies?.filter(\n d => d.ComponentID === componentId\n ) || [];\n \n const result: ComponentDependencyInfo[] = [];\n \n for (const dep of dependencies) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find(\n (c: ComponentEntity) => c.ID === dep.DependencyComponentID\n );\n \n if (depComponent) {\n result.push({\n name: depComponent.Name,\n namespace: depComponent.Namespace || '',\n version: depComponent.Version, // Version comes from the linked Component record\n isRequired: true, // All dependencies are required in MemberJunction\n location: depComponent.SourceRegistryID ? 'registry' : 'embedded',\n sourceRegistryID: depComponent.SourceRegistryID\n });\n }\n }\n \n return result;\n }\n \n /**\n * Resolve full dependency tree for a component\n */\n async resolveDependencyTree(\n componentId: string,\n contextUser?: UserInfo,\n visited = new Set<string>()\n ): Promise<DependencyTree> {\n if (visited.has(componentId)) {\n return { \n componentId, \n circular: true \n };\n }\n visited.add(componentId);\n \n await this.initialize(contextUser);\n \n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n return { componentId, dependencies: [] };\n }\n \n // Get direct dependencies\n const directDeps = await this.loadDependencies(componentId, contextUser);\n \n // Recursively resolve each dependency\n const dependencies: DependencyTree[] = [];\n for (const dep of directDeps) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find(\n c => c.Name.trim().toLowerCase() === dep.name.trim().toLowerCase() && \n c.Namespace?.trim().toLowerCase() === dep.namespace?.trim().toLowerCase()\n );\n \n if (depComponent) {\n const subTree = await this.resolveDependencyTree(\n depComponent.ID, \n contextUser, \n visited\n );\n dependencies.push(subTree);\n }\n }\n \n return {\n componentId,\n name: component.Name,\n namespace: component.Namespace || undefined,\n version: component.Version,\n dependencies,\n totalCount: dependencies.reduce((sum, d) => sum + (d.totalCount || 1), 1)\n };\n }\n \n /**\n * Get components to load in dependency order\n */\n async getComponentsToLoad(\n rootComponentId: string,\n contextUser?: UserInfo\n ): Promise<string[]> {\n const tree = await this.resolveDependencyTree(rootComponentId, contextUser);\n \n // Flatten tree in dependency order (depth-first)\n const ordered: string[] = [];\n const processNode = (node: DependencyTree) => {\n if (node.dependencies) {\n node.dependencies.forEach(processNode);\n }\n if (!ordered.includes(node.componentId)) {\n ordered.push(node.componentId);\n }\n };\n processNode(tree);\n \n return ordered;\n }\n \n /**\n * Add a reference to a component\n */\n private addComponentReference(componentKey: string, referenceId: string): void {\n if (!this.componentReferences.has(componentKey)) {\n this.componentReferences.set(componentKey, new Set());\n }\n this.componentReferences.get(componentKey)!.add(referenceId);\n }\n \n /**\n * Remove a reference to a component\n */\n removeComponentReference(componentKey: string, referenceId: string): void {\n const refs = this.componentReferences.get(componentKey);\n if (refs) {\n refs.delete(referenceId);\n \n // If no more references and cache cleanup is enabled\n if (refs.size === 0) {\n this.considerCacheEviction(componentKey);\n }\n }\n }\n \n /**\n * Consider evicting a component from cache\n */\n private considerCacheEviction(componentKey: string): void {\n const cached = this.compiledComponentCache.get(componentKey);\n if (cached) {\n const timeSinceLastUse = Date.now() - cached.lastUsed.getTime();\n const evictionThreshold = 5 * 60 * 1000; // 5 minutes\n \n if (timeSinceLastUse > evictionThreshold) {\n console.log(`๐Ÿ—‘๏ธ Evicting unused component from cache: ${componentKey}`);\n this.compiledComponentCache.delete(componentKey);\n }\n }\n }\n \n /**\n * Get API key for a registry from secure configuration\n * @param registryId - Registry ID\n * @returns API key or undefined\n */\n private getRegistryApiKey(registryId: string): string | undefined {\n // API keys should be stored in environment variables or secure configuration\n // Format: REGISTRY_API_KEY_{registryId} or similar\n // This is a placeholder - actual implementation would depend on the security infrastructure\n const envKey = `REGISTRY_API_KEY_${registryId.replace(/-/g, '_').toUpperCase()}`;\n return process.env[envKey];\n }\n \n /**\n * Get cache statistics\n */\n getCacheStats(): {\n compiledComponents: number;\n totalUseCount: number;\n memoryEstimate: string;\n } {\n let totalUseCount = 0;\n this.compiledComponentCache.forEach(cached => {\n totalUseCount += cached.useCount;\n });\n \n return {\n compiledComponents: this.compiledComponentCache.size,\n totalUseCount,\n memoryEstimate: `~${(this.compiledComponentCache.size * 50)}KB` // Rough estimate\n };\n }\n \n /**\n * Clear all caches\n */\n clearCache(): void {\n console.log('๐Ÿงน Clearing all component caches');\n this.compiledComponentCache.clear();\n this.componentReferences.clear();\n }\n \n /**\n * Generate a cache key for a component\n */\n private getComponentKey(\n name: string, \n namespace: string | null | undefined, \n version: string, \n sourceRegistryId: string | null | undefined\n ): string {\n const registryPart = sourceRegistryId || 'local';\n const namespacePart = namespace || 'global';\n return `${registryPart}/${namespacePart}/${name}@${version}`;\n }\n}"]}
1
+ {"version":3,"file":"component-registry-service.js","sourceRoot":"","sources":["../../src/registry/component-registry-service.ts"],"names":[],"mappings":";;;AAeA,+CAA0D;AAC1D,iEAMuC;AAgBvC,MAAa,wBAAwB;IAcnC,YACE,QAA2B,EAC3B,cAA8B,EAC9B,QAAiB,KAAK;QAbhB,2BAAsB,GAAG,IAAI,GAAG,EAAmC,CAAC;QACpE,wBAAmB,GAAG,IAAI,GAAG,EAAuB,CAAC;QAKrD,oBAAe,GAAG,uCAAuB,CAAC,QAAQ,CAAC;QACnD,sBAAiB,GAAG,IAAI,GAAG,EAA4B,CAAC;QACxD,UAAK,GAAY,KAAK,CAAC;QAO7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAKD,MAAM,CAAC,WAAW,CAChB,QAA2B,EAC3B,OAAuB,EACvB,QAAiB,KAAK;QAEtB,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACvC,wBAAwB,CAAC,QAAQ,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7F,CAAC;QACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAKD,KAAK,CAAC,UAAU,CAAC,WAAsB;QAErC,MAAM,IAAI,CAAC,eAAe,CAAC,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kB;QAI1C,MAAM,MAAM,GAAG,oBAAoB,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QACjF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAKD,aAAa;QAKX,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC3C,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI;YACpD,aAAa;YACb,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;SAChE,CAAC;IACJ,CAAC;IAKD,UAAU;QACR,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;IAKO,eAAe,CACrB,IAAY,EACZ,SAAoC,EACpC,OAAe,EACf,gBAA2C;QAE3C,MAAM,YAAY,GAAG,gBAAgB,IAAI,OAAO,CAAC;QACjD,MAAM,aAAa,GAAG,SAAS,IAAI,QAAQ,CAAC;QAC5C,OAAO,GAAG,YAAY,IAAI,aAAa,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;IAC/D,CAAC;;AA1hBH,4DA2hBC;AA1hBgB,iCAAQ,GAAoC,IAAI,AAAxC,CAAyC","sourcesContent":["/**\n * @fileoverview Service for managing registry-based component loading with caching\n * @module @memberjunction/react-runtime/registry\n */\n\nimport { ComponentSpec, ComponentObject } from '@memberjunction/interactive-component-types';\nimport { ComponentCompiler } from '../compiler';\nimport { RuntimeContext } from '../types';\nimport { \n RegistryProvider, \n RegistryComponentResponse,\n ComponentDependencyInfo,\n DependencyTree, \n RegistryComponentMetadata\n} from './registry-provider';\nimport { UserInfo, Metadata } from '@memberjunction/core';\nimport { \n ComponentEntity, \n ComponentRegistryEntity,\n ComponentDependencyEntity,\n ComponentLibraryLinkEntity,\n ComponentMetadataEngine\n} from '@memberjunction/core-entities';\n\n/**\n * Cached compiled component with metadata\n */\ninterface CachedCompiledComponent {\n component: ComponentObject;\n metadata: RegistryComponentResponse['metadata'];\n compiledAt: Date;\n lastUsed: Date;\n useCount: number;\n}\n\n/**\n * Service for managing component loading from registries with compilation caching\n */\nexport class ComponentRegistryService {\n private static instance: ComponentRegistryService | null = null;\n \n // Caches\n private compiledComponentCache = new Map<string, CachedCompiledComponent>();\n private componentReferences = new Map<string, Set<string>>();\n \n // Dependencies\n private compiler: ComponentCompiler;\n private runtimeContext: RuntimeContext;\n private componentEngine = ComponentMetadataEngine.Instance;\n private registryProviders = new Map<string, RegistryProvider>();\n private debug: boolean = false;\n \n private constructor(\n compiler: ComponentCompiler,\n runtimeContext: RuntimeContext,\n debug: boolean = false\n ) {\n this.compiler = compiler;\n this.runtimeContext = runtimeContext;\n this.debug = debug;\n }\n \n /**\n * Get or create the singleton instance\n */\n static getInstance(\n compiler: ComponentCompiler, \n context: RuntimeContext,\n debug: boolean = false\n ): ComponentRegistryService {\n if (!ComponentRegistryService.instance) {\n ComponentRegistryService.instance = new ComponentRegistryService(compiler, context, debug);\n }\n return ComponentRegistryService.instance;\n }\n \n /**\n * Initialize the service with metadata\n */\n async initialize(contextUser?: UserInfo): Promise<void> {\n // Initialize metadata engine\n await this.componentEngine.Config(false, contextUser);\n }\n \n /**\n * Get a compiled component, using cache if available\n */\n async getCompiledComponent(\n componentId: string,\n referenceId?: string,\n contextUser?: UserInfo\n ): Promise<ComponentObject> {\n await this.initialize(contextUser);\n \n // Find component in metadata\n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n throw new Error(`Component not found: ${componentId}`);\n }\n \n const key = this.getComponentKey(component.Name, component.Namespace, component.Version, component.SourceRegistryID);\n \n // Check if already compiled and cached\n if (this.compiledComponentCache.has(key)) {\n const cached = this.compiledComponentCache.get(key)!;\n cached.lastUsed = new Date();\n cached.useCount++;\n \n // Track reference if provided\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n if (this.debug) {\n console.log(`โœ… Reusing compiled component from cache: ${key} (use count: ${cached.useCount})`);\n }\n return cached.component;\n }\n \n // Not in cache, need to load and compile\n if (this.debug) {\n console.log(`๐Ÿ”„ Loading and compiling component: ${key}`);\n }\n \n // Get the component specification\n const spec = await this.getComponentSpec(componentId, contextUser);\n \n // Compile the component\n // Load all libraries from metadata engine\n const allLibraries = this.componentEngine.ComponentLibraries || [];\n \n const compilationResult = await this.compiler.compile({\n componentName: component.Name,\n componentCode: spec.code,\n libraries: spec.libraries,\n allLibraries\n });\n \n if (!compilationResult.success) {\n throw new Error(`Failed to compile component ${component.Name}: ${compilationResult.error}`);\n }\n \n // Cache the compiled component\n const metadata: RegistryComponentMetadata = {\n name: component.Name,\n namespace: component.Namespace || '',\n version: component.Version,\n description: component.Description || '',\n title: component.Title || undefined,\n type: component.Type || undefined,\n status: component.Status || undefined,\n properties: spec.properties,\n events: spec.events,\n libraries: spec.libraries,\n dependencies: spec.dependencies,\n sourceRegistryID: component.SourceRegistryID,\n isLocal: !component.SourceRegistryID\n };\n \n if (!compilationResult.component) {\n throw new Error(`Component compilation succeeded but no component returned`);\n }\n const compiledComponent = compilationResult.component.factory(this.runtimeContext);\n this.compiledComponentCache.set(key, {\n component: compiledComponent,\n metadata,\n compiledAt: new Date(),\n lastUsed: new Date(),\n useCount: 1\n });\n \n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n return compiledComponent;\n }\n \n /**\n * Get component specification from database or external registry\n */\n async getComponentSpec(\n componentId: string,\n contextUser?: UserInfo\n ): Promise<ComponentSpec> {\n await this.initialize(contextUser);\n \n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n throw new Error(`Component not found: ${componentId}`);\n }\n \n if (!component.SourceRegistryID) {\n // LOCAL: Use specification from database\n if (!component.Specification) {\n throw new Error(`Local component ${component.Name} has no specification`);\n }\n return JSON.parse(component.Specification);\n }\n \n // EXTERNAL: Check if we have a cached version\n if (component.Specification && component.LastSyncedAt) {\n // For now, always use cached version (no expiration)\n if (this.debug) {\n console.log(`Using cached external component: ${component.Name} (synced: ${component.LastSyncedAt})`);\n }\n return JSON.parse(component.Specification);\n }\n \n // Need to fetch from external registry\n const registry = this.componentEngine.ComponentRegistries?.find(\n r => r.ID === component.SourceRegistryID\n );\n \n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n \n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n \n const spec = await this.fetchFromExternalRegistry(\n registry.URI || '',\n component.Name,\n component.Namespace || '',\n component.Version,\n this.getRegistryApiKey(registry.ID) // API keys stored in env vars or secure config\n );\n \n // Store in local database for future use\n await this.cacheExternalComponent(componentId, spec, contextUser);\n \n return spec;\n }\n \n /**\n * Fetch component from external registry via HTTP\n */\n private async fetchFromExternalRegistry(\n uri: string,\n name: string,\n namespace: string,\n version: string,\n apiKey?: string\n ): Promise<ComponentSpec> {\n const url = `${uri}/components/${encodeURIComponent(namespace)}/${encodeURIComponent(name)}/${version}`;\n \n const headers: HeadersInit = {\n 'Accept': 'application/json'\n };\n \n if (apiKey) {\n headers['Authorization'] = `Bearer ${apiKey}`;\n }\n \n if (this.debug) {\n console.log(`Fetching from external registry: ${url}`);\n }\n \n const response = await fetch(url, { headers });\n \n if (!response.ok) {\n throw new Error(`Registry fetch failed: ${response.status} ${response.statusText}`);\n }\n \n const spec = await response.json() as ComponentSpec;\n return spec;\n }\n \n /**\n * Cache an external component in the local database\n */\n private async cacheExternalComponent(\n componentId: string,\n spec: ComponentSpec,\n contextUser?: UserInfo\n ): Promise<void> {\n // Get the actual entity object to save\n const md = new Metadata();\n const componentEntity = await md.GetEntityObject<ComponentEntity>('MJ: Components', contextUser);\n \n // Load the existing component\n if (!await componentEntity.Load(componentId)) {\n throw new Error(`Failed to load component entity: ${componentId}`);\n }\n \n // Update with fetched specification and all fields from spec\n componentEntity.Specification = JSON.stringify(spec);\n componentEntity.LastSyncedAt = new Date();\n \n // Set ReplicatedAt only on first fetch\n if (!componentEntity.ReplicatedAt) {\n componentEntity.ReplicatedAt = new Date();\n }\n \n // Update all fields from the spec with strong typing\n if (spec.name) {\n componentEntity.Name = spec.name;\n }\n \n if (spec.namespace) {\n componentEntity.Namespace = spec.namespace;\n }\n \n if (spec.version) {\n componentEntity.Version = spec.version;\n }\n \n if (spec.title) {\n componentEntity.Title = spec.title;\n }\n \n if (spec.description) {\n componentEntity.Description = spec.description;\n }\n \n if (spec.type) {\n // Map spec type to entity type (entity has specific enum values)\n const typeMap: Record<string, ComponentEntity['Type']> = {\n 'report': 'Report',\n 'dashboard': 'Dashboard',\n 'form': 'Form',\n 'table': 'Table',\n 'chart': 'Chart',\n 'navigation': 'Navigation',\n 'search': 'Search',\n 'widget': 'Widget',\n 'utility': 'Utility',\n 'other': 'Other'\n };\n \n const mappedType = typeMap[spec.type.toLowerCase()];\n if (mappedType) {\n componentEntity.Type = mappedType;\n }\n }\n \n if (spec.functionalRequirements) {\n componentEntity.FunctionalRequirements = spec.functionalRequirements;\n }\n \n if (spec.technicalDesign) {\n componentEntity.TechnicalDesign = spec.technicalDesign;\n }\n \n // Save back to database\n const result = await componentEntity.Save();\n if (!result) {\n throw new Error(`Failed to save cached component: ${componentEntity.Name}\\n${componentEntity.LatestResult.Message || componentEntity.LatestResult.Error || componentEntity.LatestResult.Errors?.join(',')}`);\n }\n \n if (this.debug) {\n console.log(`Cached external component: ${componentEntity.Name} at ${componentEntity.LastSyncedAt}`);\n }\n \n // Refresh metadata cache after saving\n await this.componentEngine.Config(true, contextUser);\n }\n \n /**\n * Load component dependencies from database\n */\n async loadDependencies(\n componentId: string,\n contextUser?: UserInfo\n ): Promise<ComponentDependencyInfo[]> {\n await this.initialize(contextUser);\n \n // Get dependencies from metadata cache\n const dependencies = this.componentEngine.ComponentDependencies?.filter(\n d => d.ComponentID === componentId\n ) || [];\n \n const result: ComponentDependencyInfo[] = [];\n \n for (const dep of dependencies) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find(\n (c: ComponentEntity) => c.ID === dep.DependencyComponentID\n );\n \n if (depComponent) {\n result.push({\n name: depComponent.Name,\n namespace: depComponent.Namespace || '',\n version: depComponent.Version, // Version comes from the linked Component record\n isRequired: true, // All dependencies are required in MemberJunction\n location: depComponent.SourceRegistryID ? 'registry' : 'embedded',\n sourceRegistryID: depComponent.SourceRegistryID\n });\n }\n }\n \n return result;\n }\n \n /**\n * Resolve full dependency tree for a component\n */\n async resolveDependencyTree(\n componentId: string,\n contextUser?: UserInfo,\n visited = new Set<string>()\n ): Promise<DependencyTree> {\n if (visited.has(componentId)) {\n return { \n componentId, \n circular: true \n };\n }\n visited.add(componentId);\n \n await this.initialize(contextUser);\n \n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n return { componentId, dependencies: [] };\n }\n \n // Get direct dependencies\n const directDeps = await this.loadDependencies(componentId, contextUser);\n \n // Recursively resolve each dependency\n const dependencies: DependencyTree[] = [];\n for (const dep of directDeps) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find(\n c => c.Name.trim().toLowerCase() === dep.name.trim().toLowerCase() && \n c.Namespace?.trim().toLowerCase() === dep.namespace?.trim().toLowerCase()\n );\n \n if (depComponent) {\n const subTree = await this.resolveDependencyTree(\n depComponent.ID, \n contextUser, \n visited\n );\n dependencies.push(subTree);\n }\n }\n \n return {\n componentId,\n name: component.Name,\n namespace: component.Namespace || undefined,\n version: component.Version,\n dependencies,\n totalCount: dependencies.reduce((sum, d) => sum + (d.totalCount || 1), 1)\n };\n }\n \n /**\n * Get components to load in dependency order\n */\n async getComponentsToLoad(\n rootComponentId: string,\n contextUser?: UserInfo\n ): Promise<string[]> {\n const tree = await this.resolveDependencyTree(rootComponentId, contextUser);\n \n // Flatten tree in dependency order (depth-first)\n const ordered: string[] = [];\n const processNode = (node: DependencyTree) => {\n if (node.dependencies) {\n node.dependencies.forEach(processNode);\n }\n if (!ordered.includes(node.componentId)) {\n ordered.push(node.componentId);\n }\n };\n processNode(tree);\n \n return ordered;\n }\n \n /**\n * Add a reference to a component\n */\n private addComponentReference(componentKey: string, referenceId: string): void {\n if (!this.componentReferences.has(componentKey)) {\n this.componentReferences.set(componentKey, new Set());\n }\n this.componentReferences.get(componentKey)!.add(referenceId);\n }\n \n /**\n * Remove a reference to a component\n */\n removeComponentReference(componentKey: string, referenceId: string): void {\n const refs = this.componentReferences.get(componentKey);\n if (refs) {\n refs.delete(referenceId);\n \n // If no more references and cache cleanup is enabled\n if (refs.size === 0) {\n this.considerCacheEviction(componentKey);\n }\n }\n }\n \n /**\n * Consider evicting a component from cache\n */\n private considerCacheEviction(componentKey: string): void {\n const cached = this.compiledComponentCache.get(componentKey);\n if (cached) {\n const timeSinceLastUse = Date.now() - cached.lastUsed.getTime();\n const evictionThreshold = 5 * 60 * 1000; // 5 minutes\n \n if (timeSinceLastUse > evictionThreshold) {\n if (this.debug) {\n console.log(`๐Ÿ—‘๏ธ Evicting unused component from cache: ${componentKey}`);\n }\n this.compiledComponentCache.delete(componentKey);\n }\n }\n }\n \n /**\n * Get API key for a registry from secure configuration\n * @param registryId - Registry ID\n * @returns API key or undefined\n */\n private getRegistryApiKey(registryId: string): string | undefined {\n // API keys should be stored in environment variables or secure configuration\n // Format: REGISTRY_API_KEY_{registryId} or similar\n // This is a placeholder - actual implementation would depend on the security infrastructure\n const envKey = `REGISTRY_API_KEY_${registryId.replace(/-/g, '_').toUpperCase()}`;\n return process.env[envKey];\n }\n \n /**\n * Get cache statistics\n */\n getCacheStats(): {\n compiledComponents: number;\n totalUseCount: number;\n memoryEstimate: string;\n } {\n let totalUseCount = 0;\n this.compiledComponentCache.forEach(cached => {\n totalUseCount += cached.useCount;\n });\n \n return {\n compiledComponents: this.compiledComponentCache.size,\n totalUseCount,\n memoryEstimate: `~${(this.compiledComponentCache.size * 50)}KB` // Rough estimate\n };\n }\n \n /**\n * Clear all caches\n */\n clearCache(): void {\n if (this.debug) {\n console.log('๐Ÿงน Clearing all component caches');\n }\n this.compiledComponentCache.clear();\n this.componentReferences.clear();\n }\n \n /**\n * Generate a cache key for a component\n */\n private getComponentKey(\n name: string, \n namespace: string | null | undefined, \n version: string, \n sourceRegistryId: string | null | undefined\n ): string {\n const registryPart = sourceRegistryId || 'local';\n const namespacePart = namespace || 'global';\n return `${registryPart}/${namespacePart}/${name}@${version}`;\n }\n}"]}
@@ -1,16 +1,17 @@
1
1
  import { ComponentMetadata, RegistryConfig } from '../types';
2
+ import { ComponentObject } from '@memberjunction/interactive-component-types';
2
3
  export declare class ComponentRegistry {
3
4
  private registry;
4
5
  private config;
5
6
  private cleanupTimer?;
6
7
  private registryId;
7
8
  constructor(config?: Partial<RegistryConfig>);
8
- register(name: string, component: any, namespace?: string, version?: string, tags?: string[]): ComponentMetadata;
9
- get(name: string, namespace?: string, version?: string): any;
9
+ register(name: string, component: ComponentObject, namespace?: string, version?: string, tags?: string[]): ComponentMetadata;
10
+ get(name: string, namespace?: string, version?: string): ComponentObject | undefined;
10
11
  has(name: string, namespace?: string, version?: string): boolean;
11
12
  unregister(name: string, namespace?: string, version?: string): boolean;
12
13
  getNamespace(namespace: string): ComponentMetadata[];
13
- getAll(namespace?: string, version?: string): Record<string, any>;
14
+ getAll(namespace?: string, version?: string): Record<string, ComponentObject>;
14
15
  getNamespaces(): string[];
15
16
  getByTags(tags: string[]): ComponentMetadata[];
16
17
  release(name: string, namespace?: string, version?: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/registry/component-registry.ts"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