@memberjunction/react-runtime 3.4.0 → 4.0.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 (76) hide show
  1. package/.turbo/turbo-build.log +33 -25
  2. package/CHANGELOG.md +28 -0
  3. package/dist/324.runtime.umd.js +817 -0
  4. package/dist/490.runtime.umd.js +1 -0
  5. package/dist/compiler/babel-config.js +15 -21
  6. package/dist/compiler/babel-config.js.map +1 -1
  7. package/dist/compiler/component-compiler.js +13 -17
  8. package/dist/compiler/component-compiler.js.map +1 -1
  9. package/dist/compiler/index.js +2 -13
  10. package/dist/compiler/index.js.map +1 -1
  11. package/dist/component-manager/component-manager.js +7 -34
  12. package/dist/component-manager/component-manager.js.map +1 -1
  13. package/dist/component-manager/index.js +1 -5
  14. package/dist/component-manager/index.js.map +1 -1
  15. package/dist/component-manager/types.js +1 -2
  16. package/dist/index.js +31 -100
  17. package/dist/index.js.map +1 -1
  18. package/dist/registry/component-registry-service.js +8 -35
  19. package/dist/registry/component-registry-service.js.map +1 -1
  20. package/dist/registry/component-registry.js +5 -9
  21. package/dist/registry/component-registry.js.map +1 -1
  22. package/dist/registry/component-resolver.js +5 -9
  23. package/dist/registry/component-resolver.js.map +1 -1
  24. package/dist/registry/index.js +4 -11
  25. package/dist/registry/index.js.map +1 -1
  26. package/dist/registry/registry-provider.js +1 -2
  27. package/dist/runtime/component-hierarchy.js +24 -55
  28. package/dist/runtime/component-hierarchy.js.map +1 -1
  29. package/dist/runtime/component-wrapper.d.ts +18 -0
  30. package/dist/runtime/component-wrapper.d.ts.map +1 -0
  31. package/dist/runtime/component-wrapper.js +108 -0
  32. package/dist/runtime/error-boundary.js +4 -11
  33. package/dist/runtime/error-boundary.js.map +1 -1
  34. package/dist/runtime/index.js +4 -26
  35. package/dist/runtime/index.js.map +1 -1
  36. package/dist/runtime/prop-builder.js +17 -28
  37. package/dist/runtime/prop-builder.js.map +1 -1
  38. package/dist/runtime/react-root-manager.js +4 -8
  39. package/dist/runtime/react-root-manager.js.map +1 -1
  40. package/dist/runtime.umd.js +1 -801
  41. package/dist/types/dependency-types.js +1 -2
  42. package/dist/types/index.js +2 -18
  43. package/dist/types/index.js.map +1 -1
  44. package/dist/types/library-config.js +1 -2
  45. package/dist/utilities/cache-manager.js +1 -5
  46. package/dist/utilities/cache-manager.js.map +1 -1
  47. package/dist/utilities/component-error-analyzer.js +53 -57
  48. package/dist/utilities/component-error-analyzer.js.map +1 -1
  49. package/dist/utilities/component-styles.js +2 -6
  50. package/dist/utilities/component-styles.js.map +1 -1
  51. package/dist/utilities/component-unwrapper.d.ts.map +1 -1
  52. package/dist/utilities/component-unwrapper.js +6 -13
  53. package/dist/utilities/component-unwrapper.js.map +1 -1
  54. package/dist/utilities/core-libraries.js +2 -7
  55. package/dist/utilities/core-libraries.js.map +1 -1
  56. package/dist/utilities/index.js +9 -25
  57. package/dist/utilities/index.js.map +1 -1
  58. package/dist/utilities/library-dependency-resolver.js +1 -5
  59. package/dist/utilities/library-dependency-resolver.js.map +1 -1
  60. package/dist/utilities/library-loader.js +23 -27
  61. package/dist/utilities/library-loader.js.map +1 -1
  62. package/dist/utilities/library-registry.d.ts.map +1 -1
  63. package/dist/utilities/library-registry.js +3 -7
  64. package/dist/utilities/library-registry.js.map +1 -1
  65. package/dist/utilities/resource-manager.d.ts +0 -1
  66. package/dist/utilities/resource-manager.d.ts.map +1 -1
  67. package/dist/utilities/resource-manager.js +2 -6
  68. package/dist/utilities/resource-manager.js.map +1 -1
  69. package/dist/utilities/runtime-utilities.d.ts +10 -0
  70. package/dist/utilities/runtime-utilities.d.ts.map +1 -0
  71. package/dist/utilities/runtime-utilities.js +92 -0
  72. package/dist/utilities/standard-libraries.js +3 -8
  73. package/dist/utilities/standard-libraries.js.map +1 -1
  74. package/package.json +17 -17
  75. package/tsconfig.json +7 -22
  76. package/tsconfig.tsbuildinfo +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"component-manager.js","sourceRoot":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,CAAC;YACnC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAKO,eAAe,CAAC,IAAmB,EAAE,OAAoB;QAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;QAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,gBAAgB,IAAI,QAAQ,CAAC;QACzE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,cAAc,IAAI,QAAQ,CAAC;QACnE,OAAO,GAAG,QAAQ,IAAI,SAAS,IAAI,IAAI,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC;IAC5D,CAAC;IAKD,UAAU;QACR,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACjC,CAAC;IAKD,aAAa;QAKX,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI;YACpC,kBAAkB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI;YACnD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI;SACxC,CAAC;IACJ,CAAC;IAKO,GAAG,CAAC,OAAe,EAAE,IAAU;QACrC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,yBAAyB,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF;AAzvBD,4CAyvBC","sourcesContent":["/**\n * @fileoverview Unified Component Manager implementation\n * Handles all component operations efficiently with proper caching and registry tracking\n */\n\nimport { ComponentSpec, ComponentLibraryDependency } from '@memberjunction/interactive-component-types';\nimport { UserInfo, Metadata, LogError } from '@memberjunction/core';\nimport { ComponentMetadataEngine, ComponentLibraryEntity, ComponentEntityExtended } from '@memberjunction/core-entities';\n\nimport { ComponentCompiler } from '../compiler';\nimport { ComponentRegistry } from '../registry';\nimport { RuntimeContext, ComponentObject } from '../types';\nimport {\n LoadOptions,\n LoadResult,\n HierarchyResult,\n ComponentManagerConfig,\n CacheEntry,\n ResolutionMode\n} from './types';\n\n/**\n * Unified component management system that handles all component operations\n * efficiently with proper caching and registry tracking.\n */\nexport class ComponentManager {\n private compiler: ComponentCompiler;\n private registry: ComponentRegistry;\n private runtimeContext: RuntimeContext;\n private config: ComponentManagerConfig;\n \n // Caching\n private fetchCache: Map<string, CacheEntry> = new Map();\n private registryNotifications: Set<string> = new Set();\n private loadingPromises: Map<string, Promise<LoadResult>> = new Map();\n \n // Metadata engine\n private componentEngine = ComponentMetadataEngine.Instance;\n private graphQLClient: any = null;\n \n constructor(\n compiler: ComponentCompiler,\n registry: ComponentRegistry,\n runtimeContext: RuntimeContext,\n config: ComponentManagerConfig = {}\n ) {\n this.compiler = compiler;\n this.registry = registry;\n this.runtimeContext = runtimeContext;\n this.config = {\n debug: false,\n maxCacheSize: 100,\n cacheTTL: 3600000, // 1 hour\n enableUsageTracking: true,\n dependencyBatchSize: 5,\n fetchTimeout: 30000,\n ...config\n };\n \n this.log('ComponentManager initialized', {\n debug: this.config.debug,\n cacheTTL: this.config.cacheTTL,\n usageTracking: this.config.enableUsageTracking\n });\n }\n \n /**\n * Main entry point - intelligently handles all component operations\n */\n async loadComponent(\n spec: ComponentSpec,\n options: LoadOptions = {}\n ): Promise<LoadResult> {\n const startTime = Date.now();\n const componentKey = this.getComponentKey(spec, options);\n \n this.log(`Loading component: ${spec.name}`, { \n key: componentKey, \n location: spec.location,\n registry: spec.registry,\n forceRefresh: options.forceRefresh \n });\n \n // Check if already loading to prevent duplicate work\n const existingPromise = this.loadingPromises.get(componentKey);\n if (existingPromise && !options.forceRefresh) {\n this.log(`Component already loading: ${spec.name}, waiting...`);\n return existingPromise;\n }\n \n // Create loading promise\n const loadPromise = this.doLoadComponent(spec, options, componentKey, startTime);\n this.loadingPromises.set(componentKey, loadPromise);\n \n try {\n const result = await loadPromise;\n return result;\n } finally {\n this.loadingPromises.delete(componentKey);\n }\n }\n \n /**\n * Internal method that does the actual loading\n */\n private async doLoadComponent(\n spec: ComponentSpec,\n options: LoadOptions,\n componentKey: string,\n startTime: number\n ): Promise<LoadResult> {\n const errors: LoadResult['errors'] = [];\n \n try {\n // STEP 1: Check if already loaded in ComponentRegistry\n const namespace = spec.namespace || options.defaultNamespace || 'Global';\n const version = spec.version || options.defaultVersion || 'latest';\n \n const existing = this.registry.get(spec.name, namespace, version);\n if (existing && !options.forceRefresh && !options.forceRecompile) {\n this.log(`Component found in registry: ${spec.name}`);\n \n // Still need to notify registry for usage tracking\n if (options.trackUsage !== false) {\n await this.notifyRegistryUsageIfNeeded(spec, componentKey);\n }\n \n // Get cached spec if available\n const cachedEntry = this.fetchCache.get(componentKey);\n \n return {\n success: true,\n component: existing,\n spec: cachedEntry?.spec || spec,\n fromCache: true\n };\n }\n \n // STEP 2: Fetch full spec if needed\n let fullSpec = spec;\n if (this.needsFetch(spec)) {\n this.log(`Fetching component spec: ${spec.name}`);\n try {\n fullSpec = await this.fetchComponentSpec(spec, options.contextUser, {\n resolutionMode: options.resolutionMode\n });\n\n // Cache the fetched spec\n this.fetchCache.set(componentKey, {\n spec: fullSpec,\n fetchedAt: new Date(),\n hash: await this.calculateHash(fullSpec),\n usageNotified: false\n });\n } catch (error) {\n errors.push({\n message: `Failed to fetch component: ${error instanceof Error ? error.message : String(error)}`,\n phase: 'fetch',\n componentName: spec.name\n });\n throw error;\n }\n } else {\n // Log when we skip fetching because code is already provided\n if (spec.location === 'registry' && spec.code) {\n this.log(`Skipping fetch for registry component: ${spec.name} (code already provided)`, {\n location: spec.location,\n registry: spec.registry\n });\n }\n // Also cache the spec if it has code to avoid re-fetching\n if (spec.code && !this.fetchCache.has(componentKey)) {\n this.fetchCache.set(componentKey, {\n spec: fullSpec,\n fetchedAt: new Date(),\n hash: await this.calculateHash(fullSpec),\n usageNotified: false\n });\n }\n }\n \n // STEP 3: Notify registry of usage (exactly once per session)\n if (options.trackUsage !== false) {\n await this.notifyRegistryUsageIfNeeded(fullSpec, componentKey);\n }\n \n // STEP 4: Compile if needed\n let compiledComponent = existing;\n if (!compiledComponent || options.forceRecompile) {\n this.log(`Compiling component: ${spec.name}`);\n try {\n compiledComponent = await this.compileComponent(fullSpec, options);\n } catch (error) {\n errors.push({\n message: `Failed to compile component: ${error instanceof Error ? error.message : String(error)}`,\n phase: 'compile',\n componentName: spec.name\n });\n throw error;\n }\n }\n \n // STEP 5: Register in ComponentRegistry\n if (!existing || options.forceRefresh || options.forceRecompile) {\n this.log(`Registering component: ${spec.name}`);\n this.registry.register(\n fullSpec.name,\n compiledComponent,\n namespace,\n version\n );\n }\n \n // STEP 6: Process dependencies recursively\n const dependencies: Record<string, ComponentObject> = {};\n if (fullSpec.dependencies && fullSpec.dependencies.length > 0) {\n this.log(`Loading ${fullSpec.dependencies.length} dependencies for ${spec.name}`);\n \n // Load dependencies in batches for efficiency\n const depResults = await this.loadDependenciesBatched(\n fullSpec.dependencies,\n { ...options, isDependent: true }\n );\n \n for (const result of depResults) {\n if (result.success && result.component) {\n const depSpec = fullSpec.dependencies.find(d => \n d.name === (result.spec?.name || '')\n );\n if (depSpec) {\n dependencies[depSpec.name] = result.component;\n }\n } else if (result.errors) {\n errors.push(...result.errors);\n }\n }\n }\n \n const elapsed = Date.now() - startTime;\n this.log(`Component loaded successfully: ${spec.name} (${elapsed}ms)`, {\n fromCache: false,\n dependencyCount: Object.keys(dependencies).length\n });\n \n return {\n success: errors.length === 0,\n component: compiledComponent,\n spec: fullSpec,\n fromCache: false,\n dependencies,\n errors: errors.length > 0 ? errors : undefined\n };\n \n } catch (error) {\n const elapsed = Date.now() - startTime;\n this.log(`Failed to load component: ${spec.name} (${elapsed}ms)`, error);\n \n return {\n success: false,\n fromCache: false,\n errors: errors.length > 0 ? errors : [{\n message: error instanceof Error ? error.message : String(error),\n phase: 'fetch',\n componentName: spec.name\n }]\n };\n }\n }\n \n /**\n * Load a complete hierarchy efficiently\n */\n async loadHierarchy(\n rootSpec: ComponentSpec,\n options: LoadOptions = {}\n ): Promise<HierarchyResult> {\n const startTime = Date.now();\n const loaded: string[] = [];\n const errors: HierarchyResult['errors'] = [];\n const components: Record<string, ComponentObject> = {};\n const stats = {\n fromCache: 0,\n fetched: 0,\n compiled: 0,\n totalTime: 0\n };\n \n this.log(`Loading component hierarchy: ${rootSpec.name}`, {\n location: rootSpec.location,\n registry: rootSpec.registry\n });\n \n try {\n // Initialize component engine if needed (skip in browser context where it doesn't exist)\n if (this.componentEngine && typeof this.componentEngine.Config === 'function') {\n await this.componentEngine.Config(false, options.contextUser);\n }\n \n // Load the root component and all its dependencies\n const result = await this.loadComponentRecursive(\n rootSpec,\n options,\n loaded,\n errors,\n components,\n stats,\n new Set()\n );\n \n stats.totalTime = Date.now() - startTime;\n \n this.log(`Hierarchy loaded: ${rootSpec.name}`, {\n success: errors.length === 0,\n loadedCount: loaded.length,\n errors: errors.length,\n ...stats\n });\n \n // Unwrap components before returning\n // Components are ComponentObject wrappers, but consumers expect just the React components\n const unwrappedComponents: Record<string, ComponentObject> = {};\n for (const [name, componentObject] of Object.entries(components)) {\n if (componentObject && typeof componentObject === 'object' && 'component' in componentObject) {\n // Extract the actual React component function\n unwrappedComponents[name] = (componentObject as any).component;\n } else {\n // Already a function or something else - use as-is\n unwrappedComponents[name] = componentObject;\n }\n }\n \n return {\n success: errors.length === 0,\n rootComponent: result.component,\n resolvedSpec: result.spec,\n loadedComponents: loaded,\n errors,\n components: unwrappedComponents,\n stats\n };\n \n } catch (error) {\n stats.totalTime = Date.now() - startTime;\n \n this.log(`Failed to load hierarchy: ${rootSpec.name}`, error);\n \n return {\n success: false,\n loadedComponents: loaded,\n errors: [...errors, {\n message: error instanceof Error ? error.message : String(error),\n phase: 'fetch',\n componentName: rootSpec.name\n }],\n stats\n };\n }\n }\n \n /**\n * Recursively load a component and its dependencies\n */\n private async loadComponentRecursive(\n spec: ComponentSpec,\n options: LoadOptions,\n loaded: string[],\n errors: HierarchyResult['errors'],\n components: Record<string, ComponentObject>,\n stats: HierarchyResult['stats'],\n visited: Set<string>\n ): Promise<LoadResult> {\n const componentKey = this.getComponentKey(spec, options);\n \n // Prevent circular dependencies\n if (visited.has(componentKey)) {\n this.log(`Circular dependency detected: ${spec.name}`);\n return {\n success: true,\n component: components[spec.name],\n spec,\n fromCache: true\n };\n }\n visited.add(componentKey);\n \n // Load this component\n const result = await this.loadComponent(spec, options);\n \n if (result.success && result.component) {\n loaded.push(spec.name);\n components[spec.name] = result.component;\n \n // Update stats\n if (stats) {\n if (result.fromCache) stats.fromCache++;\n else {\n stats.fetched++;\n stats.compiled++;\n }\n }\n \n // Load dependencies\n if (result.spec?.dependencies) {\n for (const dep of result.spec.dependencies) {\n // Normalize dependency spec for local registry lookup\n const depSpec = { ...dep };\n // OPTIMIZATION: If the dependency already has code (from registry population),\n // we can skip fetching and go straight to compilation\n if (depSpec.code) {\n this.log(`Dependency ${depSpec.name} already has code (from registry population), optimizing load`);\n }\n\n // If location is \"registry\" with undefined registry, ensure it's treated as local\n // This follows the convention that registry components with undefined registry\n // should be looked up in the local ComponentMetadataEngine\n if (depSpec.location === 'registry' && !depSpec.registry) {\n // Explicitly set to undefined for clarity (it may already be undefined)\n depSpec.registry = undefined;\n\n // Log for debugging\n this.log(`Dependency ${depSpec.name} is a local registry component (registry=undefined)`);\n }\n\n await this.loadComponentRecursive(\n depSpec,\n { ...options, isDependent: true },\n loaded,\n errors,\n components,\n stats,\n visited\n );\n }\n }\n } else if (result.errors) {\n errors.push(...result.errors);\n }\n \n return result;\n }\n \n /**\n * Load dependencies in batches for efficiency\n */\n private async loadDependenciesBatched(\n dependencies: ComponentSpec[],\n options: LoadOptions\n ): Promise<LoadResult[]> {\n const batchSize = this.config.dependencyBatchSize || 5;\n const results: LoadResult[] = [];\n \n for (let i = 0; i < dependencies.length; i += batchSize) {\n const batch = dependencies.slice(i, i + batchSize);\n const batchPromises = batch.map(dep => this.loadComponent(dep, options));\n const batchResults = await Promise.all(batchPromises);\n results.push(...batchResults);\n }\n \n return results;\n }\n \n /**\n * Check if a component needs to be fetched from a registry\n */\n private needsFetch(spec: ComponentSpec): boolean {\n // Need to fetch if:\n // 1. It's a registry component without code\n // 2. It's missing required fields\n return spec.location === 'registry' && !spec.code;\n }\n \n /**\n * Fetch a component specification from a registry (local or external)\n * \n * Convention: When location === 'registry' and registry === undefined,\n * the component is looked up in the local ComponentMetadataEngine.\n * This allows components to reference local registry components without\n * having to know if they're embedded or registry-based.\n */\n private async fetchComponentSpec(\n spec: ComponentSpec,\n contextUser?: UserInfo,\n options?: { resolutionMode?: ResolutionMode }\n ): Promise<ComponentSpec> {\n // Check cache first\n const cacheKey = this.getComponentKey(spec, {});\n const cached = this.fetchCache.get(cacheKey);\n \n if (cached && this.isCacheValid(cached)) {\n this.log(`Using cached spec for: ${spec.name}`);\n return cached.spec;\n }\n \n // Handle LOCAL registry components (registry is null/undefined)\n if (!spec.registry) {\n this.log(`Fetching from local registry: ${spec.name}`);\n \n // Find component in local ComponentMetadataEngine\n const localComponent = this.componentEngine.Components?.find(\n (c: ComponentEntityExtended) => {\n // Match by name (case-insensitive for better compatibility)\n const nameMatch = c.Name?.toLowerCase() === spec.name?.toLowerCase();\n \n // Match by namespace if provided (handle different formats)\n const namespaceMatch = !spec.namespace || c.Namespace?.toLowerCase() === spec.namespace?.toLowerCase();\n\n if (nameMatch && !namespaceMatch) {\n }\n \n return nameMatch && namespaceMatch;\n }\n );\n \n if (!localComponent) {\n throw new Error(`Local component not found: ${spec.name}`);\n }\n \n // Parse specification from local component\n if (!localComponent.Specification) {\n throw new Error(`Local component ${spec.name} has no specification`);\n }\n \n const fullSpec = JSON.parse(localComponent.Specification);\n \n // Cache it\n this.fetchCache.set(cacheKey, {\n spec: fullSpec,\n fetchedAt: new Date(),\n usageNotified: false\n });\n \n return fullSpec;\n }\n \n // Handle EXTERNAL registry components (registry has a name)\n // Initialize GraphQL client if needed\n if (!this.graphQLClient) {\n await this.initializeGraphQLClient();\n }\n \n if (!this.graphQLClient) {\n throw new Error('GraphQL client not available for registry fetching');\n }\n \n // Fetch from external registry\n this.log(`Fetching from external registry: ${spec.registry}/${spec.name}`);\n \n const fullSpec = await this.graphQLClient.GetRegistryComponent({\n registryName: spec.registry,\n namespace: spec.namespace || 'Global',\n name: spec.name,\n version: spec.version || 'latest'\n });\n \n if (!fullSpec) {\n throw new Error(`Component not found in registry: ${spec.registry}/${spec.name}`);\n }\n \n // Apply resolution mode if specified\n const processedSpec = this.applyResolutionMode(fullSpec, spec, options?.resolutionMode);\n \n // Cache it\n this.fetchCache.set(cacheKey, {\n spec: processedSpec,\n fetchedAt: new Date(),\n usageNotified: false\n });\n \n return processedSpec;\n }\n \n /**\n * Apply resolution mode to a fetched spec (recursively including dependencies)\n */\n private applyResolutionMode(\n fullSpec: ComponentSpec,\n originalSpec: ComponentSpec,\n resolutionMode?: ResolutionMode\n ): ComponentSpec {\n let processedSpec: ComponentSpec;\n \n if (resolutionMode === 'embed') {\n // Convert to embedded format for test harness\n processedSpec = {\n ...fullSpec,\n location: 'embedded',\n registry: undefined,\n // namespace and name can stay for identification\n };\n } else {\n // Default: preserve-metadata mode\n // Keep original registry metadata but include fetched code\n processedSpec = {\n ...fullSpec,\n location: originalSpec.location,\n registry: originalSpec.registry,\n namespace: originalSpec.namespace || fullSpec.namespace,\n name: originalSpec.name || fullSpec.name\n };\n }\n \n // Recursively apply resolution mode to dependencies\n if (processedSpec.dependencies && processedSpec.dependencies.length > 0) {\n processedSpec.dependencies = processedSpec.dependencies.map(dep => {\n // For dependencies, use the dep itself as both full and original spec\n // since they've already been fetched and processed\n return this.applyResolutionMode(dep, dep, resolutionMode);\n });\n }\n \n return processedSpec;\n }\n\n /**\n * Compile a component specification\n */\n private async compileComponent(\n spec: ComponentSpec,\n options: LoadOptions\n ): Promise<ComponentObject> {\n // Get all available libraries - use passed libraries or fall back to ComponentMetadataEngine\n const allLibraries = options.allLibraries || this.componentEngine.ComponentLibraries || [];\n \n // Filter valid libraries\n const validLibraries = spec.libraries?.filter(lib => \n lib && lib.name && lib.globalVariable && \n lib.name !== 'unknown' && lib.globalVariable !== 'undefined'\n );\n \n // Compile the component\n const result = await this.compiler.compile({\n componentName: spec.name,\n componentCode: spec.code || '',\n libraries: validLibraries,\n dependencies: spec.dependencies,\n allLibraries\n });\n \n if (!result.success || !result.component) {\n throw new Error(result.error?.message || 'Compilation failed');\n }\n \n // Add loaded libraries to runtime context\n if (result.loadedLibraries && result.loadedLibraries.size > 0) {\n if (!this.runtimeContext.libraries) {\n this.runtimeContext.libraries = {};\n }\n result.loadedLibraries.forEach((value, key) => {\n this.runtimeContext.libraries![key] = value;\n });\n }\n \n // Get the component object from the factory\n const componentObject = result.component.factory(\n this.runtimeContext,\n undefined, // styles\n {} // components - will be injected by parent\n );\n \n return componentObject;\n }\n \n /**\n * Notify registry of component usage for licensing\n * Only happens once per component per session\n */\n private async notifyRegistryUsageIfNeeded(\n spec: ComponentSpec,\n componentKey: string\n ): Promise<void> {\n if (!spec.registry || !this.config.enableUsageTracking) {\n return; // Only for external registry components with tracking enabled\n }\n \n const notificationKey = `${spec.registry}:${componentKey}`;\n if (this.registryNotifications.has(notificationKey)) {\n this.log(`Usage already notified for: ${spec.name}`);\n return; // Already notified this session\n }\n \n try {\n // In the future, make lightweight usage notification call to registry\n // For now, the fetch itself serves as the notification\n this.log(`Notifying registry usage for: ${spec.name}`);\n this.registryNotifications.add(notificationKey);\n \n // Update cache entry\n const cached = this.fetchCache.get(componentKey);\n if (cached) {\n cached.usageNotified = true;\n }\n } catch (error) {\n // Log but don't fail - usage tracking shouldn't break component loading\n console.warn(`Failed to notify registry usage for ${componentKey}:`, error);\n }\n }\n \n /**\n * Initialize GraphQL client for registry operations\n */\n private async initializeGraphQLClient(): Promise<void> {\n try {\n const provider = Metadata?.Provider;\n if (provider && (provider as any).ExecuteGQL) {\n const { GraphQLComponentRegistryClient } = await import('@memberjunction/graphql-dataprovider');\n this.graphQLClient = new GraphQLComponentRegistryClient(provider as any);\n this.log('GraphQL client initialized');\n }\n } catch (error) {\n LogError(`Failed to initialize GraphQL client: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n \n /**\n * Check if a cache entry is still valid\n */\n private isCacheValid(entry: CacheEntry): boolean {\n const age = Date.now() - entry.fetchedAt.getTime();\n return age < (this.config.cacheTTL || 3600000);\n }\n \n /**\n * Calculate a hash for a component spec (for cache validation)\n */\n private async calculateHash(spec: ComponentSpec): Promise<string> {\n // Simple hash based on spec content\n const content = JSON.stringify({\n name: spec.name,\n version: spec.version,\n code: spec.code,\n libraries: spec.libraries\n });\n \n // Simple hash function (in production, use crypto)\n let hash = 0;\n for (let i = 0; i < content.length; i++) {\n const char = content.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash.toString(16);\n }\n \n /**\n * Generate a unique key for a component\n */\n private getComponentKey(spec: ComponentSpec, options: LoadOptions): string {\n const registry = spec.registry || 'local';\n const namespace = spec.namespace || options.defaultNamespace || 'Global';\n const version = spec.version || options.defaultVersion || 'latest';\n return `${registry}:${namespace}:${spec.name}:${version}`;\n }\n \n /**\n * Clear all caches\n */\n clearCache(): void {\n this.fetchCache.clear();\n this.registryNotifications.clear();\n this.loadingPromises.clear();\n this.log('All caches cleared');\n }\n \n /**\n * Get cache statistics\n */\n getCacheStats(): {\n fetchCacheSize: number;\n notificationsCount: number;\n loadingCount: number;\n } {\n return {\n fetchCacheSize: this.fetchCache.size,\n notificationsCount: this.registryNotifications.size,\n loadingCount: this.loadingPromises.size\n };\n }\n \n /**\n * Log a message if debug is enabled\n */\n private log(message: string, data?: any): void {\n if (this.config.debug) {\n console.log(`🎯 [ComponentManager] ${message}`, data || '');\n }\n }\n}"]}
1
+ {"version":3,"file":"component-manager.js","sourceRoot":"","sources":["../../src/component-manager/component-manager.ts"],"names":[],"mappings":"AAMA,OAAO,EAAY,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAmD,MAAM,+BAA+B,CAAC;AAkBzH,MAAM,OAAO,gBAAgB;IAe3B,YACE,QAA2B,EAC3B,QAA2B,EAC3B,cAA8B,EAC9B,SAAiC,EAAE;QAZ7B,eAAU,GAA4B,IAAI,GAAG,EAAE,CAAC;QAChD,0BAAqB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAC/C,oBAAe,GAAqC,IAAI,GAAG,EAAE,CAAC;QAG9D,oBAAe,GAAG,uBAAuB,CAAC,QAAQ,CAAC;QACnD,kBAAa,GAAQ,IAAI,CAAC;QAQhC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG;YACZ,KAAK,EAAE,KAAK;YACZ,YAAY,EAAE,GAAG;YACjB,QAAQ,EAAE,OAAO;YACjB,mBAAmB,EAAE,IAAI;YACzB,mBAAmB,EAAE,CAAC;YACtB,YAAY,EAAE,KAAK;YACnB,GAAG,MAAM;SACV,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE;YACvC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;YACxB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC9B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB;SAC/C,CAAC,CAAC;IACL,CAAC;IAKD,KAAK,CAAC,aAAa,CACjB,IAAmB,EACnB,UAAuB,EAAE;QAEzB,MAAM,SAAS,GAAG,IAAI,CAA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AAE,IAAI,IAAI,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * @fileoverview Unified Component Manager implementation\n * Handles all component operations efficiently with proper caching and registry tracking\n */\n\nimport { ComponentSpec, ComponentLibraryDependency } from '@memberjunction/interactive-component-types';\nimport { UserInfo, Metadata, LogError } from '@memberjunction/core';\nimport { ComponentMetadataEngine, ComponentLibraryEntity, ComponentEntityExtended } from '@memberjunction/core-entities';\n\nimport { ComponentCompiler } from '../compiler';\nimport { ComponentRegistry } from '../registry';\nimport { RuntimeContext, ComponentObject } from '../types';\nimport {\n LoadOptions,\n LoadResult,\n HierarchyResult,\n ComponentManagerConfig,\n CacheEntry,\n ResolutionMode\n} from './types';\n\n/**\n * Unified component management system that handles all component operations\n * efficiently with proper caching and registry tracking.\n */\nexport class ComponentManager {\n private compiler: ComponentCompiler;\n private registry: ComponentRegistry;\n private runtimeContext: RuntimeContext;\n private config: ComponentManagerConfig;\n \n // Caching\n private fetchCache: Map<string, CacheEntry> = new Map();\n private registryNotifications: Set<string> = new Set();\n private loadingPromises: Map<string, Promise<LoadResult>> = new Map();\n \n // Metadata engine\n private componentEngine = ComponentMetadataEngine.Instance;\n private graphQLClient: any = null;\n \n constructor(\n compiler: ComponentCompiler,\n registry: ComponentRegistry,\n runtimeContext: RuntimeContext,\n config: ComponentManagerConfig = {}\n ) {\n this.compiler = compiler;\n this.registry = registry;\n this.runtimeContext = runtimeContext;\n this.config = {\n debug: false,\n maxCacheSize: 100,\n cacheTTL: 3600000, // 1 hour\n enableUsageTracking: true,\n dependencyBatchSize: 5,\n fetchTimeout: 30000,\n ...config\n };\n \n this.log('ComponentManager initialized', {\n debug: this.config.debug,\n cacheTTL: this.config.cacheTTL,\n usageTracking: this.config.enableUsageTracking\n });\n }\n \n /**\n * Main entry point - intelligently handles all component operations\n */\n async loadComponent(\n spec: ComponentSpec,\n options: LoadOptions = {}\n ): Promise<LoadResult> {\n const startTime = Date.now();\n const componentKey = this.getComponentKey(spec, options);\n \n this.log(`Loading component: ${spec.name}`, { \n key: componentKey, \n location: spec.location,\n registry: spec.registry,\n forceRefresh: options.forceRefresh \n });\n \n // Check if already loading to prevent duplicate work\n const existingPromise = this.loadingPromises.get(componentKey);\n if (existingPromise && !options.forceRefresh) {\n this.log(`Component already loading: ${spec.name}, waiting...`);\n return existingPromise;\n }\n \n // Create loading promise\n const loadPromise = this.doLoadComponent(spec, options, componentKey, startTime);\n this.loadingPromises.set(componentKey, loadPromise);\n \n try {\n const result = await loadPromise;\n return result;\n } finally {\n this.loadingPromises.delete(componentKey);\n }\n }\n \n /**\n * Internal method that does the actual loading\n */\n private async doLoadComponent(\n spec: ComponentSpec,\n options: LoadOptions,\n componentKey: string,\n startTime: number\n ): Promise<LoadResult> {\n const errors: LoadResult['errors'] = [];\n \n try {\n // STEP 1: Check if already loaded in ComponentRegistry\n const namespace = spec.namespace || options.defaultNamespace || 'Global';\n const version = spec.version || options.defaultVersion || 'latest';\n \n const existing = this.registry.get(spec.name, namespace, version);\n if (existing && !options.forceRefresh && !options.forceRecompile) {\n this.log(`Component found in registry: ${spec.name}`);\n \n // Still need to notify registry for usage tracking\n if (options.trackUsage !== false) {\n await this.notifyRegistryUsageIfNeeded(spec, componentKey);\n }\n \n // Get cached spec if available\n const cachedEntry = this.fetchCache.get(componentKey);\n \n return {\n success: true,\n component: existing,\n spec: cachedEntry?.spec || spec,\n fromCache: true\n };\n }\n \n // STEP 2: Fetch full spec if needed\n let fullSpec = spec;\n if (this.needsFetch(spec)) {\n this.log(`Fetching component spec: ${spec.name}`);\n try {\n fullSpec = await this.fetchComponentSpec(spec, options.contextUser, {\n resolutionMode: options.resolutionMode\n });\n\n // Cache the fetched spec\n this.fetchCache.set(componentKey, {\n spec: fullSpec,\n fetchedAt: new Date(),\n hash: await this.calculateHash(fullSpec),\n usageNotified: false\n });\n } catch (error) {\n errors.push({\n message: `Failed to fetch component: ${error instanceof Error ? error.message : String(error)}`,\n phase: 'fetch',\n componentName: spec.name\n });\n throw error;\n }\n } else {\n // Log when we skip fetching because code is already provided\n if (spec.location === 'registry' && spec.code) {\n this.log(`Skipping fetch for registry component: ${spec.name} (code already provided)`, {\n location: spec.location,\n registry: spec.registry\n });\n }\n // Also cache the spec if it has code to avoid re-fetching\n if (spec.code && !this.fetchCache.has(componentKey)) {\n this.fetchCache.set(componentKey, {\n spec: fullSpec,\n fetchedAt: new Date(),\n hash: await this.calculateHash(fullSpec),\n usageNotified: false\n });\n }\n }\n \n // STEP 3: Notify registry of usage (exactly once per session)\n if (options.trackUsage !== false) {\n await this.notifyRegistryUsageIfNeeded(fullSpec, componentKey);\n }\n \n // STEP 4: Compile if needed\n let compiledComponent = existing;\n if (!compiledComponent || options.forceRecompile) {\n this.log(`Compiling component: ${spec.name}`);\n try {\n compiledComponent = await this.compileComponent(fullSpec, options);\n } catch (error) {\n errors.push({\n message: `Failed to compile component: ${error instanceof Error ? error.message : String(error)}`,\n phase: 'compile',\n componentName: spec.name\n });\n throw error;\n }\n }\n \n // STEP 5: Register in ComponentRegistry\n if (!existing || options.forceRefresh || options.forceRecompile) {\n this.log(`Registering component: ${spec.name}`);\n this.registry.register(\n fullSpec.name,\n compiledComponent,\n namespace,\n version\n );\n }\n \n // STEP 6: Process dependencies recursively\n const dependencies: Record<string, ComponentObject> = {};\n if (fullSpec.dependencies && fullSpec.dependencies.length > 0) {\n this.log(`Loading ${fullSpec.dependencies.length} dependencies for ${spec.name}`);\n \n // Load dependencies in batches for efficiency\n const depResults = await this.loadDependenciesBatched(\n fullSpec.dependencies,\n { ...options, isDependent: true }\n );\n \n for (const result of depResults) {\n if (result.success && result.component) {\n const depSpec = fullSpec.dependencies.find(d => \n d.name === (result.spec?.name || '')\n );\n if (depSpec) {\n dependencies[depSpec.name] = result.component;\n }\n } else if (result.errors) {\n errors.push(...result.errors);\n }\n }\n }\n \n const elapsed = Date.now() - startTime;\n this.log(`Component loaded successfully: ${spec.name} (${elapsed}ms)`, {\n fromCache: false,\n dependencyCount: Object.keys(dependencies).length\n });\n \n return {\n success: errors.length === 0,\n component: compiledComponent,\n spec: fullSpec,\n fromCache: false,\n dependencies,\n errors: errors.length > 0 ? errors : undefined\n };\n \n } catch (error) {\n const elapsed = Date.now() - startTime;\n this.log(`Failed to load component: ${spec.name} (${elapsed}ms)`, error);\n \n return {\n success: false,\n fromCache: false,\n errors: errors.length > 0 ? errors : [{\n message: error instanceof Error ? error.message : String(error),\n phase: 'fetch',\n componentName: spec.name\n }]\n };\n }\n }\n \n /**\n * Load a complete hierarchy efficiently\n */\n async loadHierarchy(\n rootSpec: ComponentSpec,\n options: LoadOptions = {}\n ): Promise<HierarchyResult> {\n const startTime = Date.now();\n const loaded: string[] = [];\n const errors: HierarchyResult['errors'] = [];\n const components: Record<string, ComponentObject> = {};\n const stats = {\n fromCache: 0,\n fetched: 0,\n compiled: 0,\n totalTime: 0\n };\n \n this.log(`Loading component hierarchy: ${rootSpec.name}`, {\n location: rootSpec.location,\n registry: rootSpec.registry\n });\n \n try {\n // Initialize component engine if needed (skip in browser context where it doesn't exist)\n if (this.componentEngine && typeof this.componentEngine.Config === 'function') {\n await this.componentEngine.Config(false, options.contextUser);\n }\n \n // Load the root component and all its dependencies\n const result = await this.loadComponentRecursive(\n rootSpec,\n options,\n loaded,\n errors,\n components,\n stats,\n new Set()\n );\n \n stats.totalTime = Date.now() - startTime;\n \n this.log(`Hierarchy loaded: ${rootSpec.name}`, {\n success: errors.length === 0,\n loadedCount: loaded.length,\n errors: errors.length,\n ...stats\n });\n \n // Unwrap components before returning\n // Components are ComponentObject wrappers, but consumers expect just the React components\n const unwrappedComponents: Record<string, ComponentObject> = {};\n for (const [name, componentObject] of Object.entries(components)) {\n if (componentObject && typeof componentObject === 'object' && 'component' in componentObject) {\n // Extract the actual React component function\n unwrappedComponents[name] = (componentObject as any).component;\n } else {\n // Already a function or something else - use as-is\n unwrappedComponents[name] = componentObject;\n }\n }\n \n return {\n success: errors.length === 0,\n rootComponent: result.component,\n resolvedSpec: result.spec,\n loadedComponents: loaded,\n errors,\n components: unwrappedComponents,\n stats\n };\n \n } catch (error) {\n stats.totalTime = Date.now() - startTime;\n \n this.log(`Failed to load hierarchy: ${rootSpec.name}`, error);\n \n return {\n success: false,\n loadedComponents: loaded,\n errors: [...errors, {\n message: error instanceof Error ? error.message : String(error),\n phase: 'fetch',\n componentName: rootSpec.name\n }],\n stats\n };\n }\n }\n \n /**\n * Recursively load a component and its dependencies\n */\n private async loadComponentRecursive(\n spec: ComponentSpec,\n options: LoadOptions,\n loaded: string[],\n errors: HierarchyResult['errors'],\n components: Record<string, ComponentObject>,\n stats: HierarchyResult['stats'],\n visited: Set<string>\n ): Promise<LoadResult> {\n const componentKey = this.getComponentKey(spec, options);\n \n // Prevent circular dependencies\n if (visited.has(componentKey)) {\n this.log(`Circular dependency detected: ${spec.name}`);\n return {\n success: true,\n component: components[spec.name],\n spec,\n fromCache: true\n };\n }\n visited.add(componentKey);\n \n // Load this component\n const result = await this.loadComponent(spec, options);\n \n if (result.success && result.component) {\n loaded.push(spec.name);\n components[spec.name] = result.component;\n \n // Update stats\n if (stats) {\n if (result.fromCache) stats.fromCache++;\n else {\n stats.fetched++;\n stats.compiled++;\n }\n }\n \n // Load dependencies\n if (result.spec?.dependencies) {\n for (const dep of result.spec.dependencies) {\n // Normalize dependency spec for local registry lookup\n const depSpec = { ...dep };\n // OPTIMIZATION: If the dependency already has code (from registry population),\n // we can skip fetching and go straight to compilation\n if (depSpec.code) {\n this.log(`Dependency ${depSpec.name} already has code (from registry population), optimizing load`);\n }\n\n // If location is \"registry\" with undefined registry, ensure it's treated as local\n // This follows the convention that registry components with undefined registry\n // should be looked up in the local ComponentMetadataEngine\n if (depSpec.location === 'registry' && !depSpec.registry) {\n // Explicitly set to undefined for clarity (it may already be undefined)\n depSpec.registry = undefined;\n\n // Log for debugging\n this.log(`Dependency ${depSpec.name} is a local registry component (registry=undefined)`);\n }\n\n await this.loadComponentRecursive(\n depSpec,\n { ...options, isDependent: true },\n loaded,\n errors,\n components,\n stats,\n visited\n );\n }\n }\n } else if (result.errors) {\n errors.push(...result.errors);\n }\n \n return result;\n }\n \n /**\n * Load dependencies in batches for efficiency\n */\n private async loadDependenciesBatched(\n dependencies: ComponentSpec[],\n options: LoadOptions\n ): Promise<LoadResult[]> {\n const batchSize = this.config.dependencyBatchSize || 5;\n const results: LoadResult[] = [];\n \n for (let i = 0; i < dependencies.length; i += batchSize) {\n const batch = dependencies.slice(i, i + batchSize);\n const batchPromises = batch.map(dep => this.loadComponent(dep, options));\n const batchResults = await Promise.all(batchPromises);\n results.push(...batchResults);\n }\n \n return results;\n }\n \n /**\n * Check if a component needs to be fetched from a registry\n */\n private needsFetch(spec: ComponentSpec): boolean {\n // Need to fetch if:\n // 1. It's a registry component without code\n // 2. It's missing required fields\n return spec.location === 'registry' && !spec.code;\n }\n \n /**\n * Fetch a component specification from a registry (local or external)\n * \n * Convention: When location === 'registry' and registry === undefined,\n * the component is looked up in the local ComponentMetadataEngine.\n * This allows components to reference local registry components without\n * having to know if they're embedded or registry-based.\n */\n private async fetchComponentSpec(\n spec: ComponentSpec,\n contextUser?: UserInfo,\n options?: { resolutionMode?: ResolutionMode }\n ): Promise<ComponentSpec> {\n // Check cache first\n const cacheKey = this.getComponentKey(spec, {});\n const cached = this.fetchCache.get(cacheKey);\n \n if (cached && this.isCacheValid(cached)) {\n this.log(`Using cached spec for: ${spec.name}`);\n return cached.spec;\n }\n \n // Handle LOCAL registry components (registry is null/undefined)\n if (!spec.registry) {\n this.log(`Fetching from local registry: ${spec.name}`);\n \n // Find component in local ComponentMetadataEngine\n const localComponent = this.componentEngine.Components?.find(\n (c: ComponentEntityExtended) => {\n // Match by name (case-insensitive for better compatibility)\n const nameMatch = c.Name?.toLowerCase() === spec.name?.toLowerCase();\n \n // Match by namespace if provided (handle different formats)\n const namespaceMatch = !spec.namespace || c.Namespace?.toLowerCase() === spec.namespace?.toLowerCase();\n\n if (nameMatch && !namespaceMatch) {\n }\n \n return nameMatch && namespaceMatch;\n }\n );\n \n if (!localComponent) {\n throw new Error(`Local component not found: ${spec.name}`);\n }\n \n // Parse specification from local component\n if (!localComponent.Specification) {\n throw new Error(`Local component ${spec.name} has no specification`);\n }\n \n const fullSpec = JSON.parse(localComponent.Specification);\n \n // Cache it\n this.fetchCache.set(cacheKey, {\n spec: fullSpec,\n fetchedAt: new Date(),\n usageNotified: false\n });\n \n return fullSpec;\n }\n \n // Handle EXTERNAL registry components (registry has a name)\n // Initialize GraphQL client if needed\n if (!this.graphQLClient) {\n await this.initializeGraphQLClient();\n }\n \n if (!this.graphQLClient) {\n throw new Error('GraphQL client not available for registry fetching');\n }\n \n // Fetch from external registry\n this.log(`Fetching from external registry: ${spec.registry}/${spec.name}`);\n \n const fullSpec = await this.graphQLClient.GetRegistryComponent({\n registryName: spec.registry,\n namespace: spec.namespace || 'Global',\n name: spec.name,\n version: spec.version || 'latest'\n });\n \n if (!fullSpec) {\n throw new Error(`Component not found in registry: ${spec.registry}/${spec.name}`);\n }\n \n // Apply resolution mode if specified\n const processedSpec = this.applyResolutionMode(fullSpec, spec, options?.resolutionMode);\n \n // Cache it\n this.fetchCache.set(cacheKey, {\n spec: processedSpec,\n fetchedAt: new Date(),\n usageNotified: false\n });\n \n return processedSpec;\n }\n \n /**\n * Apply resolution mode to a fetched spec (recursively including dependencies)\n */\n private applyResolutionMode(\n fullSpec: ComponentSpec,\n originalSpec: ComponentSpec,\n resolutionMode?: ResolutionMode\n ): ComponentSpec {\n let processedSpec: ComponentSpec;\n \n if (resolutionMode === 'embed') {\n // Convert to embedded format for test harness\n processedSpec = {\n ...fullSpec,\n location: 'embedded',\n registry: undefined,\n // namespace and name can stay for identification\n };\n } else {\n // Default: preserve-metadata mode\n // Keep original registry metadata but include fetched code\n processedSpec = {\n ...fullSpec,\n location: originalSpec.location,\n registry: originalSpec.registry,\n namespace: originalSpec.namespace || fullSpec.namespace,\n name: originalSpec.name || fullSpec.name\n };\n }\n \n // Recursively apply resolution mode to dependencies\n if (processedSpec.dependencies && processedSpec.dependencies.length > 0) {\n processedSpec.dependencies = processedSpec.dependencies.map(dep => {\n // For dependencies, use the dep itself as both full and original spec\n // since they've already been fetched and processed\n return this.applyResolutionMode(dep, dep, resolutionMode);\n });\n }\n \n return processedSpec;\n }\n\n /**\n * Compile a component specification\n */\n private async compileComponent(\n spec: ComponentSpec,\n options: LoadOptions\n ): Promise<ComponentObject> {\n // Get all available libraries - use passed libraries or fall back to ComponentMetadataEngine\n const allLibraries = options.allLibraries || this.componentEngine.ComponentLibraries || [];\n \n // Filter valid libraries\n const validLibraries = spec.libraries?.filter(lib => \n lib && lib.name && lib.globalVariable && \n lib.name !== 'unknown' && lib.globalVariable !== 'undefined'\n );\n \n // Compile the component\n const result = await this.compiler.compile({\n componentName: spec.name,\n componentCode: spec.code || '',\n libraries: validLibraries,\n dependencies: spec.dependencies,\n allLibraries\n });\n \n if (!result.success || !result.component) {\n throw new Error(result.error?.message || 'Compilation failed');\n }\n \n // Add loaded libraries to runtime context\n if (result.loadedLibraries && result.loadedLibraries.size > 0) {\n if (!this.runtimeContext.libraries) {\n this.runtimeContext.libraries = {};\n }\n result.loadedLibraries.forEach((value, key) => {\n this.runtimeContext.libraries![key] = value;\n });\n }\n \n // Get the component object from the factory\n const componentObject = result.component.factory(\n this.runtimeContext,\n undefined, // styles\n {} // components - will be injected by parent\n );\n \n return componentObject;\n }\n \n /**\n * Notify registry of component usage for licensing\n * Only happens once per component per session\n */\n private async notifyRegistryUsageIfNeeded(\n spec: ComponentSpec,\n componentKey: string\n ): Promise<void> {\n if (!spec.registry || !this.config.enableUsageTracking) {\n return; // Only for external registry components with tracking enabled\n }\n \n const notificationKey = `${spec.registry}:${componentKey}`;\n if (this.registryNotifications.has(notificationKey)) {\n this.log(`Usage already notified for: ${spec.name}`);\n return; // Already notified this session\n }\n \n try {\n // In the future, make lightweight usage notification call to registry\n // For now, the fetch itself serves as the notification\n this.log(`Notifying registry usage for: ${spec.name}`);\n this.registryNotifications.add(notificationKey);\n \n // Update cache entry\n const cached = this.fetchCache.get(componentKey);\n if (cached) {\n cached.usageNotified = true;\n }\n } catch (error) {\n // Log but don't fail - usage tracking shouldn't break component loading\n console.warn(`Failed to notify registry usage for ${componentKey}:`, error);\n }\n }\n \n /**\n * Initialize GraphQL client for registry operations\n */\n private async initializeGraphQLClient(): Promise<void> {\n try {\n const provider = Metadata?.Provider;\n if (provider && (provider as any).ExecuteGQL) {\n const { GraphQLComponentRegistryClient } = await import('@memberjunction/graphql-dataprovider');\n this.graphQLClient = new GraphQLComponentRegistryClient(provider as any);\n this.log('GraphQL client initialized');\n }\n } catch (error) {\n LogError(`Failed to initialize GraphQL client: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n \n /**\n * Check if a cache entry is still valid\n */\n private isCacheValid(entry: CacheEntry): boolean {\n const age = Date.now() - entry.fetchedAt.getTime();\n return age < (this.config.cacheTTL || 3600000);\n }\n \n /**\n * Calculate a hash for a component spec (for cache validation)\n */\n private async calculateHash(spec: ComponentSpec): Promise<string> {\n // Simple hash based on spec content\n const content = JSON.stringify({\n name: spec.name,\n version: spec.version,\n code: spec.code,\n libraries: spec.libraries\n });\n \n // Simple hash function (in production, use crypto)\n let hash = 0;\n for (let i = 0; i < content.length; i++) {\n const char = content.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash.toString(16);\n }\n \n /**\n * Generate a unique key for a component\n */\n private getComponentKey(spec: ComponentSpec, options: LoadOptions): string {\n const registry = spec.registry || 'local';\n const namespace = spec.namespace || options.defaultNamespace || 'Global';\n const version = spec.version || options.defaultVersion || 'latest';\n return `${registry}:${namespace}:${spec.name}:${version}`;\n }\n \n /**\n * Clear all caches\n */\n clearCache(): void {\n this.fetchCache.clear();\n this.registryNotifications.clear();\n this.loadingPromises.clear();\n this.log('All caches cleared');\n }\n \n /**\n * Get cache statistics\n */\n getCacheStats(): {\n fetchCacheSize: number;\n notificationsCount: number;\n loadingCount: number;\n } {\n return {\n fetchCacheSize: this.fetchCache.size,\n notificationsCount: this.registryNotifications.size,\n loadingCount: this.loadingPromises.size\n };\n }\n \n /**\n * Log a message if debug is enabled\n */\n private log(message: string, data?: any): void {\n if (this.config.debug) {\n console.log(`🎯 [ComponentManager] ${message}`, data || '');\n }\n }\n}"]}
@@ -1,6 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComponentManager = void 0;
4
- var component_manager_1 = require("./component-manager");
5
- Object.defineProperty(exports, "ComponentManager", { enumerable: true, get: function () { return component_manager_1.ComponentManager; } });
1
+ export { ComponentManager } from './component-manager';
6
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/component-manager/index.ts"],"names":[],"mappings":";;;AAMA,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA","sourcesContent":["/**\n * @fileoverview Unified Component Manager for MemberJunction React Runtime\n * Consolidates component fetching, compilation, registration, and usage tracking\n * into a single, efficient manager that eliminates duplicate operations.\n */\n\nexport { ComponentManager } from './component-manager';\nexport type {\n LoadOptions,\n LoadResult,\n HierarchyResult,\n ComponentManagerConfig\n} from './types';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/component-manager/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["/**\n * @fileoverview Unified Component Manager for MemberJunction React Runtime\n * Consolidates component fetching, compilation, registration, and usage tracking\n * into a single, efficient manager that eliminates duplicate operations.\n */\n\nexport { ComponentManager } from './component-manager';\nexport type {\n LoadOptions,\n LoadResult,\n HierarchyResult,\n ComponentManagerConfig\n} from './types';"]}
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
package/dist/index.js CHANGED
@@ -1,96 +1,28 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.unwrapAllComponents = exports.unwrapComponents = exports.unwrapComponent = exports.unwrapAllLibraryComponents = exports.unwrapLibraryComponents = exports.unwrapLibraryComponent = exports.CacheManager = exports.resourceManager = exports.ResourceManager = exports.ComponentErrorAnalyzer = exports.LibraryRegistry = exports.isCoreRuntimeLibrary = exports.getCoreRuntimeLibraries = exports.LibraryLoader = exports.createStandardLibraries = exports.StandardLibraryManager = exports.createDefaultComponentStyles = exports.SetupStyles = exports.reactRootManager = exports.ReactRootManager = exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = exports.ComponentManager = exports.ComponentRegistryService = exports.ComponentSpec = exports.ComponentResolver = exports.ComponentRegistry = exports.getJSXConfig = exports.validateBabelPresets = exports.getBabelConfig = exports.DEVELOPMENT_CONFIG = exports.PRODUCTION_CONFIG = exports.DEFAULT_PLUGINS = exports.DEFAULT_PRESETS = exports.ComponentCompiler = void 0;
18
- exports.createReactRuntime = exports.DEFAULT_CONFIGS = exports.VERSION = void 0;
19
- const compiler_1 = require("./compiler");
20
- const registry_1 = require("./registry");
21
- const registry_2 = require("./registry");
22
- const component_manager_1 = require("./component-manager");
23
- __exportStar(require("./types"), exports);
24
- var compiler_2 = require("./compiler");
25
- Object.defineProperty(exports, "ComponentCompiler", { enumerable: true, get: function () { return compiler_2.ComponentCompiler; } });
26
- var compiler_3 = require("./compiler");
27
- Object.defineProperty(exports, "DEFAULT_PRESETS", { enumerable: true, get: function () { return compiler_3.DEFAULT_PRESETS; } });
28
- Object.defineProperty(exports, "DEFAULT_PLUGINS", { enumerable: true, get: function () { return compiler_3.DEFAULT_PLUGINS; } });
29
- Object.defineProperty(exports, "PRODUCTION_CONFIG", { enumerable: true, get: function () { return compiler_3.PRODUCTION_CONFIG; } });
30
- Object.defineProperty(exports, "DEVELOPMENT_CONFIG", { enumerable: true, get: function () { return compiler_3.DEVELOPMENT_CONFIG; } });
31
- Object.defineProperty(exports, "getBabelConfig", { enumerable: true, get: function () { return compiler_3.getBabelConfig; } });
32
- Object.defineProperty(exports, "validateBabelPresets", { enumerable: true, get: function () { return compiler_3.validateBabelPresets; } });
33
- Object.defineProperty(exports, "getJSXConfig", { enumerable: true, get: function () { return compiler_3.getJSXConfig; } });
34
- var registry_3 = require("./registry");
35
- Object.defineProperty(exports, "ComponentRegistry", { enumerable: true, get: function () { return registry_3.ComponentRegistry; } });
36
- var registry_4 = require("./registry");
37
- Object.defineProperty(exports, "ComponentResolver", { enumerable: true, get: function () { return registry_4.ComponentResolver; } });
38
- Object.defineProperty(exports, "ComponentSpec", { enumerable: true, get: function () { return registry_4.ComponentSpec; } });
39
- Object.defineProperty(exports, "ComponentRegistryService", { enumerable: true, get: function () { return registry_4.ComponentRegistryService; } });
40
- var component_manager_2 = require("./component-manager");
41
- Object.defineProperty(exports, "ComponentManager", { enumerable: true, get: function () { return component_manager_2.ComponentManager; } });
42
- var runtime_1 = require("./runtime");
43
- Object.defineProperty(exports, "createErrorBoundary", { enumerable: true, get: function () { return runtime_1.createErrorBoundary; } });
44
- Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return runtime_1.withErrorBoundary; } });
45
- Object.defineProperty(exports, "formatComponentError", { enumerable: true, get: function () { return runtime_1.formatComponentError; } });
46
- Object.defineProperty(exports, "createErrorLogger", { enumerable: true, get: function () { return runtime_1.createErrorLogger; } });
47
- var runtime_2 = require("./runtime");
48
- Object.defineProperty(exports, "buildComponentProps", { enumerable: true, get: function () { return runtime_2.buildComponentProps; } });
49
- Object.defineProperty(exports, "normalizeCallbacks", { enumerable: true, get: function () { return runtime_2.normalizeCallbacks; } });
50
- Object.defineProperty(exports, "normalizeStyles", { enumerable: true, get: function () { return runtime_2.normalizeStyles; } });
51
- Object.defineProperty(exports, "validateComponentProps", { enumerable: true, get: function () { return runtime_2.validateComponentProps; } });
52
- Object.defineProperty(exports, "mergeProps", { enumerable: true, get: function () { return runtime_2.mergeProps; } });
53
- Object.defineProperty(exports, "createPropsTransformer", { enumerable: true, get: function () { return runtime_2.createPropsTransformer; } });
54
- Object.defineProperty(exports, "wrapCallbacksWithLogging", { enumerable: true, get: function () { return runtime_2.wrapCallbacksWithLogging; } });
55
- Object.defineProperty(exports, "extractPropPaths", { enumerable: true, get: function () { return runtime_2.extractPropPaths; } });
56
- var runtime_3 = require("./runtime");
57
- Object.defineProperty(exports, "ComponentHierarchyRegistrar", { enumerable: true, get: function () { return runtime_3.ComponentHierarchyRegistrar; } });
58
- Object.defineProperty(exports, "registerComponentHierarchy", { enumerable: true, get: function () { return runtime_3.registerComponentHierarchy; } });
59
- Object.defineProperty(exports, "validateComponentSpec", { enumerable: true, get: function () { return runtime_3.validateComponentSpec; } });
60
- Object.defineProperty(exports, "flattenComponentHierarchy", { enumerable: true, get: function () { return runtime_3.flattenComponentHierarchy; } });
61
- Object.defineProperty(exports, "countComponentsInHierarchy", { enumerable: true, get: function () { return runtime_3.countComponentsInHierarchy; } });
62
- var runtime_4 = require("./runtime");
63
- Object.defineProperty(exports, "ReactRootManager", { enumerable: true, get: function () { return runtime_4.ReactRootManager; } });
64
- Object.defineProperty(exports, "reactRootManager", { enumerable: true, get: function () { return runtime_4.reactRootManager; } });
65
- var component_styles_1 = require("./utilities/component-styles");
66
- Object.defineProperty(exports, "SetupStyles", { enumerable: true, get: function () { return component_styles_1.SetupStyles; } });
67
- Object.defineProperty(exports, "createDefaultComponentStyles", { enumerable: true, get: function () { return component_styles_1.createDefaultComponentStyles; } });
68
- var standard_libraries_1 = require("./utilities/standard-libraries");
69
- Object.defineProperty(exports, "StandardLibraryManager", { enumerable: true, get: function () { return standard_libraries_1.StandardLibraryManager; } });
70
- Object.defineProperty(exports, "createStandardLibraries", { enumerable: true, get: function () { return standard_libraries_1.createStandardLibraries; } });
71
- var library_loader_1 = require("./utilities/library-loader");
72
- Object.defineProperty(exports, "LibraryLoader", { enumerable: true, get: function () { return library_loader_1.LibraryLoader; } });
73
- var core_libraries_1 = require("./utilities/core-libraries");
74
- Object.defineProperty(exports, "getCoreRuntimeLibraries", { enumerable: true, get: function () { return core_libraries_1.getCoreRuntimeLibraries; } });
75
- Object.defineProperty(exports, "isCoreRuntimeLibrary", { enumerable: true, get: function () { return core_libraries_1.isCoreRuntimeLibrary; } });
76
- var library_registry_1 = require("./utilities/library-registry");
77
- Object.defineProperty(exports, "LibraryRegistry", { enumerable: true, get: function () { return library_registry_1.LibraryRegistry; } });
78
- var component_error_analyzer_1 = require("./utilities/component-error-analyzer");
79
- Object.defineProperty(exports, "ComponentErrorAnalyzer", { enumerable: true, get: function () { return component_error_analyzer_1.ComponentErrorAnalyzer; } });
80
- var resource_manager_1 = require("./utilities/resource-manager");
81
- Object.defineProperty(exports, "ResourceManager", { enumerable: true, get: function () { return resource_manager_1.ResourceManager; } });
82
- Object.defineProperty(exports, "resourceManager", { enumerable: true, get: function () { return resource_manager_1.resourceManager; } });
83
- var cache_manager_1 = require("./utilities/cache-manager");
84
- Object.defineProperty(exports, "CacheManager", { enumerable: true, get: function () { return cache_manager_1.CacheManager; } });
85
- var component_unwrapper_1 = require("./utilities/component-unwrapper");
86
- Object.defineProperty(exports, "unwrapLibraryComponent", { enumerable: true, get: function () { return component_unwrapper_1.unwrapLibraryComponent; } });
87
- Object.defineProperty(exports, "unwrapLibraryComponents", { enumerable: true, get: function () { return component_unwrapper_1.unwrapLibraryComponents; } });
88
- Object.defineProperty(exports, "unwrapAllLibraryComponents", { enumerable: true, get: function () { return component_unwrapper_1.unwrapAllLibraryComponents; } });
89
- Object.defineProperty(exports, "unwrapComponent", { enumerable: true, get: function () { return component_unwrapper_1.unwrapComponent; } });
90
- Object.defineProperty(exports, "unwrapComponents", { enumerable: true, get: function () { return component_unwrapper_1.unwrapComponents; } });
91
- Object.defineProperty(exports, "unwrapAllComponents", { enumerable: true, get: function () { return component_unwrapper_1.unwrapAllComponents; } });
92
- exports.VERSION = '2.69.1';
93
- exports.DEFAULT_CONFIGS = {
1
+ import { ComponentCompiler } from './compiler';
2
+ import { ComponentRegistry } from './registry';
3
+ import { ComponentResolver } from './registry';
4
+ import { ComponentManager } from './component-manager';
5
+ export * from './types';
6
+ export { ComponentCompiler } from './compiler';
7
+ export { DEFAULT_PRESETS, DEFAULT_PLUGINS, PRODUCTION_CONFIG, DEVELOPMENT_CONFIG, getBabelConfig, validateBabelPresets, getJSXConfig } from './compiler';
8
+ export { ComponentRegistry } from './registry';
9
+ export { ComponentResolver, ComponentSpec, ComponentRegistryService } from './registry';
10
+ export { ComponentManager } from './component-manager';
11
+ export { createErrorBoundary, withErrorBoundary, formatComponentError, createErrorLogger } from './runtime';
12
+ export { buildComponentProps, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths } from './runtime';
13
+ export { ComponentHierarchyRegistrar, registerComponentHierarchy, validateComponentSpec, flattenComponentHierarchy, countComponentsInHierarchy } from './runtime';
14
+ export { ReactRootManager, reactRootManager } from './runtime';
15
+ export { SetupStyles, createDefaultComponentStyles } from './utilities/component-styles';
16
+ export { StandardLibraryManager, createStandardLibraries } from './utilities/standard-libraries';
17
+ export { LibraryLoader } from './utilities/library-loader';
18
+ export { getCoreRuntimeLibraries, isCoreRuntimeLibrary } from './utilities/core-libraries';
19
+ export { LibraryRegistry } from './utilities/library-registry';
20
+ export { ComponentErrorAnalyzer } from './utilities/component-error-analyzer';
21
+ export { ResourceManager, resourceManager } from './utilities/resource-manager';
22
+ export { CacheManager } from './utilities/cache-manager';
23
+ export { unwrapLibraryComponent, unwrapLibraryComponents, unwrapAllLibraryComponents, unwrapComponent, unwrapComponents, unwrapAllComponents } from './utilities/component-unwrapper';
24
+ export const VERSION = '2.69.1';
25
+ export const DEFAULT_CONFIGS = {
94
26
  compiler: {
95
27
  babel: {
96
28
  presets: ['react'],
@@ -108,7 +40,7 @@ exports.DEFAULT_CONFIGS = {
108
40
  enableNamespaces: true
109
41
  }
110
42
  };
111
- function createReactRuntime(babelInstance, config, runtimeContext, debug = false) {
43
+ export function createReactRuntime(babelInstance, config, runtimeContext, debug = false) {
112
44
  const compilerConfig = {
113
45
  ...config?.compiler,
114
46
  debug: config?.compiler?.debug ?? debug
@@ -121,19 +53,18 @@ function createReactRuntime(babelInstance, config, runtimeContext, debug = false
121
53
  ...config?.manager,
122
54
  debug: config?.manager?.debug ?? debug
123
55
  };
124
- const compiler = new compiler_1.ComponentCompiler(compilerConfig);
56
+ const compiler = new ComponentCompiler(compilerConfig);
125
57
  compiler.setBabelInstance(babelInstance);
126
- const registry = new registry_1.ComponentRegistry(registryConfig);
127
- const resolver = new registry_2.ComponentResolver(registry, compiler, runtimeContext);
128
- const manager = new component_manager_1.ComponentManager(compiler, registry, runtimeContext || { React: null, ReactDOM: null }, managerConfig);
58
+ const registry = new ComponentRegistry(registryConfig);
59
+ const resolver = new ComponentResolver(registry, compiler, runtimeContext);
60
+ const manager = new ComponentManager(compiler, registry, runtimeContext || { React: null, ReactDOM: null }, managerConfig);
129
61
  return {
130
62
  compiler,
131
63
  registry,
132
64
  resolver,
133
65
  manager,
134
- version: exports.VERSION,
66
+ version: VERSION,
135
67
  debug
136
68
  };
137
69
  }
138
- exports.createReactRuntime = createReactRuntime;
139
70
  //# sourceMappingURL=index.js.map
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;AAC/C,2DAAuD;AAGvD,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,uCAMoB;AALlB,6GAAA,iBAAiB,OAAA;AACjB,yGAAA,aAAa,OAAA;AAEb,oHAAA,wBAAwB,OAAA;AAK1B,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AASzB,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,qBAAq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AK;IAGtB,MAAM,cAAc,GAAG;QACrB,GAAG,MAAM,EAAE,QAAQ;QACnB,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,KAAK;KACxC,CAAC;IAEF,MAAM,cAAc,GAAG;QACrB,GAAG,MAAM,EAAE,QAAQ;QACnB,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,KAAK;KACxC,CAAC;IAEF,MAAM,aAAa,GAAG;QACpB,GAAG,MAAM,EAAE,OAAO;QAClB,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK;KACvC,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,cAAc,CAAC,CAAC;IACvD,QAAQ,CAAC,gBAAgB,CAAC,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;IAG3E,MAAM,OAAO,GAAG,IAAI,oCAAgB,CAClC,QAAQ,EACR,QAAQ,EACR,cAAc,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EACjD,aAAa,CACd,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,OAAO,EAAE,eAAO;QAChB,KAAK;KACN,CAAC;AACJ,CAAC;AAhDD,gDAgDC","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';\nimport { ComponentManager } from './component-manager';\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 ComponentRegistryService,\n IComponentRegistryClient\n} from './registry';\n\n// Export unified ComponentManager\nexport { ComponentManager } from './component-manager';\nexport type {\n LoadOptions,\n LoadResult,\n HierarchyResult,\n ComponentManagerConfig\n} from './component-manager';\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 getCoreRuntimeLibraries,\n isCoreRuntimeLibrary\n} from './utilities/core-libraries';\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\nexport {\n unwrapLibraryComponent,\n unwrapLibraryComponents,\n unwrapAllLibraryComponents,\n // Legacy exports for backward compatibility\n unwrapComponent,\n unwrapComponents,\n unwrapAllComponents\n} from './utilities/component-unwrapper';\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 manager?: Partial<import('./component-manager').ComponentManagerConfig>;\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 managerConfig = {\n ...config?.manager,\n debug: config?.manager?.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 // Create the unified ComponentManager\n const manager = new ComponentManager(\n compiler,\n registry,\n runtimeContext || { React: null, ReactDOM: null },\n managerConfig\n );\n\n return {\n compiler,\n registry,\n resolver,\n manager, // New unified manager\n version: VERSION,\n debug\n };\n}"]}
1
+ {"version":3,"file":"index.js","sourceRoot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E,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK;KACvC,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACvD,QAAQ,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAG3E,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAClC,QAAQ,EACR,QAAQ,EACR,cAAc,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EACjD,aAAa,CACd,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,OAAO,EAAE,OAAO;QAChB,KAAK;KACN,CAAC;AACJ,CAAC","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';\nimport { ComponentManager } from './component-manager';\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 ComponentRegistryService,\n IComponentRegistryClient\n} from './registry';\n\n// Export unified ComponentManager\nexport { ComponentManager } from './component-manager';\nexport type {\n LoadOptions,\n LoadResult,\n HierarchyResult,\n ComponentManagerConfig\n} from './component-manager';\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 getCoreRuntimeLibraries,\n isCoreRuntimeLibrary\n} from './utilities/core-libraries';\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\nexport {\n unwrapLibraryComponent,\n unwrapLibraryComponents,\n unwrapAllLibraryComponents,\n // Legacy exports for backward compatibility\n unwrapComponent,\n unwrapComponents,\n unwrapAllComponents\n} from './utilities/component-unwrapper';\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 manager?: Partial<import('./component-manager').ComponentManagerConfig>;\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 managerConfig = {\n ...config?.manager,\n debug: config?.manager?.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 // Create the unified ComponentManager\n const manager = new ComponentManager(\n compiler,\n registry,\n runtimeContext || { React: null, ReactDOM: null },\n managerConfig\n );\n\n return {\n compiler,\n registry,\n resolver,\n manager, // New unified manager\n version: VERSION,\n debug\n };\n}"]}
@@ -1,37 +1,12 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ComponentRegistryService = void 0;
27
- const core_1 = require("@memberjunction/core");
28
- const core_entities_1 = require("@memberjunction/core-entities");
1
+ import { Metadata } from '@memberjunction/core';
2
+ import { ComponentMetadataEngine } from '@memberjunction/core-entities';
29
3
  let GraphQLComponentRegistryClient;
30
- class ComponentRegistryService {
4
+ export class ComponentRegistryService {
5
+ static { this.instance = null; }
31
6
  constructor(compiler, runtimeContext, debug = false, graphQLClient) {
32
7
  this.compiledComponentCache = new Map();
33
8
  this.componentReferences = new Map();
34
- this.componentEngine = core_entities_1.ComponentMetadataEngine.Instance;
9
+ this.componentEngine = ComponentMetadataEngine.Instance;
35
10
  this.registryProviders = new Map();
36
11
  this.debug = false;
37
12
  this.cachedProviderClient = null;
@@ -60,11 +35,11 @@ class ComponentRegistryService {
60
35
  return this.cachedProviderClient;
61
36
  }
62
37
  try {
63
- const provider = core_1.Metadata?.Provider;
38
+ const provider = Metadata?.Provider;
64
39
  if (provider && provider.ExecuteGQL !== undefined) {
65
40
  if (!GraphQLComponentRegistryClient) {
66
41
  try {
67
- const graphqlModule = await Promise.resolve().then(() => __importStar(require('@memberjunction/graphql-dataprovider')));
42
+ const graphqlModule = await import('@memberjunction/graphql-dataprovider');
68
43
  GraphQLComponentRegistryClient = graphqlModule.GraphQLComponentRegistryClient;
69
44
  }
70
45
  catch (importError) {
@@ -345,7 +320,7 @@ class ComponentRegistryService {
345
320
  return spec;
346
321
  }
347
322
  async cacheExternalComponent(componentId, spec, contextUser) {
348
- const md = new core_1.Metadata();
323
+ const md = new Metadata();
349
324
  const componentEntity = await md.GetEntityObject('MJ: Components', contextUser);
350
325
  if (!await componentEntity.Load(componentId)) {
351
326
  throw new Error(`Failed to load component entity: ${componentId}`);
@@ -535,6 +510,4 @@ class ComponentRegistryService {
535
510
  return `${registryPart}/${namespacePart}/${name}@${version}`;
536
511
  }
537
512
  }
538
- exports.ComponentRegistryService = ComponentRegistryService;
539
- ComponentRegistryService.instance = null;
540
513
  //# sourceMappingURL=component-registry-service.js.map