@memberjunction/server 2.93.0 → 2.95.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.
@@ -1741,12 +1741,12 @@ each time the agent processes a prompt step.`})
1741
1741
  @MaxLength(100)
1742
1742
  OverrideVendor?: string;
1743
1743
 
1744
- @Field(() => [AIAgentRun_])
1745
- MJ_AIAgentRuns_ParentRunIDArray: AIAgentRun_[]; // Link to MJ_AIAgentRuns
1746
-
1747
1744
  @Field(() => [AIAgentRunStep_])
1748
1745
  MJ_AIAgentRunSteps_AgentRunIDArray: AIAgentRunStep_[]; // Link to MJ_AIAgentRunSteps
1749
1746
 
1747
+ @Field(() => [AIAgentRun_])
1748
+ MJ_AIAgentRuns_ParentRunIDArray: AIAgentRun_[]; // Link to MJ_AIAgentRuns
1749
+
1750
1750
  @Field(() => [AIPromptRun_])
1751
1751
  MJ_AIPromptRuns_AgentRunIDArray: AIPromptRun_[]; // Link to MJ_AIPromptRuns
1752
1752
 
@@ -2048,25 +2048,25 @@ export class AIAgentRunResolver extends ResolverBase {
2048
2048
  return result;
2049
2049
  }
2050
2050
 
2051
- @FieldResolver(() => [AIAgentRun_])
2052
- async MJ_AIAgentRuns_ParentRunIDArray(@Root() aiagentrun_: AIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2053
- this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
2051
+ @FieldResolver(() => [AIAgentRunStep_])
2052
+ async MJ_AIAgentRunSteps_AgentRunIDArray(@Root() aiagentrun_: AIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2053
+ this.CheckUserReadPermissions('MJ: AI Agent Run Steps', userPayload);
2054
2054
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2055
2055
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2056
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRuns] WHERE [ParentRunID]='${aiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
2056
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRunSteps] WHERE [AgentRunID]='${aiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Run Steps', userPayload, EntityPermissionType.Read, 'AND');
2057
2057
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2058
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows);
2058
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Run Steps', rows);
2059
2059
  return result;
2060
2060
  }
2061
2061
 
2062
- @FieldResolver(() => [AIAgentRunStep_])
2063
- async MJ_AIAgentRunSteps_AgentRunIDArray(@Root() aiagentrun_: AIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2064
- this.CheckUserReadPermissions('MJ: AI Agent Run Steps', userPayload);
2062
+ @FieldResolver(() => [AIAgentRun_])
2063
+ async MJ_AIAgentRuns_ParentRunIDArray(@Root() aiagentrun_: AIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2064
+ this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
2065
2065
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2066
2066
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2067
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRunSteps] WHERE [AgentRunID]='${aiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Run Steps', userPayload, EntityPermissionType.Read, 'AND');
2067
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRuns] WHERE [ParentRunID]='${aiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
2068
2068
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2069
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Run Steps', rows);
2069
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows);
2070
2070
  return result;
2071
2071
  }
2072
2072
 
@@ -2408,15 +2408,15 @@ export class AIConfiguration_ {
2408
2408
  @Field(() => [AIAgentPrompt_])
2409
2409
  MJ_AIAgentPrompts_ConfigurationIDArray: AIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
2410
2410
 
2411
- @Field(() => [AIPromptRun_])
2412
- MJ_AIPromptRuns_ConfigurationIDArray: AIPromptRun_[]; // Link to MJ_AIPromptRuns
2413
-
2414
2411
  @Field(() => [AIPromptModel_])
2415
2412
  MJ_AIPromptModels_ConfigurationIDArray: AIPromptModel_[]; // Link to MJ_AIPromptModels
2416
2413
 
2417
2414
  @Field(() => [AIResultCache_])
2418
2415
  AIResultCache_ConfigurationIDArray: AIResultCache_[]; // Link to AIResultCache
2419
2416
 
2417
+ @Field(() => [AIPromptRun_])
2418
+ MJ_AIPromptRuns_ConfigurationIDArray: AIPromptRun_[]; // Link to MJ_AIPromptRuns
2419
+
2420
2420
  @Field(() => [AIAgentRun_])
2421
2421
  MJ_AIAgentRuns_ConfigurationIDArray: AIAgentRun_[]; // Link to MJ_AIAgentRuns
2422
2422
 
@@ -2560,17 +2560,6 @@ export class AIConfigurationResolver extends ResolverBase {
2560
2560
  return result;
2561
2561
  }
2562
2562
 
2563
- @FieldResolver(() => [AIPromptRun_])
2564
- async MJ_AIPromptRuns_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2565
- this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
2566
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2567
- const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2568
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ConfigurationID]='${aiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
2569
- const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2570
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows);
2571
- return result;
2572
- }
2573
-
2574
2563
  @FieldResolver(() => [AIPromptModel_])
2575
2564
  async MJ_AIPromptModels_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2576
2565
  this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
@@ -2593,6 +2582,17 @@ export class AIConfigurationResolver extends ResolverBase {
2593
2582
  return result;
2594
2583
  }
2595
2584
 
2585
+ @FieldResolver(() => [AIPromptRun_])
2586
+ async MJ_AIPromptRuns_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2587
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
2588
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2589
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2590
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ConfigurationID]='${aiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
2591
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2592
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows);
2593
+ return result;
2594
+ }
2595
+
2596
2596
  @FieldResolver(() => [AIAgentRun_])
2597
2597
  async MJ_AIAgentRuns_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2598
2598
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
@@ -5123,12 +5123,12 @@ export class AIPrompt_ {
5123
5123
  @Field(() => [AIPrompt_])
5124
5124
  AIPrompts_ResultSelectorPromptIDArray: AIPrompt_[]; // Link to AIPrompts
5125
5125
 
5126
- @Field(() => [AIAgentPrompt_])
5127
- MJ_AIAgentPrompts_PromptIDArray: AIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
5128
-
5129
5126
  @Field(() => [AIPromptModel_])
5130
5127
  MJ_AIPromptModels_PromptIDArray: AIPromptModel_[]; // Link to MJ_AIPromptModels
5131
5128
 
5129
+ @Field(() => [AIAgentPrompt_])
5130
+ MJ_AIAgentPrompts_PromptIDArray: AIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
5131
+
5132
5132
  @Field(() => [AIAgentStep_])
5133
5133
  MJ_AIAgentSteps_PromptIDArray: AIAgentStep_[]; // Link to MJ_AIAgentSteps
5134
5134
 
@@ -5563,25 +5563,25 @@ export class AIPromptResolver extends ResolverBase {
5563
5563
  return result;
5564
5564
  }
5565
5565
 
5566
- @FieldResolver(() => [AIAgentPrompt_])
5567
- async MJ_AIAgentPrompts_PromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5568
- this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
5566
+ @FieldResolver(() => [AIPromptModel_])
5567
+ async MJ_AIPromptModels_PromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5568
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
5569
5569
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5570
5570
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5571
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [PromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
5571
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [PromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
5572
5572
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5573
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', rows);
5573
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
5574
5574
  return result;
5575
5575
  }
5576
5576
 
5577
- @FieldResolver(() => [AIPromptModel_])
5578
- async MJ_AIPromptModels_PromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5579
- this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
5577
+ @FieldResolver(() => [AIAgentPrompt_])
5578
+ async MJ_AIAgentPrompts_PromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5579
+ this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
5580
5580
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5581
5581
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5582
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [PromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
5582
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [PromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
5583
5583
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5584
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
5584
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', rows);
5585
5585
  return result;
5586
5586
  }
5587
5587
 
@@ -39161,6 +39161,9 @@ export class ComponentLibrary_ {
39161
39161
  @Field({nullable: true, description: `JSON configuration for library-specific lint rules that are applied during component validation. This field contains structured rules that define how components using this library should be validated, including DOM element requirements, initialization patterns, lifecycle methods, and common error patterns. Example structure: {"initialization": {"constructorName": "Chart", "elementType": "canvas"}, "lifecycle": {"requiredMethods": ["render"], "cleanupMethods": ["destroy"]}}. The linter dynamically applies these rules based on the libraries referenced in a component spec, enabling extensible validation without hardcoding library-specific logic.`})
39162
39162
  LintRules?: string;
39163
39163
 
39164
+ @Field({nullable: true, description: `JSON object defining dependencies for this component library. Format: { "libraryName": "versionSpec", ... }. Version specifications follow NPM-style syntax (e.g., "~1.0.0", "^1.2.3", "2.3.4"). Dependencies are loaded before this library to ensure proper execution context.`})
39165
+ Dependencies?: string;
39166
+
39164
39167
  @Field(() => [ComponentLibraryLink_])
39165
39168
  MJ_ComponentLibraryLinks_LibraryIDArray: ComponentLibraryLink_[]; // Link to MJ_ComponentLibraryLinks
39166
39169
 
@@ -39203,6 +39206,9 @@ export class CreateComponentLibraryInput {
39203
39206
 
39204
39207
  @Field({ nullable: true })
39205
39208
  LintRules: string | null;
39209
+
39210
+ @Field({ nullable: true })
39211
+ Dependencies: string | null;
39206
39212
  }
39207
39213
 
39208
39214
 
@@ -39244,6 +39250,9 @@ export class UpdateComponentLibraryInput {
39244
39250
  @Field({ nullable: true })
39245
39251
  LintRules?: string | null;
39246
39252
 
39253
+ @Field({ nullable: true })
39254
+ Dependencies?: string | null;
39255
+
39247
39256
  @Field(() => [KeyValuePairInput], { nullable: true })
39248
39257
  OldValues___?: KeyValuePairInput[];
39249
39258
  }
@@ -581,7 +581,16 @@ export class RunViewResolver extends ResolverBase {
581
581
  try {
582
582
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
583
583
  const rawData = await super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
584
- if (rawData === null) return null;
584
+ if (rawData === null) {
585
+ return {
586
+ Results: [],
587
+ Success: false,
588
+ ErrorMessage: `Failed to execute view: ${input.ViewName}`,
589
+ RowCount: 0,
590
+ TotalRowCount: 0,
591
+ ExecutionTime: 0
592
+ };
593
+ }
585
594
 
586
595
  const entity = provider.Entities.find((e) => e.Name === input.ViewName);
587
596
  const entityId = entity ? entity.ID : null;
@@ -596,8 +605,16 @@ export class RunViewResolver extends ResolverBase {
596
605
  ErrorMessage: rawData?.ErrorMessage,
597
606
  };
598
607
  } catch (err) {
608
+ const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred';
599
609
  LogError(err);
600
- return null;
610
+ return {
611
+ Results: [],
612
+ Success: false,
613
+ ErrorMessage: errorMessage,
614
+ RowCount: 0,
615
+ TotalRowCount: 0,
616
+ ExecutionTime: 0
617
+ };
601
618
  }
602
619
  }
603
620
 
@@ -611,7 +628,16 @@ export class RunViewResolver extends ResolverBase {
611
628
  try {
612
629
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
613
630
  const rawData = await super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
614
- if (rawData === null) return null;
631
+ if (rawData === null) {
632
+ return {
633
+ Results: [],
634
+ Success: false,
635
+ ErrorMessage: `Failed to execute view with ID: ${input.ViewID}`,
636
+ RowCount: 0,
637
+ TotalRowCount: 0,
638
+ ExecutionTime: 0
639
+ };
640
+ }
615
641
 
616
642
  const viewInfo = super.safeFirstArrayElement<UserViewEntityExtended>(await super.findBy<UserViewEntityExtended>(provider, "User Views", { ID: input.ViewID }, userPayload.userRecord));
617
643
  const returnData = this.processRawData(rawData.Results, viewInfo.EntityID);
@@ -625,8 +651,16 @@ export class RunViewResolver extends ResolverBase {
625
651
  ErrorMessage: rawData?.ErrorMessage,
626
652
  };
627
653
  } catch (err) {
654
+ const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred';
628
655
  LogError(err);
629
- return null;
656
+ return {
657
+ Results: [],
658
+ Success: false,
659
+ ErrorMessage: errorMessage,
660
+ RowCount: 0,
661
+ TotalRowCount: 0,
662
+ ExecutionTime: 0
663
+ };
630
664
  }
631
665
  }
632
666
 
@@ -640,12 +674,29 @@ export class RunViewResolver extends ResolverBase {
640
674
  try {
641
675
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
642
676
  const rawData = await super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
643
- if (rawData === null) return null;
677
+ if (rawData === null) {
678
+ return {
679
+ Results: [],
680
+ Success: false,
681
+ ErrorMessage: 'Failed to execute dynamic view',
682
+ RowCount: 0,
683
+ TotalRowCount: 0,
684
+ ExecutionTime: 0
685
+ };
686
+ }
644
687
 
645
688
  const entity = provider.Entities.find((e) => e.Name === input.EntityName);
646
689
  if (!entity) {
647
- LogError(new Error(`Entity with name ${input.EntityName} not found`));
648
- return null;
690
+ const errorMsg = `Entity ${input.EntityName} not found in metadata`;
691
+ LogError(new Error(errorMsg));
692
+ return {
693
+ Results: [],
694
+ Success: false,
695
+ ErrorMessage: errorMsg,
696
+ RowCount: 0,
697
+ TotalRowCount: 0,
698
+ ExecutionTime: 0
699
+ };
649
700
  }
650
701
  const returnData = this.processRawData(rawData.Results, entity.ID);
651
702
  return {
@@ -658,8 +709,16 @@ export class RunViewResolver extends ResolverBase {
658
709
  ErrorMessage: rawData?.ErrorMessage,
659
710
  };
660
711
  } catch (err) {
712
+ const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred';
661
713
  LogError(err);
662
- return null;
714
+ return {
715
+ Results: [],
716
+ Success: false,
717
+ ErrorMessage: errorMessage,
718
+ RowCount: 0,
719
+ TotalRowCount: 0,
720
+ ExecutionTime: 0
721
+ };
663
722
  }
664
723
  }
665
724