@memberjunction/server 2.114.0 → 2.116.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 (36) hide show
  1. package/dist/agents/skip-agent.d.ts.map +1 -1
  2. package/dist/agents/skip-agent.js +2 -1
  3. package/dist/agents/skip-agent.js.map +1 -1
  4. package/dist/agents/skip-sdk.d.ts +0 -1
  5. package/dist/agents/skip-sdk.d.ts.map +1 -1
  6. package/dist/agents/skip-sdk.js +1 -52
  7. package/dist/agents/skip-sdk.js.map +1 -1
  8. package/dist/auth/exampleNewUserSubClass.d.ts +2 -1
  9. package/dist/auth/exampleNewUserSubClass.d.ts.map +1 -1
  10. package/dist/auth/exampleNewUserSubClass.js.map +1 -1
  11. package/dist/generated/generated.d.ts +28 -10
  12. package/dist/generated/generated.d.ts.map +1 -1
  13. package/dist/generated/generated.js +178 -88
  14. package/dist/generated/generated.js.map +1 -1
  15. package/dist/resolvers/GetDataResolver.d.ts.map +1 -1
  16. package/dist/resolvers/GetDataResolver.js +18 -1
  17. package/dist/resolvers/GetDataResolver.js.map +1 -1
  18. package/dist/resolvers/RunAIAgentResolver.d.ts +2 -2
  19. package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
  20. package/dist/resolvers/RunAIAgentResolver.js +8 -5
  21. package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
  22. package/dist/resolvers/TaskResolver.js +1 -1
  23. package/dist/resolvers/TaskResolver.js.map +1 -1
  24. package/dist/services/TaskOrchestrator.d.ts +2 -1
  25. package/dist/services/TaskOrchestrator.d.ts.map +1 -1
  26. package/dist/services/TaskOrchestrator.js +7 -3
  27. package/dist/services/TaskOrchestrator.js.map +1 -1
  28. package/package.json +40 -40
  29. package/src/agents/skip-agent.ts +4 -2
  30. package/src/agents/skip-sdk.ts +1 -62
  31. package/src/auth/exampleNewUserSubClass.ts +2 -1
  32. package/src/generated/generated.ts +120 -66
  33. package/src/resolvers/GetDataResolver.ts +33 -2
  34. package/src/resolvers/RunAIAgentResolver.ts +8 -2
  35. package/src/resolvers/TaskResolver.ts +1 -1
  36. package/src/services/TaskOrchestrator.ts +6 -3
@@ -669,11 +669,7 @@ export class SkipSDK {
669
669
 
670
670
  relatedEntities: e.RelatedEntities.map((r) => {
671
671
  return this.packSingleSkipEntityRelationship(r);
672
- }),
673
-
674
- rowsPacked: e.RowsToPackWithSchema,
675
- rowsSampleMethod: e.RowsToPackSampleMethod,
676
- rows: await this.packEntityRows(e, dataSource)
672
+ })
677
673
  };
678
674
  return ret;
679
675
  }
@@ -755,63 +751,6 @@ export class SkipSDK {
755
751
  }
756
752
  }
757
753
 
758
- /**
759
- * Packs entity rows (sample data)
760
- * Copied from AskSkipResolver.PackEntityRows
761
- */
762
- private async packEntityRows(e: EntityInfo, dataSource: mssql.ConnectionPool): Promise<any[]> {
763
- try {
764
- if (e.RowsToPackWithSchema === 'None')
765
- return [];
766
-
767
- // only include columns that have a scopes including either All and/or AI or have Null for ScopeDefault
768
- const fields = e.Fields.filter((f) => {
769
- const scopes = f.ScopeDefault?.split(',').map((s) => s.trim().toLowerCase());
770
- return !scopes || scopes.length === 0 || scopes.includes('all') || scopes.includes('ai');
771
- }).map(f => `[${f.Name}]`).join(',');
772
-
773
- // now run the query based on the row packing method
774
- let sql: string = '';
775
- switch (e.RowsToPackWithSchema) {
776
- case 'All':
777
- sql = `SELECT ${fields} FROM ${e.SchemaName}.${e.BaseView}`;
778
- break;
779
- case 'Sample':
780
- switch (e.RowsToPackSampleMethod) {
781
- case 'random':
782
- sql = `SELECT TOP ${e.RowsToPackSampleCount} ${fields} FROM [${e.SchemaName}].[${e.BaseView}] ORDER BY newid()`;
783
- break;
784
- case 'top n':
785
- const orderBy = e.RowsToPackSampleOrder ? ` ORDER BY [${e.RowsToPackSampleOrder}]` : '';
786
- sql = `SELECT TOP ${e.RowsToPackSampleCount} ${fields} FROM [${e.SchemaName}].[${e.BaseView}]${orderBy}`;
787
- break;
788
- case 'bottom n':
789
- const firstPrimaryKey = e.FirstPrimaryKey.Name;
790
- const innerOrderBy = e.RowsToPackSampleOrder ? `[${e.RowsToPackSampleOrder}]` : `[${firstPrimaryKey}] DESC`;
791
- sql = `SELECT * FROM (
792
- SELECT TOP ${e.RowsToPackSampleCount} ${fields}
793
- FROM [${e.SchemaName}].[${e.BaseView}]
794
- ORDER BY ${innerOrderBy}
795
- ) sub
796
- ORDER BY [${firstPrimaryKey}] ASC;`;
797
- break;
798
- }
799
- }
800
- const request = new mssql.Request(dataSource);
801
- const result = await request.query(sql);
802
- if (!result || !result.recordset) {
803
- return [];
804
- }
805
- else {
806
- return result.recordset;
807
- }
808
- }
809
- catch (e) {
810
- LogError(`[SkipSDK] packEntityRows error: ${e}`);
811
- return [];
812
- }
813
- }
814
-
815
754
  /**
816
755
  * Packs possible values for an entity field
817
756
  * These values help Skip understand the domain and valid values for fields
@@ -3,6 +3,7 @@ import { Metadata, RunView, LogError, EntitySaveOptions } from '@memberjunction/
3
3
  import { NewUserBase } from './newUsers.js';
4
4
  import { UserCache } from '@memberjunction/sqlserver-dataprovider';
5
5
  import { configInfo } from '../config.js';
6
+ import { UserEntity } from '@memberjunction/core-entities';
6
7
 
7
8
  /**
8
9
  * This example class subclasses the @NewUserBase class and overrides the createNewUser method to create a new person record and then call the base class to create the user record. In this example there is an entity
@@ -13,7 +14,7 @@ import { configInfo } from '../config.js';
13
14
  // so that your class is actually used.
14
15
  //@RegisterClass(NewUserBase, undefined, 1) /*by putting 1 into the priority setting, MJGlobal ClassFactory will use this instead of the base class as that registration had no priority*/
15
16
  export class ExampleNewUserSubClass extends NewUserBase {
16
- public override async createNewUser(firstName: string, lastName: string, email: string, linkedRecordType: string = 'None', linkedEntityId?: string, linkedEntityRecordId?: string) {
17
+ public override async createNewUser(firstName: string, lastName: string, email: string, linkedRecordType: string = 'None', linkedEntityId?: string, linkedEntityRecordId?: string): Promise<UserEntity | null> {
17
18
  try {
18
19
  const md = new Metadata();
19
20
 
@@ -2638,15 +2638,15 @@ export class MJAIConfiguration_ {
2638
2638
  @Field(() => [MJAIAgentPrompt_])
2639
2639
  MJ_AIAgentPrompts_ConfigurationIDArray: MJAIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
2640
2640
 
2641
- @Field(() => [MJAIPromptRun_])
2642
- MJ_AIPromptRuns_ConfigurationIDArray: MJAIPromptRun_[]; // Link to MJ_AIPromptRuns
2643
-
2644
2641
  @Field(() => [MJAIPromptModel_])
2645
2642
  MJ_AIPromptModels_ConfigurationIDArray: MJAIPromptModel_[]; // Link to MJ_AIPromptModels
2646
2643
 
2647
2644
  @Field(() => [MJAIResultCache_])
2648
2645
  AIResultCache_ConfigurationIDArray: MJAIResultCache_[]; // Link to AIResultCache
2649
2646
 
2647
+ @Field(() => [MJAIPromptRun_])
2648
+ MJ_AIPromptRuns_ConfigurationIDArray: MJAIPromptRun_[]; // Link to MJ_AIPromptRuns
2649
+
2650
2650
  @Field(() => [MJAIAgentRun_])
2651
2651
  MJ_AIAgentRuns_ConfigurationIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
2652
2652
 
@@ -2790,17 +2790,6 @@ export class MJAIConfigurationResolver extends ResolverBase {
2790
2790
  return result;
2791
2791
  }
2792
2792
 
2793
- @FieldResolver(() => [MJAIPromptRun_])
2794
- async MJ_AIPromptRuns_ConfigurationIDArray(@Root() mjaiconfiguration_: MJAIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2795
- this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
2796
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2797
- const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2798
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ConfigurationID]='${mjaiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
2799
- const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2800
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows);
2801
- return result;
2802
- }
2803
-
2804
2793
  @FieldResolver(() => [MJAIPromptModel_])
2805
2794
  async MJ_AIPromptModels_ConfigurationIDArray(@Root() mjaiconfiguration_: MJAIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2806
2795
  this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
@@ -2823,6 +2812,17 @@ export class MJAIConfigurationResolver extends ResolverBase {
2823
2812
  return result;
2824
2813
  }
2825
2814
 
2815
+ @FieldResolver(() => [MJAIPromptRun_])
2816
+ async MJ_AIPromptRuns_ConfigurationIDArray(@Root() mjaiconfiguration_: MJAIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2817
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
2818
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2819
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2820
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ConfigurationID]='${mjaiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
2821
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2822
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows);
2823
+ return result;
2824
+ }
2825
+
2826
2826
  @FieldResolver(() => [MJAIAgentRun_])
2827
2827
  async MJ_AIAgentRuns_ConfigurationIDArray(@Root() mjaiconfiguration_: MJAIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2828
2828
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
@@ -5186,21 +5186,21 @@ export class MJEnvironment_ {
5186
5186
  @MaxLength(10)
5187
5187
  _mj__UpdatedAt: Date;
5188
5188
 
5189
- @Field(() => [MJProject_])
5190
- MJ_Projects_EnvironmentIDArray: MJProject_[]; // Link to MJ_Projects
5191
-
5192
5189
  @Field(() => [MJCollection_])
5193
5190
  MJ_Collections_EnvironmentIDArray: MJCollection_[]; // Link to MJ_Collections
5194
5191
 
5192
+ @Field(() => [MJProject_])
5193
+ MJ_Projects_EnvironmentIDArray: MJProject_[]; // Link to MJ_Projects
5194
+
5195
5195
  @Field(() => [MJArtifact_])
5196
5196
  MJ_Artifacts_EnvironmentIDArray: MJArtifact_[]; // Link to MJ_Artifacts
5197
5197
 
5198
- @Field(() => [MJTask_])
5199
- MJ_Tasks_EnvironmentIDArray: MJTask_[]; // Link to MJ_Tasks
5200
-
5201
5198
  @Field(() => [MJDashboard_])
5202
5199
  Dashboards_EnvironmentIDArray: MJDashboard_[]; // Link to Dashboards
5203
5200
 
5201
+ @Field(() => [MJTask_])
5202
+ MJ_Tasks_EnvironmentIDArray: MJTask_[]; // Link to MJ_Tasks
5203
+
5204
5204
  @Field(() => [MJReport_])
5205
5205
  Reports_EnvironmentIDArray: MJReport_[]; // Link to Reports
5206
5206
 
@@ -5313,25 +5313,25 @@ export class MJEnvironmentResolver extends ResolverBase {
5313
5313
  return result;
5314
5314
  }
5315
5315
 
5316
- @FieldResolver(() => [MJProject_])
5317
- async MJ_Projects_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5318
- this.CheckUserReadPermissions('MJ: Projects', userPayload);
5316
+ @FieldResolver(() => [MJCollection_])
5317
+ async MJ_Collections_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5318
+ this.CheckUserReadPermissions('MJ: Collections', userPayload);
5319
5319
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5320
5320
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5321
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwProjects] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Projects', userPayload, EntityPermissionType.Read, 'AND');
5321
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
5322
5322
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5323
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Projects', rows);
5323
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
5324
5324
  return result;
5325
5325
  }
5326
5326
 
5327
- @FieldResolver(() => [MJCollection_])
5328
- async MJ_Collections_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5329
- this.CheckUserReadPermissions('MJ: Collections', userPayload);
5327
+ @FieldResolver(() => [MJProject_])
5328
+ async MJ_Projects_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5329
+ this.CheckUserReadPermissions('MJ: Projects', userPayload);
5330
5330
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5331
5331
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5332
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
5332
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwProjects] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Projects', userPayload, EntityPermissionType.Read, 'AND');
5333
5333
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5334
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
5334
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Projects', rows);
5335
5335
  return result;
5336
5336
  }
5337
5337
 
@@ -5346,25 +5346,25 @@ export class MJEnvironmentResolver extends ResolverBase {
5346
5346
  return result;
5347
5347
  }
5348
5348
 
5349
- @FieldResolver(() => [MJTask_])
5350
- async MJ_Tasks_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5351
- this.CheckUserReadPermissions('MJ: Tasks', userPayload);
5349
+ @FieldResolver(() => [MJDashboard_])
5350
+ async Dashboards_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5351
+ this.CheckUserReadPermissions('Dashboards', userPayload);
5352
5352
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5353
5353
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5354
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
5354
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboards] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Dashboards', userPayload, EntityPermissionType.Read, 'AND');
5355
5355
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5356
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
5356
+ const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', rows);
5357
5357
  return result;
5358
5358
  }
5359
5359
 
5360
- @FieldResolver(() => [MJDashboard_])
5361
- async Dashboards_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5362
- this.CheckUserReadPermissions('Dashboards', userPayload);
5360
+ @FieldResolver(() => [MJTask_])
5361
+ async MJ_Tasks_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5362
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
5363
5363
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5364
5364
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5365
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboards] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Dashboards', userPayload, EntityPermissionType.Read, 'AND');
5365
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
5366
5366
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5367
- const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', rows);
5367
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
5368
5368
  return result;
5369
5369
  }
5370
5370
 
@@ -10839,6 +10839,15 @@ export class MJEntityField_ {
10839
10839
  @MaxLength(50)
10840
10840
  Status: string;
10841
10841
 
10842
+ @Field(() => Boolean, {description: `When 1, allows system/LLM to auto-update IsNameField; when 0, user has locked this field`})
10843
+ AutoUpdateIsNameField: boolean;
10844
+
10845
+ @Field(() => Boolean, {description: `When 1, allows system/LLM to auto-update DefaultInView; when 0, user has locked this field`})
10846
+ AutoUpdateDefaultInView: boolean;
10847
+
10848
+ @Field(() => Boolean, {description: `When 1, allows system/LLM to auto-update Category; when 0, user has locked this field`})
10849
+ AutoUpdateCategory: boolean;
10850
+
10842
10851
  @Field({nullable: true})
10843
10852
  FieldCodeName?: string;
10844
10853
 
@@ -10988,6 +10997,15 @@ export class CreateMJEntityFieldInput {
10988
10997
 
10989
10998
  @Field({ nullable: true })
10990
10999
  Status?: string;
11000
+
11001
+ @Field(() => Boolean, { nullable: true })
11002
+ AutoUpdateIsNameField?: boolean;
11003
+
11004
+ @Field(() => Boolean, { nullable: true })
11005
+ AutoUpdateDefaultInView?: boolean;
11006
+
11007
+ @Field(() => Boolean, { nullable: true })
11008
+ AutoUpdateCategory?: boolean;
10991
11009
  }
10992
11010
 
10993
11011
 
@@ -11089,6 +11107,15 @@ export class UpdateMJEntityFieldInput {
11089
11107
  @Field({ nullable: true })
11090
11108
  Status?: string;
11091
11109
 
11110
+ @Field(() => Boolean, { nullable: true })
11111
+ AutoUpdateIsNameField?: boolean;
11112
+
11113
+ @Field(() => Boolean, { nullable: true })
11114
+ AutoUpdateDefaultInView?: boolean;
11115
+
11116
+ @Field(() => Boolean, { nullable: true })
11117
+ AutoUpdateCategory?: boolean;
11118
+
11092
11119
  @Field(() => [KeyValuePairInput], { nullable: true })
11093
11120
  OldValues___?: KeyValuePairInput[];
11094
11121
  }
@@ -12620,12 +12647,12 @@ export class MJUser_ {
12620
12647
  @Field(() => [MJReportUserState_])
12621
12648
  MJ_ReportUserStates_UserIDArray: MJReportUserState_[]; // Link to MJ_ReportUserStates
12622
12649
 
12623
- @Field(() => [MJDashboardUserPreference_])
12624
- MJ_DashboardUserPreferences_UserIDArray: MJDashboardUserPreference_[]; // Link to MJ_DashboardUserPreferences
12625
-
12626
12650
  @Field(() => [MJDashboardUserState_])
12627
12651
  MJ_DashboardUserStates_UserIDArray: MJDashboardUserState_[]; // Link to MJ_DashboardUserStates
12628
12652
 
12653
+ @Field(() => [MJDashboardUserPreference_])
12654
+ MJ_DashboardUserPreferences_UserIDArray: MJDashboardUserPreference_[]; // Link to MJ_DashboardUserPreferences
12655
+
12629
12656
  @Field(() => [MJArtifactVersion_])
12630
12657
  MJ_ArtifactVersions_UserIDArray: MJArtifactVersion_[]; // Link to MJ_ArtifactVersions
12631
12658
 
@@ -13259,25 +13286,25 @@ export class MJUserResolverBase extends ResolverBase {
13259
13286
  return result;
13260
13287
  }
13261
13288
 
13262
- @FieldResolver(() => [MJDashboardUserPreference_])
13263
- async MJ_DashboardUserPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13264
- this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
13289
+ @FieldResolver(() => [MJDashboardUserState_])
13290
+ async MJ_DashboardUserStates_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13291
+ this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
13265
13292
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13266
13293
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13267
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
13294
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
13268
13295
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13269
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', rows);
13296
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', rows);
13270
13297
  return result;
13271
13298
  }
13272
13299
 
13273
- @FieldResolver(() => [MJDashboardUserState_])
13274
- async MJ_DashboardUserStates_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13275
- this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
13300
+ @FieldResolver(() => [MJDashboardUserPreference_])
13301
+ async MJ_DashboardUserPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13302
+ this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
13276
13303
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13277
13304
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13278
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
13305
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
13279
13306
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13280
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', rows);
13307
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', rows);
13281
13308
  return result;
13282
13309
  }
13283
13310
 
@@ -13643,6 +13670,12 @@ export class MJEntityRelationship_ {
13643
13670
  @Field(() => Boolean, {description: `Indicates whether this relationship should be automatically updated by CodeGen. When set to 0, the record will not be modified by CodeGen. Defaults to 1.`})
13644
13671
  AutoUpdateFromSchema: boolean;
13645
13672
 
13673
+ @Field({nullable: true, description: `JSON array of additional field names to include when joining through this relationship (for junction tables, e.g., ["RoleName", "UserEmail"])`})
13674
+ AdditionalFieldsToInclude?: string;
13675
+
13676
+ @Field(() => Boolean, {description: `When 1, allows system/LLM to auto-update AdditionalFieldsToInclude; when 0, user has locked this field`})
13677
+ AutoUpdateAdditionalFieldsToInclude: boolean;
13678
+
13646
13679
  @Field()
13647
13680
  @MaxLength(510)
13648
13681
  Entity: string;
@@ -13746,6 +13779,12 @@ export class CreateMJEntityRelationshipInput {
13746
13779
 
13747
13780
  @Field(() => Boolean, { nullable: true })
13748
13781
  AutoUpdateFromSchema?: boolean;
13782
+
13783
+ @Field({ nullable: true })
13784
+ AdditionalFieldsToInclude: string | null;
13785
+
13786
+ @Field(() => Boolean, { nullable: true })
13787
+ AutoUpdateAdditionalFieldsToInclude?: boolean;
13749
13788
  }
13750
13789
 
13751
13790
 
@@ -13814,6 +13853,12 @@ export class UpdateMJEntityRelationshipInput {
13814
13853
  @Field(() => Boolean, { nullable: true })
13815
13854
  AutoUpdateFromSchema?: boolean;
13816
13855
 
13856
+ @Field({ nullable: true })
13857
+ AdditionalFieldsToInclude?: string | null;
13858
+
13859
+ @Field(() => Boolean, { nullable: true })
13860
+ AutoUpdateAdditionalFieldsToInclude?: boolean;
13861
+
13817
13862
  @Field(() => [KeyValuePairInput], { nullable: true })
13818
13863
  OldValues___?: KeyValuePairInput[];
13819
13864
  }
@@ -25279,6 +25324,9 @@ export class MJSchemaInfo_ {
25279
25324
  @MaxLength(10)
25280
25325
  _mj__UpdatedAt: Date;
25281
25326
 
25327
+ @Field({nullable: true})
25328
+ Description?: string;
25329
+
25282
25330
  }
25283
25331
 
25284
25332
  //****************************************************************************
@@ -25300,6 +25348,9 @@ export class CreateMJSchemaInfoInput {
25300
25348
 
25301
25349
  @Field({ nullable: true })
25302
25350
  Comments: string | null;
25351
+
25352
+ @Field({ nullable: true })
25353
+ Description: string | null;
25303
25354
  }
25304
25355
 
25305
25356
 
@@ -25323,6 +25374,9 @@ export class UpdateMJSchemaInfoInput {
25323
25374
  @Field({ nullable: true })
25324
25375
  Comments?: string | null;
25325
25376
 
25377
+ @Field({ nullable: true })
25378
+ Description?: string | null;
25379
+
25326
25380
  @Field(() => [KeyValuePairInput], { nullable: true })
25327
25381
  OldValues___?: KeyValuePairInput[];
25328
25382
  }
@@ -43024,12 +43078,12 @@ export class MJConversationArtifact_ {
43024
43078
  @MaxLength(200)
43025
43079
  ArtifactType: string;
43026
43080
 
43027
- @Field(() => [MJConversationArtifactVersion_])
43028
- MJ_ConversationArtifactVersions_ConversationArtifactIDArray: MJConversationArtifactVersion_[]; // Link to MJ_ConversationArtifactVersions
43029
-
43030
43081
  @Field(() => [MJConversationArtifactPermission_])
43031
43082
  MJ_ConversationArtifactPermissions_ConversationArtifactIDArray: MJConversationArtifactPermission_[]; // Link to MJ_ConversationArtifactPermissions
43032
43083
 
43084
+ @Field(() => [MJConversationArtifactVersion_])
43085
+ MJ_ConversationArtifactVersions_ConversationArtifactIDArray: MJConversationArtifactVersion_[]; // Link to MJ_ConversationArtifactVersions
43086
+
43033
43087
  @Field(() => [MJConversationDetail_])
43034
43088
  ConversationDetails_ArtifactIDArray: MJConversationDetail_[]; // Link to ConversationDetails
43035
43089
 
@@ -43151,25 +43205,25 @@ export class MJConversationArtifactResolver extends ResolverBase {
43151
43205
  return result;
43152
43206
  }
43153
43207
 
43154
- @FieldResolver(() => [MJConversationArtifactVersion_])
43155
- async MJ_ConversationArtifactVersions_ConversationArtifactIDArray(@Root() mjconversationartifact_: MJConversationArtifact_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
43156
- this.CheckUserReadPermissions('MJ: Conversation Artifact Versions', userPayload);
43208
+ @FieldResolver(() => [MJConversationArtifactPermission_])
43209
+ async MJ_ConversationArtifactPermissions_ConversationArtifactIDArray(@Root() mjconversationartifact_: MJConversationArtifact_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
43210
+ this.CheckUserReadPermissions('MJ: Conversation Artifact Permissions', userPayload);
43157
43211
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
43158
43212
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
43159
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwConversationArtifactVersions] WHERE [ConversationArtifactID]='${mjconversationartifact_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Artifact Versions', userPayload, EntityPermissionType.Read, 'AND');
43213
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwConversationArtifactPermissions] WHERE [ConversationArtifactID]='${mjconversationartifact_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Artifact Permissions', userPayload, EntityPermissionType.Read, 'AND');
43160
43214
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
43161
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Artifact Versions', rows);
43215
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Artifact Permissions', rows);
43162
43216
  return result;
43163
43217
  }
43164
43218
 
43165
- @FieldResolver(() => [MJConversationArtifactPermission_])
43166
- async MJ_ConversationArtifactPermissions_ConversationArtifactIDArray(@Root() mjconversationartifact_: MJConversationArtifact_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
43167
- this.CheckUserReadPermissions('MJ: Conversation Artifact Permissions', userPayload);
43219
+ @FieldResolver(() => [MJConversationArtifactVersion_])
43220
+ async MJ_ConversationArtifactVersions_ConversationArtifactIDArray(@Root() mjconversationartifact_: MJConversationArtifact_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
43221
+ this.CheckUserReadPermissions('MJ: Conversation Artifact Versions', userPayload);
43168
43222
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
43169
43223
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
43170
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwConversationArtifactPermissions] WHERE [ConversationArtifactID]='${mjconversationartifact_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Artifact Permissions', userPayload, EntityPermissionType.Read, 'AND');
43224
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwConversationArtifactVersions] WHERE [ConversationArtifactID]='${mjconversationartifact_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Artifact Versions', userPayload, EntityPermissionType.Read, 'AND');
43171
43225
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
43172
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Artifact Permissions', rows);
43226
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Artifact Versions', rows);
43173
43227
  return result;
43174
43228
  }
43175
43229
 
@@ -137,11 +137,42 @@ export class GetDataResolver {
137
137
  const result = await request.query(query);
138
138
  return { result: result.recordset, error: null };
139
139
  } catch (err) {
140
- return { result: null, error: err };
140
+ // Extract clean SQL error message
141
+ let errorMessage = err instanceof Error ? err.message : String(err);
142
+
143
+ // SQL Server errors often have additional context in properties
144
+ // Try to get more context from the error object
145
+ if (err && typeof err === 'object') {
146
+ const sqlError = err as any;
147
+
148
+ // SQL Server error objects may have a 'procName' with the problematic token
149
+ // or 'lineNumber' and other useful properties
150
+ if (sqlError.precedingErrors && sqlError.precedingErrors.length > 0) {
151
+ // Sometimes the error has preceding errors with better context
152
+ const precedingError = sqlError.precedingErrors[0];
153
+ if (precedingError.message) {
154
+ errorMessage = precedingError.message;
155
+ }
156
+ }
157
+
158
+ // Enhance error message with line number if available
159
+ if (sqlError.lineNumber && sqlError.lineNumber > 0) {
160
+ errorMessage = `${errorMessage} (Line ${sqlError.lineNumber})`;
161
+ }
162
+ }
163
+
164
+ // SQL Server errors often have the format "message\nstatement"
165
+ // Extract just the first line which contains the actual error
166
+ const firstLine = errorMessage.split('\n')[0];
167
+ if (firstLine) {
168
+ errorMessage = firstLine.trim();
169
+ }
170
+
171
+ return { result: null, error: errorMessage };
141
172
  }
142
173
  })
143
174
  );
144
-
175
+
145
176
  // Extract results and errors from the promises
146
177
  const processedResults = results.map((res) => res.status === "fulfilled" ? res.value.result : null);
147
178
  const errorMessages = results.map((res) => res.status === "fulfilled" ? res.value.error : res.reason);
@@ -308,6 +308,7 @@ export class RunAIAgentResolver extends ResolverBase {
308
308
  */
309
309
  private async executeAIAgent(
310
310
  p: DatabaseProviderBase,
311
+ dataSource: any,
311
312
  agentId: string,
312
313
  userPayload: UserPayload,
313
314
  messagesJson: string,
@@ -372,6 +373,9 @@ export class RunAIAgentResolver extends ResolverBase {
372
373
  configurationId: configurationId,
373
374
  data: parsedData,
374
375
  conversationDetailId: conversationDetailId,
376
+ context: {
377
+ dataSource: dataSource
378
+ }
375
379
  });
376
380
 
377
381
  // Update agent run ref once available
@@ -498,7 +502,7 @@ export class RunAIAgentResolver extends ResolverBase {
498
502
  @Mutation(() => AIAgentRunResult)
499
503
  async RunAIAgent(
500
504
  @Arg('agentId') agentId: string,
501
- @Ctx() { userPayload, providers }: AppContext,
505
+ @Ctx() { userPayload, providers, dataSource }: AppContext,
502
506
  @Arg('messages') messagesJson: string,
503
507
  @Arg('sessionId') sessionId: string,
504
508
  @PubSub() pubSub: PubSubEngine,
@@ -517,6 +521,7 @@ export class RunAIAgentResolver extends ResolverBase {
517
521
  const p = GetReadWriteProvider(providers);
518
522
  return this.executeAIAgent(
519
523
  p,
524
+ dataSource,
520
525
  agentId,
521
526
  userPayload,
522
527
  messagesJson,
@@ -544,7 +549,7 @@ export class RunAIAgentResolver extends ResolverBase {
544
549
  @Query(() => AIAgentRunResult)
545
550
  async RunAIAgentSystemUser(
546
551
  @Arg('agentId') agentId: string,
547
- @Ctx() { userPayload, providers }: AppContext,
552
+ @Ctx() { userPayload, providers, dataSource }: AppContext,
548
553
  @Arg('messages') messagesJson: string,
549
554
  @Arg('sessionId') sessionId: string,
550
555
  @PubSub() pubSub: PubSubEngine,
@@ -563,6 +568,7 @@ export class RunAIAgentResolver extends ResolverBase {
563
568
  const p = GetReadWriteProvider(providers);
564
569
  return this.executeAIAgent(
565
570
  p,
571
+ dataSource,
566
572
  agentId,
567
573
  userPayload,
568
574
  messagesJson,
@@ -79,7 +79,7 @@ export class TaskOrchestrationResolver extends ResolverBase {
79
79
  }
80
80
 
81
81
  // Create task orchestrator with PubSub for progress updates
82
- const orchestrator = new TaskOrchestrator(currentUser, pubSub, sessionId, userPayload, createNotifications || false);
82
+ const orchestrator = new TaskOrchestrator(currentUser, pubSub, sessionId, userPayload, createNotifications || false, conversationDetailId);
83
83
 
84
84
  // Create parent task and child tasks with dependencies
85
85
  const { parentTaskId, taskIdMap } = await orchestrator.createTasksFromGraph(
@@ -51,7 +51,8 @@ export class TaskOrchestrator {
51
51
  private pubSub?: PubSubEngine,
52
52
  private sessionId?: string,
53
53
  private userPayload?: UserPayload,
54
- private createNotifications: boolean = false
54
+ private createNotifications: boolean = false,
55
+ private conversationDetailId?: string
55
56
  ) {}
56
57
 
57
58
  /**
@@ -219,7 +220,8 @@ export class TaskOrchestrator {
219
220
  taskName,
220
221
  message,
221
222
  percentComplete,
222
- timestamp: new Date()
223
+ timestamp: new Date(),
224
+ conversationDetailId: this.conversationDetailId
223
225
  }
224
226
  }),
225
227
  sessionId: this.userPayload.sessionId
@@ -249,7 +251,8 @@ export class TaskOrchestrator {
249
251
  taskName,
250
252
  agentStep,
251
253
  agentMessage,
252
- timestamp: new Date()
254
+ timestamp: new Date(),
255
+ conversationDetailId: this.conversationDetailId
253
256
  }
254
257
  }),
255
258
  sessionId: this.userPayload.sessionId