@memberjunction/react-runtime 5.3.1 → 5.4.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.3.1",
3
+ "version": "5.4.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.3.1",
33
- "@memberjunction/global": "5.3.1",
34
- "@memberjunction/interactive-component-types": "5.3.1",
35
- "@memberjunction/core-entities": "5.3.1",
36
- "@memberjunction/graphql-dataprovider": "5.3.1",
32
+ "@memberjunction/core": "5.4.0",
33
+ "@memberjunction/global": "5.4.0",
34
+ "@memberjunction/interactive-component-types": "5.4.0",
35
+ "@memberjunction/core-entities": "5.4.0",
36
+ "@memberjunction/graphql-dataprovider": "5.4.0",
37
37
  "@babel/standalone": "^7.29.1",
38
38
  "rxjs": "^7.8.2"
39
39
  },
@@ -289,11 +289,27 @@ export class ComponentManager {
289
289
  location: rootSpec.location,
290
290
  registry: rootSpec.registry
291
291
  });
292
-
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
+
293
304
  try {
294
305
  // Initialize component engine if needed (skip in browser context where it doesn't exist)
295
306
  if (this.componentEngine && typeof this.componentEngine.Config === 'function') {
307
+ const engineConfigStart = Date.now();
308
+ console.log(`[DIAG][${hierarchyDiagTime}] loadHierarchy() calling componentEngine.Config()...`);
296
309
  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'}`);
297
313
  }
298
314
 
299
315
  // Load the root component and all its dependencies
@@ -533,25 +549,51 @@ export class ComponentManager {
533
549
  }
534
550
 
535
551
  // 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
+
536
561
  // Initialize GraphQL client if needed
537
562
  if (!this.graphQLClient) {
563
+ console.log(`[DIAG][${fetchDiagTime}] fetchComponentSpec() graphQLClient is null, calling initializeGraphQLClient()...`);
538
564
  await this.initializeGraphQLClient();
565
+ console.log(`[DIAG][${fetchDiagTime}] fetchComponentSpec() after initializeGraphQLClient(): graphQLClient is ${this.graphQLClient ? 'SET' : 'STILL NULL'}`);
539
566
  }
540
-
567
+
541
568
  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
+ });
542
574
  throw new Error('GraphQL client not available for registry fetching');
543
575
  }
544
-
576
+
545
577
  // Fetch from external registry
546
578
  this.log(`Fetching from external registry: ${spec.registry}/${spec.name}`);
547
-
579
+ console.log(`[DIAG][${fetchDiagTime}] fetchComponentSpec() calling GetRegistryComponent()...`);
580
+ const gqlStart = Date.now();
581
+
548
582
  const fullSpec = await this.graphQLClient.GetRegistryComponent({
549
583
  registryName: spec.registry,
550
584
  namespace: spec.namespace || 'Global',
551
585
  name: spec.name,
552
586
  version: spec.version || 'latest'
553
587
  });
554
-
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
+
555
597
  if (!fullSpec) {
556
598
  throw new Error(`Component not found in registry: ${spec.registry}/${spec.name}`);
557
599
  }
@@ -699,16 +741,33 @@ export class ComponentManager {
699
741
  * Initialize GraphQL client for registry operations
700
742
  */
701
743
  private async initializeGraphQLClient(): Promise<void> {
744
+ const diagTime = Date.now();
745
+ console.log(`[DIAG][${diagTime}] initializeGraphQLClient() ENTER`);
702
746
  try {
703
747
  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
+ });
704
755
  if (provider && (provider as any).ExecuteGQL) {
756
+ console.log(`[DIAG][${diagTime}] initializeGraphQLClient() provider check PASSED, importing GraphQLComponentRegistryClient...`);
757
+ const importStart = Date.now();
705
758
  const { GraphQLComponentRegistryClient } = await import('@memberjunction/graphql-dataprovider');
759
+ console.log(`[DIAG][${diagTime}] initializeGraphQLClient() import took ${Date.now() - importStart}ms`);
706
760
  this.graphQLClient = new GraphQLComponentRegistryClient(provider as any);
761
+ console.log(`[DIAG][${diagTime}] initializeGraphQLClient() SUCCESS - graphQLClient created`);
707
762
  this.log('GraphQL client initialized');
763
+ } else {
764
+ console.warn(`[DIAG][${diagTime}] initializeGraphQLClient() provider check FAILED - graphQLClient will remain null`);
708
765
  }
709
766
  } catch (error) {
767
+ console.error(`[DIAG][${diagTime}] initializeGraphQLClient() CAUGHT ERROR:`, error);
710
768
  LogError(`Failed to initialize GraphQL client: ${error instanceof Error ? error.message : String(error)}`);
711
769
  }
770
+ console.log(`[DIAG][${diagTime}] initializeGraphQLClient() EXIT - graphQLClient is ${this.graphQLClient ? 'SET' : 'NULL'} (took ${Date.now() - diagTime}ms)`);
712
771
  }
713
772
 
714
773
  /**