@memberjunction/react-runtime 2.111.0 → 2.112.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 (43) hide show
  1. package/.turbo/turbo-build.log +10 -11
  2. package/CHANGELOG.md +6 -6
  3. package/dist/compiler/component-compiler.d.ts.map +1 -1
  4. package/dist/compiler/component-compiler.js +66 -56
  5. package/dist/compiler/component-compiler.js.map +1 -1
  6. package/dist/component-manager/component-manager.d.ts.map +1 -1
  7. package/dist/component-manager/component-manager.js +48 -42
  8. package/dist/component-manager/component-manager.js.map +1 -1
  9. package/dist/component-manager/types.d.ts +1 -1
  10. package/dist/component-manager/types.d.ts.map +1 -1
  11. package/dist/component-manager/types.js.map +1 -1
  12. package/dist/registry/component-registry-service.d.ts +1 -1
  13. package/dist/registry/component-registry-service.d.ts.map +1 -1
  14. package/dist/registry/component-registry-service.js +34 -34
  15. package/dist/registry/component-registry-service.js.map +1 -1
  16. package/dist/registry/component-resolver.d.ts +1 -1
  17. package/dist/registry/component-resolver.d.ts.map +1 -1
  18. package/dist/registry/component-resolver.js +10 -11
  19. package/dist/registry/component-resolver.js.map +1 -1
  20. package/dist/runtime/component-hierarchy.d.ts +1 -1
  21. package/dist/runtime/component-hierarchy.d.ts.map +1 -1
  22. package/dist/runtime/component-hierarchy.js +43 -43
  23. package/dist/runtime/component-hierarchy.js.map +1 -1
  24. package/dist/runtime/prop-builder.d.ts.map +1 -1
  25. package/dist/runtime/prop-builder.js +22 -24
  26. package/dist/runtime/prop-builder.js.map +1 -1
  27. package/dist/runtime.umd.js +494 -511
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/index.js.map +1 -1
  30. package/dist/utilities/library-registry.d.ts +1 -1
  31. package/dist/utilities/library-registry.d.ts.map +1 -1
  32. package/dist/utilities/library-registry.js +10 -10
  33. package/dist/utilities/library-registry.js.map +1 -1
  34. package/package.json +5 -6
  35. package/src/compiler/component-compiler.ts +186 -164
  36. package/src/component-manager/component-manager.ts +162 -216
  37. package/src/component-manager/types.ts +27 -27
  38. package/src/registry/component-registry-service.ts +190 -218
  39. package/src/registry/component-resolver.ts +87 -98
  40. package/src/runtime/component-hierarchy.ts +57 -94
  41. package/src/runtime/prop-builder.ts +28 -33
  42. package/src/types/index.ts +3 -4
  43. package/src/utilities/library-registry.ts +14 -19
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry-service.js","sourceRoot":"","sources":["../../src/registry/component-registry-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,+CAA0D;AAC1D,iEAMuC;AAMvC,IAAI,8BAAmC,CAAC;AA+BxC,MAAa,wBAAwB;IAenC,YACE,QAA2B,EAC3B,cAA8B,EAC9B,QAAiB,KAAK,EACtB,aAAwC;QAflC,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;QA2CvB,yBAAoB,GAAoC,IAAI,CAAC;QAlCnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAKD,MAAM,CAAC,WAAW,CAChB,QAA2B,EAC3B,OAAuB,EACvB,QAAiB,KAAK,EACtB,aAAwC;QAExC,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACvC,wBAAwB,CAAC,QAAQ,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;QAC5G,CAAC;QACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC;IAC3C,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AAM,CAAC,KAAK;QACV,IAAI,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACtC,wBAAwB,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;YAClD,wBAAwB,CAAC,QAAQ,GAAG,IAAI,CAAC;QAC3C,CAAC;IACH,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;;AA50BH,4DA60BC;AA50BgB,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// Type-only import for TypeScript - won't be included in UMD bundle\nimport type { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';\n\n// Dynamic import of GraphQLComponentRegistryClient to avoid breaking UMD build\nlet GraphQLComponentRegistryClient: any;\n\n\n/**\n * Cached compiled component with metadata\n */\ninterface CachedCompiledComponent {\n component: (context: RuntimeContext, styles?: any, components?: Record<string, any>) => ComponentObject;\n metadata: RegistryComponentResponse['metadata'];\n compiledAt: Date;\n lastUsed: Date;\n useCount: number;\n specHash?: string; // SHA-256 hash of the spec used for compilation\n}\n\n/**\n * GraphQL client interface for registry operations\n */\nexport interface IComponentRegistryClient {\n GetRegistryComponent(params: {\n registryName: string;\n namespace: string;\n name: string;\n version?: string;\n hash?: string;\n }): Promise<ComponentSpec | null>;\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 private graphQLClient?: IComponentRegistryClient;\n \n private constructor(\n compiler: ComponentCompiler,\n runtimeContext: RuntimeContext,\n debug: boolean = false,\n graphQLClient?: IComponentRegistryClient\n ) {\n this.compiler = compiler;\n this.runtimeContext = runtimeContext;\n this.debug = debug;\n this.graphQLClient = graphQLClient;\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 graphQLClient?: IComponentRegistryClient\n ): ComponentRegistryService {\n if (!ComponentRegistryService.instance) {\n ComponentRegistryService.instance = new ComponentRegistryService(compiler, context, debug, graphQLClient);\n }\n return ComponentRegistryService.instance;\n }\n \n /**\n * Set the GraphQL client for registry operations\n */\n setGraphQLClient(client: IComponentRegistryClient): void {\n this.graphQLClient = client;\n if (this.debug) {\n console.log('✅ GraphQL client configured for component registry');\n }\n }\n \n /**\n * Cached GraphQL client instance created from Metadata.Provider\n */\n private cachedProviderClient: IComponentRegistryClient | null = null;\n \n /**\n * Get the GraphQL client, using the provided one or falling back to creating one with Metadata.Provider\n * @returns The GraphQL client if available\n */\n private async getGraphQLClient(): Promise<IComponentRegistryClient | null> {\n // If explicitly set, use that\n if (this.graphQLClient) {\n return this.graphQLClient;\n }\n \n // If we've already created one from the provider, reuse it\n if (this.cachedProviderClient) {\n return this.cachedProviderClient;\n }\n \n // Try to create GraphQLComponentRegistryClient with Metadata.Provider\n try {\n const provider = Metadata?.Provider;\n if (provider && (provider as any).ExecuteGQL !== undefined) {\n // Dynamically load GraphQLComponentRegistryClient if not already loaded\n if (!GraphQLComponentRegistryClient) {\n try {\n const graphqlModule = await import('@memberjunction/graphql-dataprovider');\n GraphQLComponentRegistryClient = graphqlModule.GraphQLComponentRegistryClient;\n } catch (importError) {\n if (this.debug) {\n console.log('⚠️ [ComponentRegistryService] @memberjunction/graphql-dataprovider not available');\n }\n return null;\n }\n }\n \n // Create the client if we have the class\n if (GraphQLComponentRegistryClient) {\n try {\n const client = new GraphQLComponentRegistryClient(provider as GraphQLDataProvider);\n this.cachedProviderClient = client;\n if (this.debug) {\n console.log('📡 [ComponentRegistryService] Created GraphQL client from Metadata.Provider');\n }\n return client;\n } catch (error) {\n if (this.debug) {\n console.log('⚠️ [ComponentRegistryService] Failed to create GraphQL client:', error);\n }\n }\n }\n }\n } catch (error) {\n // Provider might not be available in all environments\n if (this.debug) {\n console.log('⚠️ [ComponentRegistryService] Could not access Metadata.Provider:', error);\n }\n }\n \n return null;\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 * Calculate SHA-256 hash of a component spec for cache comparison\n * Uses Web Crypto API which is available in modern browsers and Node.js 15+\n */\n private async calculateSpecHash(spec: ComponentSpec): Promise<string> {\n // Check for crypto.subtle availability\n if (typeof crypto === 'undefined' || !crypto.subtle) {\n throw new Error(\n 'Web Crypto API not available. This typically happens when running in an insecure context. ' +\n 'Please use HTTPS or localhost for development. ' +\n 'Note: crypto.subtle is available in Node.js 15+ and all modern browsers on secure contexts.'\n );\n }\n \n const specString = JSON.stringify(spec);\n const encoder = new TextEncoder();\n const data = encoder.encode(specString);\n \n // Calculate SHA-256 hash using Web Crypto API\n const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n \n // Convert ArrayBuffer to hex string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n \n return hashHex;\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 // Call the factory function to get the ComponentObject\n return cached.component(this.runtimeContext);\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 let compilationResult;\n try {\n compilationResult = await this.compiler.compile({\n componentName: component.Name,\n componentCode: spec.code,\n libraries: spec.libraries,\n allLibraries\n });\n }\n catch (compileEx) {\n // log then throw\n console.error(`🔴 Error compiling component ${component.Name}`,compileEx);\n throw compileEx;\n }\n \n if (!compilationResult.success) {\n console.error(`🔴 Error compiling component ${component.Name}`, compilationResult, 'Code', spec.code);\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 compiledComponentFactory = compilationResult.component.factory;\n this.compiledComponentCache.set(key, {\n component: compiledComponentFactory,\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 // Call the factory function to get the ComponentObject\n return compiledComponentFactory(this.runtimeContext);\n }\n \n /**\n * Get compiled component from external registry by registry name\n * This is used when spec.registry field is populated\n */\n async getCompiledComponentFromRegistry(\n registryName: string,\n namespace: string,\n name: string,\n version: string,\n referenceId?: string,\n contextUser?: UserInfo\n ): Promise<any> {\n await this.initialize(contextUser);\n \n if (this.debug) {\n console.log(`🌐 [ComponentRegistryService] Fetching from external registry: ${registryName}/${namespace}/${name}@${version}`);\n }\n \n // Find the registry by name in ComponentRegistries\n const registry = this.componentEngine.ComponentRegistries?.find(\n r => r.Name === registryName && r.Status === 'Active'\n );\n \n if (!registry) {\n throw new Error(`Registry not found or inactive: ${registryName}`);\n }\n \n if (this.debug) {\n console.log(`✅ [ComponentRegistryService] Found registry: ${registry.Name} (ID: ${registry.ID})`);\n }\n \n // Get GraphQL client - use provided one or fallback to Metadata.Provider\n const graphQLClient = await this.getGraphQLClient();\n if (!graphQLClient) {\n throw new Error('GraphQL client not available for external registry fetching. No client provided and Metadata.Provider is not a GraphQLDataProvider.');\n }\n \n // Check if we have a cached version first\n const key = `external:${registryName}:${namespace}:${name}:${version}`;\n const cached = this.compiledComponentCache.get(key);\n \n try {\n // Fetch component spec from external registry via MJServer\n // Pass cached hash if available for efficient caching\n const spec = await graphQLClient.GetRegistryComponent({\n registryName: registry.Name, // Pass registry name, not ID\n namespace,\n name,\n version,\n hash: cached?.specHash // Pass cached hash if available\n });\n \n // If null returned, it means not modified (304)\n if (!spec && cached?.specHash) {\n if (this.debug) {\n console.log(`♻️ [ComponentRegistryService] Component not modified, using cached: ${key}`);\n }\n cached.lastUsed = new Date();\n cached.useCount++;\n \n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n // Call the factory function to get the ComponentObject\n return cached.component(this.runtimeContext);\n }\n \n if (!spec) {\n throw new Error(`Component not found in registry ${registryName}: ${namespace}/${name}@${version}`);\n }\n \n if (this.debug) {\n console.log(`✅ [ComponentRegistryService] Fetched spec from external registry: ${spec.name}`);\n }\n \n // Calculate hash of the fetched spec\n const specHash = await this.calculateSpecHash(spec);\n \n // Check if hash matches cached version (shouldn't happen if server works correctly)\n if (cached && cached.specHash === specHash) {\n if (this.debug) {\n console.log(`♻️ [ComponentRegistryService] Using cached compilation for: ${key} (hash match)`);\n }\n cached.lastUsed = new Date();\n cached.useCount++;\n \n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n // Call the factory function to get the ComponentObject\n return cached.component(this.runtimeContext);\n }\n \n // Spec has changed or is new, need to compile\n if (cached && this.debug) {\n console.log(`🔄 [ComponentRegistryService] Spec changed for: ${key}, recompiling (old hash: ${cached.specHash?.substring(0, 8)}..., new hash: ${specHash.substring(0, 8)}...)`);\n }\n \n // Load all libraries from metadata engine\n const allLibraries = this.componentEngine.ComponentLibraries || [];\n \n // Compile the component\n const compilationResult = await this.compiler.compile({\n componentName: spec.name,\n componentCode: spec.code || '',\n allLibraries: allLibraries\n });\n \n if (!compilationResult.success || !compilationResult.component) {\n throw new Error(`Failed to compile component: ${compilationResult.error?.message || 'Unknown error'}`);\n }\n \n // Cache the compiled component with spec hash\n this.compiledComponentCache.set(key, {\n component: compilationResult.component.factory,\n metadata: {\n name: spec.name,\n namespace: spec.namespace || '',\n version: spec.version || '1.0.0',\n description: spec.description || '',\n type: spec.type,\n isLocal: false // This is from an external registry\n },\n compiledAt: new Date(),\n lastUsed: new Date(),\n useCount: 1,\n specHash: specHash // Store the hash for future comparison\n });\n \n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n if (this.debug) {\n console.log(`🎯 [ComponentRegistryService] Successfully compiled external component: ${spec.name}`);\n }\n \n // Call the factory function to get the ComponentObject\n return compilationResult.component.factory(this.runtimeContext);\n } catch (error) {\n console.error(`❌ [ComponentRegistryService] Failed to fetch from external registry:`, error);\n throw error;\n }\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 // Try GraphQL client first if available\n let spec: ComponentSpec;\n \n if (this.graphQLClient) {\n if (this.debug) {\n console.log(`Fetching from registry via GraphQL: ${component.Name}`);\n }\n \n const result = await this.graphQLClient.GetRegistryComponent({\n registryName: registry.Name,\n namespace: component.Namespace || '',\n name: component.Name,\n version: component.Version\n });\n \n if (!result) {\n throw new Error(`Component not found in registry: ${component.Name}`);\n }\n \n spec = result;\n } else {\n // Fallback to direct HTTP if no GraphQL client\n spec = await this.fetchFromExternalRegistry(\n registry.URI || '',\n component.Name,\n component.Namespace || '',\n component.Version,\n this.getRegistryApiKey(registry.ID)\n );\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 * Force clear all compiled components\n * Used for Component Studio to ensure fresh loads\n */\n forceClearAll(): void {\n this.compiledComponentCache.clear();\n this.componentReferences.clear();\n console.log('🧹 Component cache force cleared');\n }\n\n /**\n * Reset the singleton instance\n * Forces new instance creation on next access\n */\n static reset(): void {\n if (ComponentRegistryService.instance) {\n ComponentRegistryService.instance.forceClearAll();\n ComponentRegistryService.instance = null;\n }\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,mDAA4D;AAC5D,iEAMuC;AAMvC,IAAI,8BAAmC,CAAC;AA8BxC,MAAa,wBAAwB;IAenC,YACE,QAA2B,EAC3B,cAA8B,EAC9B,QAAiB,KAAK,EACtB,aAAwC;QAflC,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;QA2CvB,yBAAoB,GAAoC,IAAI,CAAC;QAlCnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAKD,MAAM,CAAC,WAAW,CAChB,QAA2B,EAC3B,OAAuB,EACvB,QAAiB,KAAK,EACtB,aAAwC;QAExC,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACvC,wBAAwB,CAAC,QAAQ,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;QAC5G,CAAC;QACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAKD,gBAAgB,CAAC,MAAgC;QAC/C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,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AE,CAAC;YAClD,wBAAwB,CAAC,QAAQ,GAAG,IAAI,CAAC;QAC3C,CAAC;IACH,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;;AAjzBH,4DAkzBC;AAjzBgB,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/global';\nimport {\n ComponentEntity,\n ComponentRegistryEntity,\n ComponentDependencyEntity,\n ComponentLibraryLinkEntity,\n ComponentMetadataEngine,\n} from '@memberjunction/core-entities';\n\n// Type-only import for TypeScript - won't be included in UMD bundle\nimport type { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';\n\n// Dynamic import of GraphQLComponentRegistryClient to avoid breaking UMD build\nlet GraphQLComponentRegistryClient: any;\n\n/**\n * Cached compiled component with metadata\n */\ninterface CachedCompiledComponent {\n component: (context: RuntimeContext, styles?: any, components?: Record<string, any>) => ComponentObject;\n metadata: RegistryComponentResponse['metadata'];\n compiledAt: Date;\n lastUsed: Date;\n useCount: number;\n specHash?: string; // SHA-256 hash of the spec used for compilation\n}\n\n/**\n * GraphQL client interface for registry operations\n */\nexport interface IComponentRegistryClient {\n GetRegistryComponent(params: {\n registryName: string;\n namespace: string;\n name: string;\n version?: string;\n hash?: string;\n }): Promise<ComponentSpec | null>;\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 private graphQLClient?: IComponentRegistryClient;\n\n private constructor(\n compiler: ComponentCompiler,\n runtimeContext: RuntimeContext,\n debug: boolean = false,\n graphQLClient?: IComponentRegistryClient\n ) {\n this.compiler = compiler;\n this.runtimeContext = runtimeContext;\n this.debug = debug;\n this.graphQLClient = graphQLClient;\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 graphQLClient?: IComponentRegistryClient\n ): ComponentRegistryService {\n if (!ComponentRegistryService.instance) {\n ComponentRegistryService.instance = new ComponentRegistryService(compiler, context, debug, graphQLClient);\n }\n return ComponentRegistryService.instance;\n }\n\n /**\n * Set the GraphQL client for registry operations\n */\n setGraphQLClient(client: IComponentRegistryClient): void {\n this.graphQLClient = client;\n if (this.debug) {\n console.log('✅ GraphQL client configured for component registry');\n }\n }\n\n /**\n * Cached GraphQL client instance created from Metadata.Provider\n */\n private cachedProviderClient: IComponentRegistryClient | null = null;\n\n /**\n * Get the GraphQL client, using the provided one or falling back to creating one with Metadata.Provider\n * @returns The GraphQL client if available\n */\n private async getGraphQLClient(): Promise<IComponentRegistryClient | null> {\n // If explicitly set, use that\n if (this.graphQLClient) {\n return this.graphQLClient;\n }\n\n // If we've already created one from the provider, reuse it\n if (this.cachedProviderClient) {\n return this.cachedProviderClient;\n }\n\n // Try to create GraphQLComponentRegistryClient with Metadata.Provider\n try {\n const provider = Metadata?.Provider;\n if (provider && (provider as any).ExecuteGQL !== undefined) {\n // Dynamically load GraphQLComponentRegistryClient if not already loaded\n if (!GraphQLComponentRegistryClient) {\n try {\n const graphqlModule = await import('@memberjunction/graphql-dataprovider');\n GraphQLComponentRegistryClient = graphqlModule.GraphQLComponentRegistryClient;\n } catch (importError) {\n if (this.debug) {\n console.log('⚠️ [ComponentRegistryService] @memberjunction/graphql-dataprovider not available');\n }\n return null;\n }\n }\n\n // Create the client if we have the class\n if (GraphQLComponentRegistryClient) {\n try {\n const client = new GraphQLComponentRegistryClient(provider as GraphQLDataProvider);\n this.cachedProviderClient = client;\n if (this.debug) {\n console.log('📡 [ComponentRegistryService] Created GraphQL client from Metadata.Provider');\n }\n return client;\n } catch (error) {\n if (this.debug) {\n console.log('⚠️ [ComponentRegistryService] Failed to create GraphQL client:', error);\n }\n }\n }\n }\n } catch (error) {\n // Provider might not be available in all environments\n if (this.debug) {\n console.log('⚠️ [ComponentRegistryService] Could not access Metadata.Provider:', error);\n }\n }\n\n return null;\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 * Calculate SHA-256 hash of a component spec for cache comparison\n * Uses Web Crypto API which is available in modern browsers and Node.js 15+\n */\n private async calculateSpecHash(spec: ComponentSpec): Promise<string> {\n // Check for crypto.subtle availability\n if (typeof crypto === 'undefined' || !crypto.subtle) {\n throw new Error(\n 'Web Crypto API not available. This typically happens when running in an insecure context. ' +\n 'Please use HTTPS or localhost for development. ' +\n 'Note: crypto.subtle is available in Node.js 15+ and all modern browsers on secure contexts.'\n );\n }\n\n const specString = JSON.stringify(spec);\n const encoder = new TextEncoder();\n const data = encoder.encode(specString);\n\n // Calculate SHA-256 hash using Web Crypto API\n const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n\n // Convert ArrayBuffer to hex string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');\n\n return hashHex;\n }\n\n /**\n * Get a compiled component, using cache if available\n */\n async getCompiledComponent(componentId: string, referenceId?: string, contextUser?: UserInfo): 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 // Call the factory function to get the ComponentObject\n return cached.component(this.runtimeContext);\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 let compilationResult;\n try {\n compilationResult = await this.compiler.compile({\n componentName: component.Name,\n componentCode: spec.code,\n libraries: spec.libraries,\n allLibraries,\n });\n } catch (compileEx) {\n // log then throw\n console.error(`🔴 Error compiling component ${component.Name}`, compileEx);\n throw compileEx;\n }\n\n if (!compilationResult.success) {\n console.error(`🔴 Error compiling component ${component.Name}`, compilationResult, 'Code', spec.code);\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 compiledComponentFactory = compilationResult.component.factory;\n this.compiledComponentCache.set(key, {\n component: compiledComponentFactory,\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 // Call the factory function to get the ComponentObject\n return compiledComponentFactory(this.runtimeContext);\n }\n\n /**\n * Get compiled component from external registry by registry name\n * This is used when spec.registry field is populated\n */\n async getCompiledComponentFromRegistry(\n registryName: string,\n namespace: string,\n name: string,\n version: string,\n referenceId?: string,\n contextUser?: UserInfo\n ): Promise<any> {\n await this.initialize(contextUser);\n\n if (this.debug) {\n console.log(`🌐 [ComponentRegistryService] Fetching from external registry: ${registryName}/${namespace}/${name}@${version}`);\n }\n\n // Find the registry by name in ComponentRegistries\n const registry = this.componentEngine.ComponentRegistries?.find((r) => r.Name === registryName && r.Status === 'Active');\n\n if (!registry) {\n throw new Error(`Registry not found or inactive: ${registryName}`);\n }\n\n if (this.debug) {\n console.log(`✅ [ComponentRegistryService] Found registry: ${registry.Name} (ID: ${registry.ID})`);\n }\n\n // Get GraphQL client - use provided one or fallback to Metadata.Provider\n const graphQLClient = await this.getGraphQLClient();\n if (!graphQLClient) {\n throw new Error(\n 'GraphQL client not available for external registry fetching. No client provided and Metadata.Provider is not a GraphQLDataProvider.'\n );\n }\n\n // Check if we have a cached version first\n const key = `external:${registryName}:${namespace}:${name}:${version}`;\n const cached = this.compiledComponentCache.get(key);\n\n try {\n // Fetch component spec from external registry via MJServer\n // Pass cached hash if available for efficient caching\n const spec = await graphQLClient.GetRegistryComponent({\n registryName: registry.Name, // Pass registry name, not ID\n namespace,\n name,\n version,\n hash: cached?.specHash, // Pass cached hash if available\n });\n\n // If null returned, it means not modified (304)\n if (!spec && cached?.specHash) {\n if (this.debug) {\n console.log(`♻️ [ComponentRegistryService] Component not modified, using cached: ${key}`);\n }\n cached.lastUsed = new Date();\n cached.useCount++;\n\n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n\n // Call the factory function to get the ComponentObject\n return cached.component(this.runtimeContext);\n }\n\n if (!spec) {\n throw new Error(`Component not found in registry ${registryName}: ${namespace}/${name}@${version}`);\n }\n\n if (this.debug) {\n console.log(`✅ [ComponentRegistryService] Fetched spec from external registry: ${spec.name}`);\n }\n\n // Calculate hash of the fetched spec\n const specHash = await this.calculateSpecHash(spec);\n\n // Check if hash matches cached version (shouldn't happen if server works correctly)\n if (cached && cached.specHash === specHash) {\n if (this.debug) {\n console.log(`♻️ [ComponentRegistryService] Using cached compilation for: ${key} (hash match)`);\n }\n cached.lastUsed = new Date();\n cached.useCount++;\n\n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n\n // Call the factory function to get the ComponentObject\n return cached.component(this.runtimeContext);\n }\n\n // Spec has changed or is new, need to compile\n if (cached && this.debug) {\n console.log(\n `🔄 [ComponentRegistryService] Spec changed for: ${key}, recompiling (old hash: ${cached.specHash?.substring(0, 8)}..., new hash: ${specHash.substring(0, 8)}...)`\n );\n }\n\n // Load all libraries from metadata engine\n const allLibraries = this.componentEngine.ComponentLibraries || [];\n\n // Compile the component\n const compilationResult = await this.compiler.compile({\n componentName: spec.name,\n componentCode: spec.code || '',\n allLibraries: allLibraries,\n });\n\n if (!compilationResult.success || !compilationResult.component) {\n throw new Error(`Failed to compile component: ${compilationResult.error?.message || 'Unknown error'}`);\n }\n\n // Cache the compiled component with spec hash\n this.compiledComponentCache.set(key, {\n component: compilationResult.component.factory,\n metadata: {\n name: spec.name,\n namespace: spec.namespace || '',\n version: spec.version || '1.0.0',\n description: spec.description || '',\n type: spec.type,\n isLocal: false, // This is from an external registry\n },\n compiledAt: new Date(),\n lastUsed: new Date(),\n useCount: 1,\n specHash: specHash, // Store the hash for future comparison\n });\n\n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n\n if (this.debug) {\n console.log(`🎯 [ComponentRegistryService] Successfully compiled external component: ${spec.name}`);\n }\n\n // Call the factory function to get the ComponentObject\n return compilationResult.component.factory(this.runtimeContext);\n } catch (error) {\n console.error(`❌ [ComponentRegistryService] Failed to fetch from external registry:`, error);\n throw error;\n }\n }\n\n /**\n * Get component specification from database or external registry\n */\n async getComponentSpec(componentId: string, contextUser?: UserInfo): 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((r) => r.ID === component.SourceRegistryID);\n\n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n\n // Try GraphQL client first if available\n let spec: ComponentSpec;\n\n if (this.graphQLClient) {\n if (this.debug) {\n console.log(`Fetching from registry via GraphQL: ${component.Name}`);\n }\n\n const result = await this.graphQLClient.GetRegistryComponent({\n registryName: registry.Name,\n namespace: component.Namespace || '',\n name: component.Name,\n version: component.Version,\n });\n\n if (!result) {\n throw new Error(`Component not found in registry: ${component.Name}`);\n }\n\n spec = result;\n } else {\n // Fallback to direct HTTP if no GraphQL client\n spec = await this.fetchFromExternalRegistry(\n registry.URI || '',\n component.Name,\n component.Namespace || '',\n component.Version,\n this.getRegistryApiKey(registry.ID)\n );\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(componentId: string, spec: ComponentSpec, contextUser?: UserInfo): 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(\n `Failed to save cached component: ${componentEntity.Name}\\n${componentEntity.LatestResult.Message || componentEntity.LatestResult.Error || componentEntity.LatestResult.Errors?.join(',')}`\n );\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(componentId: string, contextUser?: UserInfo): Promise<ComponentDependencyInfo[]> {\n await this.initialize(contextUser);\n\n // Get dependencies from metadata cache\n const dependencies = this.componentEngine.ComponentDependencies?.filter((d) => d.ComponentID === componentId) || [];\n\n const result: ComponentDependencyInfo[] = [];\n\n for (const dep of dependencies) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === dep.DependencyComponentID);\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(componentId: string, contextUser?: UserInfo, visited = new Set<string>()): 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) =>\n 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(depComponent.ID, contextUser, visited);\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(rootComponentId: string, contextUser?: UserInfo): 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 * Force clear all compiled components\n * Used for Component Studio to ensure fresh loads\n */\n forceClearAll(): void {\n this.compiledComponentCache.clear();\n this.componentReferences.clear();\n console.log('🧹 Component cache force cleared');\n }\n\n /**\n * Reset the singleton instance\n * Forces new instance creation on next access\n */\n static reset(): void {\n if (ComponentRegistryService.instance) {\n ComponentRegistryService.instance.forceClearAll();\n ComponentRegistryService.instance = null;\n }\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}\n"]}
@@ -2,7 +2,7 @@ import { ComponentRegistry } from './component-registry';
2
2
  import { ComponentSpec } from '@memberjunction/interactive-component-types';
3
3
  import { ComponentCompiler } from '../compiler';
4
4
  import { RuntimeContext } from '../types';
5
- import { UserInfo } from '@memberjunction/core';
5
+ import { UserInfo } from '@memberjunction/global';
6
6
  export interface ResolvedComponents {
7
7
  [componentName: string]: any;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"component-resolver.d.ts","sourceRoot":"","sources":["../../src/registry/component-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,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,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMhD,MAAM,WAAW,kBAAkB;IACjC,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC;CAC9B;AAMD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,KAAK,CAAkB;gBAU7B,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,CAAC,EAAE,iBAAiB,EAC5B,cAAc,CAAC,EAAE,cAAc,EAC/B,KAAK,GAAE,OAAe;IAoBlB,iBAAiB,CACrB,IAAI,EAAE,aAAa,EACnB,SAAS,GAAE,MAAiB,EAC5B,WAAW,CAAC,EAAE,QAAQ,GACrB,OAAO,CAAC,kBAAkB,CAAC;YAgGhB,yBAAyB;IA8OvC,OAAO,IAAI,IAAI;IAiBf,oBAAoB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,GAAG,MAAM,EAAE;IAgBjF,O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E,KAAK,GAAE,OAAe;IAmBxH,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAsGjH,yBAAyB;IAqPvC,OAAO,IAAI,IAAI;IAiBf,oBAAoB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,GAAG,MAAM,EAAE;IAgBjF,OAAO,CAAC,iBAAiB;IAqBzB,kBAAkB,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAe9D,OAAO,CAAC,oBAAoB;IAoB5B,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE;IAuB3C,OAAO,CAAC,kBAAkB;IAmB1B,cAAc,CACZ,IAAI,EAAE,aAAa,EACnB,SAAS,GAAE,MAAiB,GAC3B,KAAK,CAAC;QACP,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,GAAG,CAAC;KAChB,CAAC;IAmBF,qBAAqB,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,EAAE;IAe3D,OAAO,CAAC,qBAAqB;CAW9B"}
@@ -27,13 +27,13 @@ class ComponentResolver {
27
27
  registry: spec.registry,
28
28
  namespace: spec.namespace,
29
29
  hasCode: !!spec.code,
30
- hasDependencies: !!(spec.dependencies && spec.dependencies.length > 0)
30
+ hasDependencies: !!(spec.dependencies && spec.dependencies.length > 0),
31
31
  });
32
32
  if (this.debug) {
33
- console.log(`📋 [ComponentResolver] Dependencies to resolve:`, (spec.dependencies || []).map(d => ({
33
+ console.log(`📋 [ComponentResolver] Dependencies to resolve:`, (spec.dependencies || []).map((d) => ({
34
34
  name: d.name,
35
35
  location: d.location,
36
- namespace: d.namespace
36
+ namespace: d.namespace,
37
37
  })));
38
38
  }
39
39
  const resolved = {};
@@ -83,10 +83,10 @@ class ComponentResolver {
83
83
  }
84
84
  }
85
85
  if (this.debug) {
86
- console.log(`🎯 [ComponentResolver] Final resolved components:`, Object.keys(unwrapped).map(name => ({
86
+ console.log(`🎯 [ComponentResolver] Final resolved components:`, Object.keys(unwrapped).map((name) => ({
87
87
  name,
88
88
  type: typeof unwrapped[name],
89
- isUndefined: unwrapped[name] === undefined
89
+ isUndefined: unwrapped[name] === undefined,
90
90
  })));
91
91
  }
92
92
  return unwrapped;
@@ -160,18 +160,17 @@ class ComponentResolver {
160
160
  Name: c.Name,
161
161
  Namespace: c.Namespace,
162
162
  Version: c.Version,
163
- Status: c.Status
163
+ Status: c.Status,
164
164
  })));
165
165
  }
166
- const component = this.componentEngine.Components?.find((c) => c.Name === spec.name &&
167
- c.Namespace === (spec.namespace || namespace));
166
+ const component = this.componentEngine.Components?.find((c) => c.Name === spec.name && c.Namespace === (spec.namespace || namespace));
168
167
  if (component) {
169
168
  if (this.debug) {
170
169
  console.log(`✅ [ComponentResolver] Found component in local DB:`, {
171
170
  ID: component.ID,
172
171
  Name: component.Name,
173
172
  Namespace: component.Namespace,
174
- Version: component.Version
173
+ Version: component.Version,
175
174
  });
176
175
  }
177
176
  const compiledComponent = await this.registryService.getCompiledComponent(component.ID, this.resolverInstanceId, contextUser);
@@ -206,7 +205,7 @@ class ComponentResolver {
206
205
  componentCode: spec.code,
207
206
  libraries: spec.libraries,
208
207
  dependencies: spec.dependencies,
209
- allLibraries: []
208
+ allLibraries: [],
210
209
  });
211
210
  if (compilationResult.success && compilationResult.component) {
212
211
  if (!this.runtimeContext) {
@@ -303,7 +302,7 @@ class ComponentResolver {
303
302
  return;
304
303
  visited.add(spec.name);
305
304
  const children = spec.dependencies || [];
306
- const dependencies = children.map(child => child.name);
305
+ const dependencies = children.map((child) => child.name);
307
306
  graph.set(spec.name, dependencies);
308
307
  for (const child of children) {
309
308
  this.buildDependencyGraph(child, graph, visited);
@@ -1 +1 @@
1
- {"version":3,"file":"component-resolver.js","sourceRoot":"","sources":["../../src/registry/component-resolver.ts"],"names":[],"mappings":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,CAAC;QAErD,OAAO,SAAS,CAAC;IACnB,CAAC;IAQO,qBAAqB,CAC3B,IAAmB,EACnB,SAA0B,EAC1B,OAAoB;QAEpB,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO;QACnC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErB,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;CACF;AA/jBD,8CA+jBC","sourcesContent":["/**\n * @fileoverview Component dependency resolver for managing component relationships.\n * Handles resolution of child components and dependency graphs.\n * @module @memberjunction/react-runtime/registry\n */\n\nimport { ComponentRegistry } from './component-registry';\nimport { ComponentRegistryService } from './component-registry-service';\nimport { ComponentSpec } from '@memberjunction/interactive-component-types';\nimport { ComponentCompiler } from '../compiler';\nimport { RuntimeContext } from '../types';\nimport { UserInfo } from '@memberjunction/core';\nimport { ComponentMetadataEngine } from '@memberjunction/core-entities';\n\n/**\n * Resolved component map for passing to React components\n */\nexport interface ResolvedComponents {\n [componentName: string]: any;\n}\n\n/**\n * Component dependency resolver.\n * Resolves component hierarchies and manages dependencies between components.\n */\nexport class ComponentResolver {\n private registry: ComponentRegistry;\n private registryService: ComponentRegistryService | null = null;\n private resolverInstanceId: string;\n private compiler: ComponentCompiler | null = null;\n private runtimeContext: RuntimeContext | null = null;\n private componentEngine = ComponentMetadataEngine.Instance;\n private debug: boolean = false;\n\n /**\n * Creates a new ComponentResolver instance\n * @param registry - Component registry to use for resolution\n * @param compiler - Optional compiler for registry-based components\n * @param runtimeContext - Optional runtime context for registry-based components\n * @param debug - Enable debug logging (defaults to false)\n */\n constructor(\n registry: ComponentRegistry,\n compiler?: ComponentCompiler,\n runtimeContext?: RuntimeContext,\n debug: boolean = false\n ) {\n this.registry = registry;\n this.resolverInstanceId = `resolver-${Date.now()}-${Math.random()}`;\n this.debug = debug;\n \n if (compiler && runtimeContext) {\n this.compiler = compiler;\n this.runtimeContext = runtimeContext;\n this.registryService = ComponentRegistryService.getInstance(compiler, runtimeContext, debug);\n }\n }\n\n /**\n * Resolves all components for a given component specification\n * @param spec - Root component specification\n * @param namespace - Namespace for component resolution\n * @param contextUser - Optional user context for database operations\n * @returns Map of component names to resolved components\n */\n async resolveComponents(\n spec: ComponentSpec, \n namespace: string = 'Global',\n contextUser?: UserInfo\n ): Promise<ResolvedComponents> {\n console.log(`🚀 [ComponentResolver] Starting component resolution for: ${spec.name}`);\n console.log(`📋 [ComponentResolver] Root component spec:`, {\n name: spec.name,\n location: spec.location,\n registry: spec.registry,\n namespace: spec.namespace,\n hasCode: !!spec.code,\n hasDependencies: !!(spec.dependencies && spec.dependencies.length > 0)\n });\n \n if (this.debug) {\n console.log(`📋 [ComponentResolver] Dependencies to resolve:`, (spec.dependencies || []).map(d => ({\n name: d.name,\n location: d.location,\n namespace: d.namespace\n })));\n }\n \n const resolved: ResolvedComponents = {};\n \n // Initialize component engine if we have registry service\n if (this.registryService) {\n if (this.debug) {\n console.log(`🔄 [ComponentResolver] Initializing component engine...`);\n }\n await this.componentEngine.Config(false, contextUser);\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Component engine initialized with ${this.componentEngine.Components?.length || 0} components`);\n }\n }\n \n // Resolve the component hierarchy\n console.log(`🔄 [ComponentResolver] About to call resolveComponentHierarchy for root: ${spec.name}`);\n await this.resolveComponentHierarchy(spec, resolved, namespace, new Set(), contextUser);\n console.log(`✅ [ComponentResolver] Returned from resolveComponentHierarchy`);\n console.log(`🔍 [ComponentResolver] Looking for root component '${spec.name}' in resolved:`, !!resolved[spec.name]);\n \n if (!resolved[spec.name]) {\n console.error(`❌ [ComponentResolver] Root component '${spec.name}' was NOT added to resolved map!`);\n console.log(`📦 [ComponentResolver] What IS in resolved map:`, Object.keys(resolved));\n }\n \n if (this.debug) {\n console.log(`📊 [ComponentResolver] Resolved components before unwrapping:`, Object.keys(resolved));\n }\n \n // Unwrap component wrappers before returning\n // Components from the registry come as objects with component/print/refresh properties\n // We need to extract just the component function for use in child components\n const unwrapped: ResolvedComponents = {};\n for (const [name, value] of Object.entries(resolved)) {\n if (value && typeof value === 'object' && 'component' in value) {\n if (typeof value.component === 'function') {\n // This is a wrapped component - extract the actual React component function\n unwrapped[name] = value.component;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Unwrapped component: ${name} (was object with .component)`);\n }\n } else {\n // ComponentObject has a component property but it's not a function\n console.error(`❌ [ComponentResolver] Component ${name} has invalid component property:`, typeof value.component, value);\n unwrapped[name] = value; // Pass through the problematic value so we can see the error\n }\n } else if (typeof value === 'function') {\n // Already a function - use as is\n unwrapped[name] = value;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Component already a function: ${name}`);\n }\n } else {\n // Something else - could be undefined or an error\n console.warn(`⚠️ [ComponentResolver] Component ${name} is not a function or wrapped component:`, typeof value, value);\n unwrapped[name] = value; // Pass through for debugging\n }\n }\n \n if (this.debug) {\n console.log(`🎯 [ComponentResolver] Final resolved components:`, Object.keys(unwrapped).map(name => ({\n name,\n type: typeof unwrapped[name],\n isUndefined: unwrapped[name] === undefined\n })));\n }\n \n return unwrapped;\n }\n\n /**\n * Recursively resolves a component hierarchy\n * @param spec - Component specification\n * @param resolved - Map to store resolved components\n * @param namespace - Namespace for resolution\n * @param visited - Set of visited component names to prevent cycles\n * @param contextUser - Optional user context for database operations\n */\n private async resolveComponentHierarchy(\n spec: ComponentSpec,\n resolved: ResolvedComponents,\n namespace: string,\n visited: Set<string> = new Set(),\n contextUser?: UserInfo\n ): Promise<void> {\n // Create a unique identifier for this component\n const componentId = `${spec.namespace || namespace}/${spec.name}@${spec.version || 'latest'}`;\n \n // Check if already resolved (not just visited)\n if (resolved[spec.name]) {\n if (this.debug) {\n console.log(`⏭️ [ComponentResolver] Component already resolved: ${spec.name}`);\n }\n return;\n }\n \n // Prevent circular dependencies\n if (visited.has(componentId)) {\n if (this.debug) {\n console.warn(`Circular dependency detected for component: ${componentId}`);\n }\n return;\n }\n visited.add(componentId);\n\n // *** CRITICAL: Process child components FIRST (depth-first, post-order) ***\n if (this.debug) {\n console.log(`🔄 [ComponentResolver] Resolving dependencies for ${spec.name} BEFORE resolving itself`);\n }\n const children = spec.dependencies || [];\n for (const child of children) {\n if (this.debug) {\n console.log(` ↳ [ComponentResolver] Resolving dependency: ${child.name} for parent ${spec.name}`);\n }\n await this.resolveComponentHierarchy(child, resolved, namespace, visited, contextUser);\n }\n if (children.length > 0 && this.debug) {\n console.log(`✅ [ComponentResolver] All ${children.length} dependencies resolved for ${spec.name}, now resolving itself`);\n }\n\n // NOW resolve the current component (it can access its dependencies)\n // Handle based on location\n if (spec.location === 'registry' && this.registryService) {\n // Registry component - need to load from database or external source\n if (this.debug) {\n console.log(`🔍 [ComponentResolver] Looking for registry component: ${spec.name} in namespace: ${spec.namespace || namespace}`);\n if (spec.registry) {\n console.log(` 📍 [ComponentResolver] External registry specified: ${spec.registry}`);\n } else {\n console.log(` 📍 [ComponentResolver] Local registry (no registry field specified)`);\n }\n }\n \n try {\n // If spec.registry is populated, this is an external registry component\n // If spec.registry is blank/undefined, this is a local registry component\n if (spec.registry) {\n // EXTERNAL REGISTRY: Need to fetch from external registry via GraphQL\n if (this.debug) {\n console.log(`🌐 [ComponentResolver] Fetching from external registry: ${spec.registry}`);\n }\n \n // Get compiled component from registry service (which will handle the external fetch)\n const compiledComponent = await this.registryService.getCompiledComponentFromRegistry(\n spec.registry, // Registry name\n spec.namespace || namespace,\n spec.name,\n spec.version || 'latest',\n this.resolverInstanceId,\n contextUser\n );\n \n if (compiledComponent) {\n resolved[spec.name] = compiledComponent;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Successfully fetched and compiled from external registry: ${spec.name}`);\n }\n } else {\n console.error(`❌ [ComponentResolver] Failed to fetch from external registry: ${spec.name} from ${spec.registry}`);\n }\n } else {\n // LOCAL REGISTRY: Get from local database\n if (this.debug) {\n console.log(`💾 [ComponentResolver] Looking for locally registered component`);\n }\n \n // First, try to find the component in the metadata engine\n const allComponents = this.componentEngine.Components || [];\n if (this.debug) {\n console.log(`📊 [ComponentResolver] Total components in engine: ${allComponents.length}`);\n }\n \n // Log all matching names to see duplicates\n const matchingNames = allComponents.filter((c: any) => c.Name === spec.name);\n if (matchingNames.length > 0 && this.debug) {\n console.log(`🔎 [ComponentResolver] Found ${matchingNames.length} components with name \"${spec.name}\":`, \n matchingNames.map((c: any) => ({\n ID: c.ID,\n Name: c.Name,\n Namespace: c.Namespace,\n Version: c.Version,\n Status: c.Status\n }))\n );\n }\n \n const component = this.componentEngine.Components?.find(\n (c: any) => c.Name === spec.name && \n c.Namespace === (spec.namespace || namespace)\n );\n \n if (component) {\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Found component in local DB:`, {\n ID: component.ID,\n Name: component.Name,\n Namespace: component.Namespace,\n Version: component.Version\n });\n }\n \n // Get compiled component from registry service (local compilation)\n const compiledComponent = await this.registryService.getCompiledComponent(\n component.ID,\n this.resolverInstanceId,\n contextUser\n );\n resolved[spec.name] = compiledComponent;\n if (this.debug) {\n console.log(`📦 [ComponentResolver] Successfully compiled and resolved local component: ${spec.name}, type: ${typeof compiledComponent}`);\n }\n } else {\n console.error(`❌ [ComponentResolver] Local registry component NOT found in database: ${spec.name} with namespace: ${spec.namespace || namespace}`);\n if (this.debug) {\n console.warn(`Local registry component not found in database: ${spec.name}`);\n }\n }\n }\n } catch (error) {\n if (this.debug) {\n console.error(`Failed to load registry component ${spec.name}:`, error);\n }\n }\n } else {\n // Embedded/Local component\n // Use the component's specified namespace if it has one, otherwise use parent's namespace\n const componentNamespace = spec.namespace || namespace;\n \n // First check if component has inline code that needs compilation\n if (spec.code && this.compiler) {\n if (this.debug) {\n console.log(`🔨 [ComponentResolver] Component ${spec.name} has inline code, compiling...`);\n }\n \n try {\n // Compile the component with its code\n const compilationResult = await this.compiler.compile({\n componentName: spec.name,\n componentCode: spec.code,\n libraries: spec.libraries,\n dependencies: spec.dependencies,\n allLibraries: [] // TODO: Get from ComponentMetadataEngine if needed\n });\n \n if (compilationResult.success && compilationResult.component) {\n // Get the component object from the factory (only if we have runtimeContext)\n if (!this.runtimeContext) {\n console.error(`❌ [ComponentResolver] Cannot compile without runtime context`);\n return;\n }\n const componentObject = compilationResult.component.factory(this.runtimeContext);\n \n // Register it in the local registry for future use\n this.registry.register(spec.name, componentObject, componentNamespace, spec.version || 'latest');\n \n // Add to resolved\n resolved[spec.name] = componentObject;\n \n if (this.debug) {\n console.log(`✅ [ComponentResolver] Successfully compiled and registered inline component: ${spec.name}`);\n }\n } else {\n console.error(`❌ [ComponentResolver] Failed to compile inline component ${spec.name}:`, compilationResult.error);\n }\n } catch (error) {\n console.error(`❌ [ComponentResolver] Error compiling inline component ${spec.name}:`, error);\n }\n } else {\n // No inline code, try to get from local registry\n if (this.debug) {\n console.log(`🔍 [ComponentResolver] Looking for embedded component: ${spec.name} in namespace: ${componentNamespace}`);\n }\n \n const component = this.registry.get(spec.name, componentNamespace);\n if (component) {\n resolved[spec.name] = component;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Found embedded component: ${spec.name}, type: ${typeof component}`);\n }\n if (this.debug) {\n console.log(`📄 Resolved embedded component: ${spec.name} from namespace ${componentNamespace}, type:`, typeof component);\n }\n } else {\n // If not found with specified namespace, try the parent namespace as fallback\n if (this.debug) {\n console.log(`⚠️ [ComponentResolver] Not found in namespace ${componentNamespace}, trying fallback namespace: ${namespace}`);\n }\n const fallbackComponent = this.registry.get(spec.name, namespace);\n if (fallbackComponent) {\n resolved[spec.name] = fallbackComponent;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Found embedded component in fallback namespace: ${spec.name}, type: ${typeof fallbackComponent}`);\n }\n if (this.debug) {\n console.log(`📄 Resolved embedded component: ${spec.name} from fallback namespace ${namespace}, type:`, typeof fallbackComponent);\n }\n } else {\n // Component not found - this might cause issues later\n console.error(`❌ [ComponentResolver] Could not resolve embedded component: ${spec.name} in namespace ${componentNamespace} or ${namespace}`);\n if (this.debug) {\n console.warn(`⚠️ Could not resolve embedded component: ${spec.name} in namespace ${componentNamespace} or ${namespace}`);\n }\n // Store undefined explicitly so we know it failed to resolve\n resolved[spec.name] = undefined;\n }\n }\n }\n }\n \n // Child components have already been processed at the beginning of this method\n // No need to process them again - we're using depth-first, post-order traversal\n }\n\n /**\n * Cleanup resolver resources\n */\n cleanup(): void {\n // Remove our references when resolver is destroyed\n if (this.registryService) {\n // This would allow the registry service to clean up unused components\n // Implementation would track which components this resolver referenced\n if (this.debug) {\n console.log(`Cleaning up resolver: ${this.resolverInstanceId}`);\n }\n }\n }\n\n /**\n * Validates that all required components are available\n * @param spec - Component specification to validate\n * @param namespace - Namespace for validation\n * @returns Array of missing component names\n */\n validateDependencies(spec: ComponentSpec, namespace: string = 'Global'): string[] {\n const missing: string[] = [];\n const checked = new Set<string>();\n \n this.checkDependencies(spec, namespace, missing, checked);\n \n return missing;\n }\n\n /**\n * Recursively checks for missing dependencies\n * @param spec - Component specification\n * @param namespace - Namespace for checking\n * @param missing - Array to collect missing components\n * @param checked - Set of already checked components\n */\n private checkDependencies(\n spec: ComponentSpec,\n namespace: string,\n missing: string[],\n checked: Set<string>\n ): void {\n if (checked.has(spec.name)) return;\n checked.add(spec.name);\n\n // Check if component exists in registry\n if (!this.registry.has(spec.name, namespace)) {\n missing.push(spec.name);\n }\n\n // Check children\n const children = spec.dependencies || [];\n for (const child of children) {\n this.checkDependencies(child, namespace, missing, checked);\n }\n }\n\n /**\n * Gets the dependency graph for a component specification\n * @param spec - Component specification\n * @returns Dependency graph as adjacency list\n */\n getDependencyGraph(spec: ComponentSpec): Map<string, string[]> {\n const graph = new Map<string, string[]>();\n const visited = new Set<string>();\n \n this.buildDependencyGraph(spec, graph, visited);\n \n return graph;\n }\n\n /**\n * Recursively builds the dependency graph\n * @param spec - Component specification\n * @param graph - Graph to build\n * @param visited - Set of visited components\n */\n private buildDependencyGraph(\n spec: ComponentSpec,\n graph: Map<string, string[]>,\n visited: Set<string>\n ): void {\n if (visited.has(spec.name)) return;\n visited.add(spec.name);\n\n const children = spec.dependencies || [];\n const dependencies = children.map(child => child.name);\n \n graph.set(spec.name, dependencies);\n\n // Recursively process children\n for (const child of children) {\n this.buildDependencyGraph(child, graph, visited);\n }\n }\n\n /**\n * Performs topological sort on component dependencies\n * @param spec - Root component specification\n * @returns Array of component names in dependency order\n */\n getLoadOrder(spec: ComponentSpec): string[] {\n const graph = this.getDependencyGraph(spec);\n const visited = new Set<string>();\n const stack: string[] = [];\n\n // Perform DFS on all nodes\n for (const node of graph.keys()) {\n if (!visited.has(node)) {\n this.topologicalSortDFS(node, graph, visited, stack);\n }\n }\n\n // Reverse to get correct load order\n return stack.reverse();\n }\n\n /**\n * DFS helper for topological sort\n * @param node - Current node\n * @param graph - Dependency graph\n * @param visited - Set of visited nodes\n * @param stack - Result stack\n */\n private topologicalSortDFS(\n node: string,\n graph: Map<string, string[]>,\n visited: Set<string>,\n stack: string[]\n ): void {\n visited.add(node);\n\n const dependencies = graph.get(node) || [];\n for (const dep of dependencies) {\n if (!visited.has(dep)) {\n this.topologicalSortDFS(dep, graph, visited, stack);\n }\n }\n\n stack.push(node);\n }\n\n /**\n * Resolves components in the correct dependency order\n * @param spec - Root component specification\n * @param namespace - Namespace for resolution\n * @returns Ordered array of resolved components\n */\n resolveInOrder(spec: ComponentSpec, namespace: string = 'Global'): Array<{\n name: string;\n component: any;\n }> {\n const loadOrder = this.getLoadOrder(spec);\n const resolved: Array<{ name: string; component: any }> = [];\n\n for (const name of loadOrder) {\n const component = this.registry.get(name, namespace);\n if (component) {\n resolved.push({ name, component });\n }\n }\n\n return resolved;\n }\n\n /**\n * Creates a flattened list of all component specifications\n * @param spec - Root component specification\n * @returns Array of all component specs in the hierarchy\n */\n flattenComponentSpecs(spec: ComponentSpec): ComponentSpec[] {\n const flattened: ComponentSpec[] = [];\n const visited = new Set<string>();\n\n this.collectComponentSpecs(spec, flattened, visited);\n\n return flattened;\n }\n\n /**\n * Recursively collects component specifications\n * @param spec - Current component specification\n * @param collected - Array to collect specs\n * @param visited - Set of visited component names\n */\n private collectComponentSpecs(\n spec: ComponentSpec,\n collected: ComponentSpec[],\n visited: Set<string>\n ): void {\n if (visited.has(spec.name)) return;\n visited.add(spec.name);\n\n collected.push(spec);\n\n const children = spec.dependencies || [];\n for (const child of children) {\n this.collectComponentSpecs(child, collected, visited);\n }\n }\n}"]}
1
+ {"version":3,"file":"component-resolver.js","sourceRoot":"","sources":["../../src/registry/component-resolver.ts"],"names":[],"mappings":";;;AAOA,6EAAwE;AAKxE,iEAAwE;AAaxE,MAAa,iBAAiB;IAgB5B,YAAY,QAA2B,EAAE,QAA4B,EAAE,cAA+B,EAAE,QAAiB,KAAK;QAdtH,oBAAe,GAAoC,IAAI,CAAC;QAExD,aAAQ,GAA6B,IAAI,CAAC;QAC1C,mBAAc,GAA0B,IAAI,CAAC;QAC7C,oBAAe,GAAG,uCAAuB,CAAC,QAAQ,CAAC;QACnD,UAAK,GAAY,KAAK,CAAC;QAU7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,YAAY,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACpE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,QAAQ,IAAI,cAAc,EAAE,CAAC;YAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;YACrC,IAAI,CAAC,eAAe,GAAG,qDAAwB,CAAC,WAAW,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC,CA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AAQ,GAA4C,EAAE,CAAC;QAE7D,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACrD,IAAI,SAAS,EAAE,CAAC;gBACd,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAOD,qBAAqB,CAAC,IAAmB;QACvC,MAAM,SAAS,GAAoB,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAElC,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAErD,OAAO,SAAS,CAAC;IACnB,CAAC;IAQO,qBAAqB,CAAC,IAAmB,EAAE,SAA0B,EAAE,OAAoB;QACjG,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO;QACnC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErB,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;CACF;AApjBD,8CAojBC","sourcesContent":["/**\n * @fileoverview Component dependency resolver for managing component relationships.\n * Handles resolution of child components and dependency graphs.\n * @module @memberjunction/react-runtime/registry\n */\n\nimport { ComponentRegistry } from './component-registry';\nimport { ComponentRegistryService } from './component-registry-service';\nimport { ComponentSpec } from '@memberjunction/interactive-component-types';\nimport { ComponentCompiler } from '../compiler';\nimport { RuntimeContext } from '../types';\nimport { UserInfo } from '@memberjunction/global';\nimport { ComponentMetadataEngine } from '@memberjunction/core-entities';\n\n/**\n * Resolved component map for passing to React components\n */\nexport interface ResolvedComponents {\n [componentName: string]: any;\n}\n\n/**\n * Component dependency resolver.\n * Resolves component hierarchies and manages dependencies between components.\n */\nexport class ComponentResolver {\n private registry: ComponentRegistry;\n private registryService: ComponentRegistryService | null = null;\n private resolverInstanceId: string;\n private compiler: ComponentCompiler | null = null;\n private runtimeContext: RuntimeContext | null = null;\n private componentEngine = ComponentMetadataEngine.Instance;\n private debug: boolean = false;\n\n /**\n * Creates a new ComponentResolver instance\n * @param registry - Component registry to use for resolution\n * @param compiler - Optional compiler for registry-based components\n * @param runtimeContext - Optional runtime context for registry-based components\n * @param debug - Enable debug logging (defaults to false)\n */\n constructor(registry: ComponentRegistry, compiler?: ComponentCompiler, runtimeContext?: RuntimeContext, debug: boolean = false) {\n this.registry = registry;\n this.resolverInstanceId = `resolver-${Date.now()}-${Math.random()}`;\n this.debug = debug;\n\n if (compiler && runtimeContext) {\n this.compiler = compiler;\n this.runtimeContext = runtimeContext;\n this.registryService = ComponentRegistryService.getInstance(compiler, runtimeContext, debug);\n }\n }\n\n /**\n * Resolves all components for a given component specification\n * @param spec - Root component specification\n * @param namespace - Namespace for component resolution\n * @param contextUser - Optional user context for database operations\n * @returns Map of component names to resolved components\n */\n async resolveComponents(spec: ComponentSpec, namespace: string = 'Global', contextUser?: UserInfo): Promise<ResolvedComponents> {\n console.log(`🚀 [ComponentResolver] Starting component resolution for: ${spec.name}`);\n console.log(`📋 [ComponentResolver] Root component spec:`, {\n name: spec.name,\n location: spec.location,\n registry: spec.registry,\n namespace: spec.namespace,\n hasCode: !!spec.code,\n hasDependencies: !!(spec.dependencies && spec.dependencies.length > 0),\n });\n\n if (this.debug) {\n console.log(\n `📋 [ComponentResolver] Dependencies to resolve:`,\n (spec.dependencies || []).map((d) => ({\n name: d.name,\n location: d.location,\n namespace: d.namespace,\n }))\n );\n }\n\n const resolved: ResolvedComponents = {};\n\n // Initialize component engine if we have registry service\n if (this.registryService) {\n if (this.debug) {\n console.log(`🔄 [ComponentResolver] Initializing component engine...`);\n }\n await this.componentEngine.Config(false, contextUser);\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Component engine initialized with ${this.componentEngine.Components?.length || 0} components`);\n }\n }\n\n // Resolve the component hierarchy\n console.log(`🔄 [ComponentResolver] About to call resolveComponentHierarchy for root: ${spec.name}`);\n await this.resolveComponentHierarchy(spec, resolved, namespace, new Set(), contextUser);\n console.log(`✅ [ComponentResolver] Returned from resolveComponentHierarchy`);\n console.log(`🔍 [ComponentResolver] Looking for root component '${spec.name}' in resolved:`, !!resolved[spec.name]);\n\n if (!resolved[spec.name]) {\n console.error(`❌ [ComponentResolver] Root component '${spec.name}' was NOT added to resolved map!`);\n console.log(`📦 [ComponentResolver] What IS in resolved map:`, Object.keys(resolved));\n }\n\n if (this.debug) {\n console.log(`📊 [ComponentResolver] Resolved components before unwrapping:`, Object.keys(resolved));\n }\n\n // Unwrap component wrappers before returning\n // Components from the registry come as objects with component/print/refresh properties\n // We need to extract just the component function for use in child components\n const unwrapped: ResolvedComponents = {};\n for (const [name, value] of Object.entries(resolved)) {\n if (value && typeof value === 'object' && 'component' in value) {\n if (typeof value.component === 'function') {\n // This is a wrapped component - extract the actual React component function\n unwrapped[name] = value.component;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Unwrapped component: ${name} (was object with .component)`);\n }\n } else {\n // ComponentObject has a component property but it's not a function\n console.error(`❌ [ComponentResolver] Component ${name} has invalid component property:`, typeof value.component, value);\n unwrapped[name] = value; // Pass through the problematic value so we can see the error\n }\n } else if (typeof value === 'function') {\n // Already a function - use as is\n unwrapped[name] = value;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Component already a function: ${name}`);\n }\n } else {\n // Something else - could be undefined or an error\n console.warn(`⚠️ [ComponentResolver] Component ${name} is not a function or wrapped component:`, typeof value, value);\n unwrapped[name] = value; // Pass through for debugging\n }\n }\n\n if (this.debug) {\n console.log(\n `🎯 [ComponentResolver] Final resolved components:`,\n Object.keys(unwrapped).map((name) => ({\n name,\n type: typeof unwrapped[name],\n isUndefined: unwrapped[name] === undefined,\n }))\n );\n }\n\n return unwrapped;\n }\n\n /**\n * Recursively resolves a component hierarchy\n * @param spec - Component specification\n * @param resolved - Map to store resolved components\n * @param namespace - Namespace for resolution\n * @param visited - Set of visited component names to prevent cycles\n * @param contextUser - Optional user context for database operations\n */\n private async resolveComponentHierarchy(\n spec: ComponentSpec,\n resolved: ResolvedComponents,\n namespace: string,\n visited: Set<string> = new Set(),\n contextUser?: UserInfo\n ): Promise<void> {\n // Create a unique identifier for this component\n const componentId = `${spec.namespace || namespace}/${spec.name}@${spec.version || 'latest'}`;\n\n // Check if already resolved (not just visited)\n if (resolved[spec.name]) {\n if (this.debug) {\n console.log(`⏭️ [ComponentResolver] Component already resolved: ${spec.name}`);\n }\n return;\n }\n\n // Prevent circular dependencies\n if (visited.has(componentId)) {\n if (this.debug) {\n console.warn(`Circular dependency detected for component: ${componentId}`);\n }\n return;\n }\n visited.add(componentId);\n\n // *** CRITICAL: Process child components FIRST (depth-first, post-order) ***\n if (this.debug) {\n console.log(`🔄 [ComponentResolver] Resolving dependencies for ${spec.name} BEFORE resolving itself`);\n }\n const children = spec.dependencies || [];\n for (const child of children) {\n if (this.debug) {\n console.log(` ↳ [ComponentResolver] Resolving dependency: ${child.name} for parent ${spec.name}`);\n }\n await this.resolveComponentHierarchy(child, resolved, namespace, visited, contextUser);\n }\n if (children.length > 0 && this.debug) {\n console.log(`✅ [ComponentResolver] All ${children.length} dependencies resolved for ${spec.name}, now resolving itself`);\n }\n\n // NOW resolve the current component (it can access its dependencies)\n // Handle based on location\n if (spec.location === 'registry' && this.registryService) {\n // Registry component - need to load from database or external source\n if (this.debug) {\n console.log(`🔍 [ComponentResolver] Looking for registry component: ${spec.name} in namespace: ${spec.namespace || namespace}`);\n if (spec.registry) {\n console.log(` 📍 [ComponentResolver] External registry specified: ${spec.registry}`);\n } else {\n console.log(` 📍 [ComponentResolver] Local registry (no registry field specified)`);\n }\n }\n\n try {\n // If spec.registry is populated, this is an external registry component\n // If spec.registry is blank/undefined, this is a local registry component\n if (spec.registry) {\n // EXTERNAL REGISTRY: Need to fetch from external registry via GraphQL\n if (this.debug) {\n console.log(`🌐 [ComponentResolver] Fetching from external registry: ${spec.registry}`);\n }\n\n // Get compiled component from registry service (which will handle the external fetch)\n const compiledComponent = await this.registryService.getCompiledComponentFromRegistry(\n spec.registry, // Registry name\n spec.namespace || namespace,\n spec.name,\n spec.version || 'latest',\n this.resolverInstanceId,\n contextUser\n );\n\n if (compiledComponent) {\n resolved[spec.name] = compiledComponent;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Successfully fetched and compiled from external registry: ${spec.name}`);\n }\n } else {\n console.error(`❌ [ComponentResolver] Failed to fetch from external registry: ${spec.name} from ${spec.registry}`);\n }\n } else {\n // LOCAL REGISTRY: Get from local database\n if (this.debug) {\n console.log(`💾 [ComponentResolver] Looking for locally registered component`);\n }\n\n // First, try to find the component in the metadata engine\n const allComponents = this.componentEngine.Components || [];\n if (this.debug) {\n console.log(`📊 [ComponentResolver] Total components in engine: ${allComponents.length}`);\n }\n\n // Log all matching names to see duplicates\n const matchingNames = allComponents.filter((c: any) => c.Name === spec.name);\n if (matchingNames.length > 0 && this.debug) {\n console.log(\n `🔎 [ComponentResolver] Found ${matchingNames.length} components with name \"${spec.name}\":`,\n matchingNames.map((c: any) => ({\n ID: c.ID,\n Name: c.Name,\n Namespace: c.Namespace,\n Version: c.Version,\n Status: c.Status,\n }))\n );\n }\n\n const component = this.componentEngine.Components?.find(\n (c: any) => c.Name === spec.name && c.Namespace === (spec.namespace || namespace)\n );\n\n if (component) {\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Found component in local DB:`, {\n ID: component.ID,\n Name: component.Name,\n Namespace: component.Namespace,\n Version: component.Version,\n });\n }\n\n // Get compiled component from registry service (local compilation)\n const compiledComponent = await this.registryService.getCompiledComponent(component.ID, this.resolverInstanceId, contextUser);\n resolved[spec.name] = compiledComponent;\n if (this.debug) {\n console.log(\n `📦 [ComponentResolver] Successfully compiled and resolved local component: ${spec.name}, type: ${typeof compiledComponent}`\n );\n }\n } else {\n console.error(\n `❌ [ComponentResolver] Local registry component NOT found in database: ${spec.name} with namespace: ${spec.namespace || namespace}`\n );\n if (this.debug) {\n console.warn(`Local registry component not found in database: ${spec.name}`);\n }\n }\n }\n } catch (error) {\n if (this.debug) {\n console.error(`Failed to load registry component ${spec.name}:`, error);\n }\n }\n } else {\n // Embedded/Local component\n // Use the component's specified namespace if it has one, otherwise use parent's namespace\n const componentNamespace = spec.namespace || namespace;\n\n // First check if component has inline code that needs compilation\n if (spec.code && this.compiler) {\n if (this.debug) {\n console.log(`🔨 [ComponentResolver] Component ${spec.name} has inline code, compiling...`);\n }\n\n try {\n // Compile the component with its code\n const compilationResult = await this.compiler.compile({\n componentName: spec.name,\n componentCode: spec.code,\n libraries: spec.libraries,\n dependencies: spec.dependencies,\n allLibraries: [], // TODO: Get from ComponentMetadataEngine if needed\n });\n\n if (compilationResult.success && compilationResult.component) {\n // Get the component object from the factory (only if we have runtimeContext)\n if (!this.runtimeContext) {\n console.error(`❌ [ComponentResolver] Cannot compile without runtime context`);\n return;\n }\n const componentObject = compilationResult.component.factory(this.runtimeContext);\n\n // Register it in the local registry for future use\n this.registry.register(spec.name, componentObject, componentNamespace, spec.version || 'latest');\n\n // Add to resolved\n resolved[spec.name] = componentObject;\n\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Successfully compiled and registered inline component: ${spec.name}`);\n }\n } else {\n console.error(`❌ [ComponentResolver] Failed to compile inline component ${spec.name}:`, compilationResult.error);\n }\n } catch (error) {\n console.error(`❌ [ComponentResolver] Error compiling inline component ${spec.name}:`, error);\n }\n } else {\n // No inline code, try to get from local registry\n if (this.debug) {\n console.log(`🔍 [ComponentResolver] Looking for embedded component: ${spec.name} in namespace: ${componentNamespace}`);\n }\n\n const component = this.registry.get(spec.name, componentNamespace);\n if (component) {\n resolved[spec.name] = component;\n if (this.debug) {\n console.log(`✅ [ComponentResolver] Found embedded component: ${spec.name}, type: ${typeof component}`);\n }\n if (this.debug) {\n console.log(`📄 Resolved embedded component: ${spec.name} from namespace ${componentNamespace}, type:`, typeof component);\n }\n } else {\n // If not found with specified namespace, try the parent namespace as fallback\n if (this.debug) {\n console.log(`⚠️ [ComponentResolver] Not found in namespace ${componentNamespace}, trying fallback namespace: ${namespace}`);\n }\n const fallbackComponent = this.registry.get(spec.name, namespace);\n if (fallbackComponent) {\n resolved[spec.name] = fallbackComponent;\n if (this.debug) {\n console.log(\n `✅ [ComponentResolver] Found embedded component in fallback namespace: ${spec.name}, type: ${typeof fallbackComponent}`\n );\n }\n if (this.debug) {\n console.log(\n `📄 Resolved embedded component: ${spec.name} from fallback namespace ${namespace}, type:`,\n typeof fallbackComponent\n );\n }\n } else {\n // Component not found - this might cause issues later\n console.error(\n `❌ [ComponentResolver] Could not resolve embedded component: ${spec.name} in namespace ${componentNamespace} or ${namespace}`\n );\n if (this.debug) {\n console.warn(`⚠️ Could not resolve embedded component: ${spec.name} in namespace ${componentNamespace} or ${namespace}`);\n }\n // Store undefined explicitly so we know it failed to resolve\n resolved[spec.name] = undefined;\n }\n }\n }\n }\n\n // Child components have already been processed at the beginning of this method\n // No need to process them again - we're using depth-first, post-order traversal\n }\n\n /**\n * Cleanup resolver resources\n */\n cleanup(): void {\n // Remove our references when resolver is destroyed\n if (this.registryService) {\n // This would allow the registry service to clean up unused components\n // Implementation would track which components this resolver referenced\n if (this.debug) {\n console.log(`Cleaning up resolver: ${this.resolverInstanceId}`);\n }\n }\n }\n\n /**\n * Validates that all required components are available\n * @param spec - Component specification to validate\n * @param namespace - Namespace for validation\n * @returns Array of missing component names\n */\n validateDependencies(spec: ComponentSpec, namespace: string = 'Global'): string[] {\n const missing: string[] = [];\n const checked = new Set<string>();\n\n this.checkDependencies(spec, namespace, missing, checked);\n\n return missing;\n }\n\n /**\n * Recursively checks for missing dependencies\n * @param spec - Component specification\n * @param namespace - Namespace for checking\n * @param missing - Array to collect missing components\n * @param checked - Set of already checked components\n */\n private checkDependencies(spec: ComponentSpec, namespace: string, missing: string[], checked: Set<string>): void {\n if (checked.has(spec.name)) return;\n checked.add(spec.name);\n\n // Check if component exists in registry\n if (!this.registry.has(spec.name, namespace)) {\n missing.push(spec.name);\n }\n\n // Check children\n const children = spec.dependencies || [];\n for (const child of children) {\n this.checkDependencies(child, namespace, missing, checked);\n }\n }\n\n /**\n * Gets the dependency graph for a component specification\n * @param spec - Component specification\n * @returns Dependency graph as adjacency list\n */\n getDependencyGraph(spec: ComponentSpec): Map<string, string[]> {\n const graph = new Map<string, string[]>();\n const visited = new Set<string>();\n\n this.buildDependencyGraph(spec, graph, visited);\n\n return graph;\n }\n\n /**\n * Recursively builds the dependency graph\n * @param spec - Component specification\n * @param graph - Graph to build\n * @param visited - Set of visited components\n */\n private buildDependencyGraph(spec: ComponentSpec, graph: Map<string, string[]>, visited: Set<string>): void {\n if (visited.has(spec.name)) return;\n visited.add(spec.name);\n\n const children = spec.dependencies || [];\n const dependencies = children.map((child) => child.name);\n\n graph.set(spec.name, dependencies);\n\n // Recursively process children\n for (const child of children) {\n this.buildDependencyGraph(child, graph, visited);\n }\n }\n\n /**\n * Performs topological sort on component dependencies\n * @param spec - Root component specification\n * @returns Array of component names in dependency order\n */\n getLoadOrder(spec: ComponentSpec): string[] {\n const graph = this.getDependencyGraph(spec);\n const visited = new Set<string>();\n const stack: string[] = [];\n\n // Perform DFS on all nodes\n for (const node of graph.keys()) {\n if (!visited.has(node)) {\n this.topologicalSortDFS(node, graph, visited, stack);\n }\n }\n\n // Reverse to get correct load order\n return stack.reverse();\n }\n\n /**\n * DFS helper for topological sort\n * @param node - Current node\n * @param graph - Dependency graph\n * @param visited - Set of visited nodes\n * @param stack - Result stack\n */\n private topologicalSortDFS(node: string, graph: Map<string, string[]>, visited: Set<string>, stack: string[]): void {\n visited.add(node);\n\n const dependencies = graph.get(node) || [];\n for (const dep of dependencies) {\n if (!visited.has(dep)) {\n this.topologicalSortDFS(dep, graph, visited, stack);\n }\n }\n\n stack.push(node);\n }\n\n /**\n * Resolves components in the correct dependency order\n * @param spec - Root component specification\n * @param namespace - Namespace for resolution\n * @returns Ordered array of resolved components\n */\n resolveInOrder(\n spec: ComponentSpec,\n namespace: string = 'Global'\n ): Array<{\n name: string;\n component: any;\n }> {\n const loadOrder = this.getLoadOrder(spec);\n const resolved: Array<{ name: string; component: any }> = [];\n\n for (const name of loadOrder) {\n const component = this.registry.get(name, namespace);\n if (component) {\n resolved.push({ name, component });\n }\n }\n\n return resolved;\n }\n\n /**\n * Creates a flattened list of all component specifications\n * @param spec - Root component specification\n * @returns Array of all component specs in the hierarchy\n */\n flattenComponentSpecs(spec: ComponentSpec): ComponentSpec[] {\n const flattened: ComponentSpec[] = [];\n const visited = new Set<string>();\n\n this.collectComponentSpecs(spec, flattened, visited);\n\n return flattened;\n }\n\n /**\n * Recursively collects component specifications\n * @param spec - Current component specification\n * @param collected - Array to collect specs\n * @param visited - Set of visited component names\n */\n private collectComponentSpecs(spec: ComponentSpec, collected: ComponentSpec[], visited: Set<string>): void {\n if (visited.has(spec.name)) return;\n visited.add(spec.name);\n\n collected.push(spec);\n\n const children = spec.dependencies || [];\n for (const child of children) {\n this.collectComponentSpecs(child, collected, visited);\n }\n }\n}\n"]}
@@ -2,7 +2,7 @@ import { RuntimeContext } from '../types';
2
2
  import { ComponentCompiler } from '../compiler';
3
3
  import { ComponentRegistry } from '../registry';
4
4
  import { ComponentSpec, ComponentStyles } from '@memberjunction/interactive-component-types';
5
- import { UserInfo } from '@memberjunction/core';
5
+ import { UserInfo } from '@memberjunction/global';
6
6
  import { ComponentLibraryEntity } from '@memberjunction/core-entities';
7
7
  export interface HierarchyRegistrationResult {
8
8
  success: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":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