@memberjunction/react-runtime 5.4.1 → 5.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/react-runtime",
3
- "version": "5.4.1",
3
+ "version": "5.5.0",
4
4
  "description": "Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,11 +29,11 @@
29
29
  },
30
30
  "homepage": "https://github.com/MemberJunction/MJ#readme",
31
31
  "dependencies": {
32
- "@memberjunction/core": "5.4.1",
33
- "@memberjunction/global": "5.4.1",
34
- "@memberjunction/interactive-component-types": "5.4.1",
35
- "@memberjunction/core-entities": "5.4.1",
36
- "@memberjunction/graphql-dataprovider": "5.4.1",
32
+ "@memberjunction/core": "5.5.0",
33
+ "@memberjunction/global": "5.5.0",
34
+ "@memberjunction/interactive-component-types": "5.5.0",
35
+ "@memberjunction/core-entities": "5.5.0",
36
+ "@memberjunction/graphql-dataprovider": "5.5.0",
37
37
  "@babel/standalone": "^7.29.1",
38
38
  "rxjs": "^7.8.2"
39
39
  },
@@ -289,27 +289,11 @@ export class ComponentManager {
289
289
  location: rootSpec.location,
290
290
  registry: rootSpec.registry
291
291
  });
292
-
293
- const hierarchyDiagTime = Date.now();
294
- console.log(`[DIAG][${hierarchyDiagTime}] loadHierarchy() ENTER for ${rootSpec.name}`, {
295
- location: rootSpec.location,
296
- registry: rootSpec.registry,
297
- namespace: rootSpec.namespace,
298
- version: rootSpec.version,
299
- providerExists: !!Metadata?.Provider,
300
- providerType: Metadata?.Provider ? Metadata.Provider.constructor?.name : 'N/A',
301
- graphQLClientExists: !!this.graphQLClient
302
- });
303
-
292
+
304
293
  try {
305
294
  // Initialize component engine if needed (skip in browser context where it doesn't exist)
306
295
  if (this.componentEngine && typeof this.componentEngine.Config === 'function') {
307
- const engineConfigStart = Date.now();
308
- console.log(`[DIAG][${hierarchyDiagTime}] loadHierarchy() calling componentEngine.Config()...`);
309
296
  await this.componentEngine.Config(false, options.contextUser);
310
- console.log(`[DIAG][${hierarchyDiagTime}] loadHierarchy() componentEngine.Config() completed in ${Date.now() - engineConfigStart}ms`);
311
- } else {
312
- console.log(`[DIAG][${hierarchyDiagTime}] loadHierarchy() SKIPPING componentEngine.Config() - engine: ${!!this.componentEngine}, hasConfig: ${this.componentEngine ? typeof this.componentEngine.Config === 'function' : 'N/A'}`);
313
297
  }
314
298
 
315
299
  // Load the root component and all its dependencies
@@ -549,51 +533,25 @@ export class ComponentManager {
549
533
  }
550
534
 
551
535
  // Handle EXTERNAL registry components (registry has a name)
552
- const fetchDiagTime = Date.now();
553
- console.log(`[DIAG][${fetchDiagTime}] fetchComponentSpec() EXTERNAL path for ${spec.registry}/${spec.name}`, {
554
- graphQLClientExists: !!this.graphQLClient,
555
- registryName: spec.registry,
556
- namespace: spec.namespace,
557
- name: spec.name,
558
- version: spec.version
559
- });
560
-
561
536
  // Initialize GraphQL client if needed
562
537
  if (!this.graphQLClient) {
563
- console.log(`[DIAG][${fetchDiagTime}] fetchComponentSpec() graphQLClient is null, calling initializeGraphQLClient()...`);
564
538
  await this.initializeGraphQLClient();
565
- console.log(`[DIAG][${fetchDiagTime}] fetchComponentSpec() after initializeGraphQLClient(): graphQLClient is ${this.graphQLClient ? 'SET' : 'STILL NULL'}`);
566
539
  }
567
-
540
+
568
541
  if (!this.graphQLClient) {
569
- console.error(`[DIAG][${fetchDiagTime}] fetchComponentSpec() FATAL: GraphQL client not available after init attempt. Provider state:`, {
570
- metadataExists: !!Metadata,
571
- providerExists: !!Metadata?.Provider,
572
- providerType: Metadata?.Provider ? Metadata.Provider.constructor?.name : 'N/A'
573
- });
574
542
  throw new Error('GraphQL client not available for registry fetching');
575
543
  }
576
-
544
+
577
545
  // Fetch from external registry
578
546
  this.log(`Fetching from external registry: ${spec.registry}/${spec.name}`);
579
- console.log(`[DIAG][${fetchDiagTime}] fetchComponentSpec() calling GetRegistryComponent()...`);
580
- const gqlStart = Date.now();
581
-
547
+
582
548
  const fullSpec = await this.graphQLClient.GetRegistryComponent({
583
549
  registryName: spec.registry,
584
550
  namespace: spec.namespace || 'Global',
585
551
  name: spec.name,
586
552
  version: spec.version || 'latest'
587
553
  });
588
-
589
- console.log(`[DIAG][${fetchDiagTime}] fetchComponentSpec() GetRegistryComponent() returned in ${Date.now() - gqlStart}ms:`, {
590
- resultIsNull: fullSpec === null,
591
- resultIsUndefined: fullSpec === undefined,
592
- resultType: fullSpec ? typeof fullSpec : 'N/A',
593
- hasName: fullSpec ? !!fullSpec.name : false,
594
- hasCode: fullSpec ? !!fullSpec.code : false
595
- });
596
-
554
+
597
555
  if (!fullSpec) {
598
556
  throw new Error(`Component not found in registry: ${spec.registry}/${spec.name}`);
599
557
  }
@@ -741,33 +699,16 @@ export class ComponentManager {
741
699
  * Initialize GraphQL client for registry operations
742
700
  */
743
701
  private async initializeGraphQLClient(): Promise<void> {
744
- const diagTime = Date.now();
745
- console.log(`[DIAG][${diagTime}] initializeGraphQLClient() ENTER`);
746
702
  try {
747
703
  const provider = Metadata?.Provider;
748
- console.log(`[DIAG][${diagTime}] initializeGraphQLClient() provider check:`, {
749
- metadataExists: !!Metadata,
750
- providerExists: !!provider,
751
- providerType: provider ? provider.constructor?.name : 'N/A',
752
- hasExecuteGQL: provider ? 'ExecuteGQL' in provider : false,
753
- typeofExecuteGQL: provider && 'ExecuteGQL' in provider ? typeof provider.ExecuteGQL : 'N/A'
754
- });
755
704
  if (provider && (provider as any).ExecuteGQL) {
756
- console.log(`[DIAG][${diagTime}] initializeGraphQLClient() provider check PASSED, importing GraphQLComponentRegistryClient...`);
757
- const importStart = Date.now();
758
705
  const { GraphQLComponentRegistryClient } = await import('@memberjunction/graphql-dataprovider');
759
- console.log(`[DIAG][${diagTime}] initializeGraphQLClient() import took ${Date.now() - importStart}ms`);
760
706
  this.graphQLClient = new GraphQLComponentRegistryClient(provider as any);
761
- console.log(`[DIAG][${diagTime}] initializeGraphQLClient() SUCCESS - graphQLClient created`);
762
707
  this.log('GraphQL client initialized');
763
- } else {
764
- console.warn(`[DIAG][${diagTime}] initializeGraphQLClient() provider check FAILED - graphQLClient will remain null`);
765
708
  }
766
709
  } catch (error) {
767
- console.error(`[DIAG][${diagTime}] initializeGraphQLClient() CAUGHT ERROR:`, error);
768
710
  LogError(`Failed to initialize GraphQL client: ${error instanceof Error ? error.message : String(error)}`);
769
711
  }
770
- console.log(`[DIAG][${diagTime}] initializeGraphQLClient() EXIT - graphQLClient is ${this.graphQLClient ? 'SET' : 'NULL'} (took ${Date.now() - diagTime}ms)`);
771
712
  }
772
713
 
773
714
  /**
@@ -14,6 +14,7 @@ import {
14
14
  RegistryComponentMetadata
15
15
  } from './registry-provider';
16
16
  import { UserInfo, Metadata } from '@memberjunction/core';
17
+ import { UUIDsEqual } from '@memberjunction/global';
17
18
  import {
18
19
  MJComponentEntity,
19
20
  MJComponentRegistryEntity,
@@ -219,11 +220,11 @@ export class ComponentRegistryService {
219
220
  await this.initialize(contextUser);
220
221
 
221
222
  // Find component in metadata
222
- const component = this.componentEngine.Components.find((c: MJComponentEntity) => c.ID === componentId);
223
+ const component = this.componentEngine.Components.find((c: MJComponentEntity) => UUIDsEqual(c.ID, componentId));
223
224
  if (!component) {
224
225
  throw new Error(`Component not found: ${componentId}`);
225
226
  }
226
-
227
+
227
228
  const key = this.getComponentKey(component.Name, component.Namespace, component.Version, component.SourceRegistryID);
228
229
 
229
230
  // Check if already compiled and cached
@@ -473,11 +474,11 @@ export class ComponentRegistryService {
473
474
  ): Promise<ComponentSpec> {
474
475
  await this.initialize(contextUser);
475
476
 
476
- const component = this.componentEngine.Components.find((c: MJComponentEntity) => c.ID === componentId);
477
+ const component = this.componentEngine.Components.find((c: MJComponentEntity) => UUIDsEqual(c.ID, componentId));
477
478
  if (!component) {
478
479
  throw new Error(`Component not found: ${componentId}`);
479
480
  }
480
-
481
+
481
482
  if (!component.SourceRegistryID) {
482
483
  // LOCAL: Use specification from database
483
484
  if (!component.Specification) {
@@ -497,7 +498,7 @@ export class ComponentRegistryService {
497
498
 
498
499
  // Need to fetch from external registry
499
500
  const registry = this.componentEngine.ComponentRegistries?.find(
500
- r => r.ID === component.SourceRegistryID
501
+ r => UUIDsEqual(r.ID, component.SourceRegistryID)
501
502
  );
502
503
 
503
504
  if (!registry) {
@@ -676,7 +677,7 @@ export class ComponentRegistryService {
676
677
 
677
678
  // Get dependencies from metadata cache
678
679
  const dependencies = this.componentEngine.ComponentDependencies?.filter(
679
- d => d.ComponentID === componentId
680
+ d => UUIDsEqual(d.ComponentID, componentId)
680
681
  ) || [];
681
682
 
682
683
  const result: ComponentDependencyInfo[] = [];
@@ -684,7 +685,7 @@ export class ComponentRegistryService {
684
685
  for (const dep of dependencies) {
685
686
  // Find the dependency component
686
687
  const depComponent = this.componentEngine.Components.find(
687
- (c: MJComponentEntity) => c.ID === dep.DependencyComponentID
688
+ (c: MJComponentEntity) => UUIDsEqual(c.ID, dep.DependencyComponentID)
688
689
  );
689
690
 
690
691
  if (depComponent) {
@@ -720,7 +721,7 @@ export class ComponentRegistryService {
720
721
 
721
722
  await this.initialize(contextUser);
722
723
 
723
- const component = this.componentEngine.Components.find((c: MJComponentEntity) => c.ID === componentId);
724
+ const component = this.componentEngine.Components.find((c: MJComponentEntity) => UUIDsEqual(c.ID, componentId));
724
725
  if (!component) {
725
726
  return { componentId, dependencies: [] };
726
727
  }