@memberjunction/server 2.106.0 → 2.107.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.
@@ -19,7 +19,7 @@ import { mj_core_schema } from '../config.js';
19
19
 
20
20
 
21
21
 
22
- import { ScheduledActionEntity, ScheduledActionParamEntity, ExplorerNavigationItemEntity, GeneratedCodeCategoryEntity, AIAgentModelEntity, ComponentRegistryEntity, AIAgentNoteTypeEntity, ComponentDependencyEntity, AIAgentRunEntity, AIVendorEntity, TaskTypeEntity, AIConfigurationEntity, AIAgentEntity, AIAgentStepEntity, AIModelCostEntity, AIPromptModelEntity, AIAgentTypeEntity, AIAgentNoteEntity, EnvironmentEntity, AIAgentActionEntity, TaskDependencyEntity, CollectionArtifactEntity, AIModelPriceTypeEntity, CollectionEntity, RecordLinkEntity, AIPromptEntity, AIResultCacheEntity, AIPromptCategoryEntity, AIPromptTypeEntity, CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity, DuplicateRunDetailMatchEntity, EntityDocumentSettingEntity, EntitySettingEntity, DuplicateRunEntity, DuplicateRunDetailEntity, ApplicationSettingEntity, ActionCategoryEntity, EntityActionEntity, EntityActionInvocationEntity, ActionAuthorizationEntity, EntityActionInvocationTypeEntity, ActionEntity, EntityActionFilterEntity, ActionFilterEntity, ActionContextTypeEntity, ActionResultCodeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionParamEntity, ActionLibraryEntity, LibraryEntity, ListCategoryEntity, CommunicationProviderEntity, CommunicationRunEntity, CommunicationProviderMessageTypeEntity, CommunicationLogEntity, CommunicationBaseMessageTypeEntity, TemplateEntity, TemplateCategoryEntity, TemplateContentEntity, TemplateParamEntity, TemplateContentTypeEntity, RecommendationEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationItemEntity, EntityCommunicationMessageTypeEntity, EntityCommunicationFieldEntity, RecordChangeReplayRunEntity, LibraryItemEntity, EntityRelationshipDisplayComponentEntity, EntityActionParamEntity, ResourcePermissionEntity, ResourceLinkEntity, AIAgentArtifactTypeEntity, ConversationArtifactVersionEntity, AIAgentRequestEntity, AIModelVendorEntity, AIVendorTypeDefinitionEntity, ReportUserStateEntity, QueryEntityEntity, DashboardUserStateEntity, ComponentEntity, AccessControlRuleEntity, PublicLinkEntity, ArtifactTypeEntity, AIVendorTypeEntity, ArtifactEntity, ConversationArtifactEntity, AIAgentPromptEntity, ComponentLibraryEntity, DashboardUserPreferenceEntity, QueryParameterEntity, AIAgentPermissionEntity, AIAgentRelationshipEntity, ComponentLibraryLinkEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, AIPromptRunEntity, AIAgentRunStepEntity, ConversationDetailArtifactEntity, TaskEntity, ProjectEntity, ConversationArtifactPermissionEntity, AIModelPriceUnitTypeEntity, ArtifactVersionEntity, AIAgentStepPathEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity, ArtifactVersionAttributeEntity } from '@memberjunction/core-entities';
22
+ import { ScheduledActionEntity, ScheduledActionParamEntity, ExplorerNavigationItemEntity, GeneratedCodeCategoryEntity, AIAgentModelEntity, ComponentRegistryEntity, AIAgentNoteTypeEntity, ComponentDependencyEntity, AIAgentRunEntity, AIVendorEntity, TaskTypeEntity, AIConfigurationEntity, AIAgentEntity, AIAgentStepEntity, AIModelCostEntity, AIPromptModelEntity, AIAgentTypeEntity, AIAgentNoteEntity, EnvironmentEntity, AIAgentActionEntity, TaskDependencyEntity, CollectionArtifactEntity, AIModelPriceTypeEntity, CollectionEntity, RecordLinkEntity, AIPromptEntity, AIResultCacheEntity, AIPromptCategoryEntity, AIPromptTypeEntity, CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity, DuplicateRunDetailMatchEntity, EntityDocumentSettingEntity, EntitySettingEntity, DuplicateRunEntity, DuplicateRunDetailEntity, ApplicationSettingEntity, ActionCategoryEntity, EntityActionEntity, EntityActionInvocationEntity, ActionAuthorizationEntity, EntityActionInvocationTypeEntity, ActionEntity, EntityActionFilterEntity, ActionFilterEntity, ActionContextTypeEntity, ActionResultCodeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionParamEntity, ActionLibraryEntity, LibraryEntity, ListCategoryEntity, CommunicationProviderEntity, CommunicationRunEntity, CommunicationProviderMessageTypeEntity, CommunicationLogEntity, CommunicationBaseMessageTypeEntity, TemplateEntity, TemplateCategoryEntity, TemplateContentEntity, TemplateParamEntity, TemplateContentTypeEntity, RecommendationEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationItemEntity, EntityCommunicationMessageTypeEntity, EntityCommunicationFieldEntity, RecordChangeReplayRunEntity, LibraryItemEntity, EntityRelationshipDisplayComponentEntity, EntityActionParamEntity, ResourcePermissionEntity, ResourceLinkEntity, AIAgentArtifactTypeEntity, ConversationArtifactVersionEntity, AIAgentRequestEntity, AIModelVendorEntity, AIVendorTypeDefinitionEntity, ReportUserStateEntity, QueryEntityEntity, ScheduledJobRunEntity, DashboardUserStateEntity, ComponentEntity, AccessControlRuleEntity, PublicLinkEntity, ArtifactTypeEntity, AIVendorTypeEntity, ArtifactEntity, ConversationArtifactEntity, AIAgentPromptEntity, ComponentLibraryEntity, ScheduledJobTypeEntity, DashboardUserPreferenceEntity, QueryParameterEntity, AIAgentPermissionEntity, AIAgentRelationshipEntity, ComponentLibraryLinkEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, ScheduledJobEntity, AIPromptRunEntity, AIAgentRunStepEntity, ConversationDetailArtifactEntity, TaskEntity, ProjectEntity, ConversationArtifactPermissionEntity, AIModelPriceUnitTypeEntity, ArtifactVersionEntity, AIAgentStepPathEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity, ArtifactVersionAttributeEntity } from '@memberjunction/core-entities';
23
23
 
24
24
 
25
25
  //****************************************************************************
@@ -1721,6 +1721,10 @@ each time the agent processes a prompt step.`})
1721
1721
  @Field({nullable: true, description: `Human-readable notes and comments about this agent run`})
1722
1722
  Comments?: string;
1723
1723
 
1724
+ @Field({nullable: true, description: `Links to the scheduled job run that triggered this agent execution. NULL for manually-triggered agent runs. Enables tracking which scheduled jobs spawned which agent executions.`})
1725
+ @MaxLength(16)
1726
+ ScheduledJobRunID?: string;
1727
+
1724
1728
  @Field({nullable: true})
1725
1729
  @MaxLength(510)
1726
1730
  Agent?: string;
@@ -1753,12 +1757,12 @@ each time the agent processes a prompt step.`})
1753
1757
  @MaxLength(16)
1754
1758
  RootLastRunID?: string;
1755
1759
 
1756
- @Field(() => [MJAIAgentRun_])
1757
- MJ_AIAgentRuns_ParentRunIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
1758
-
1759
1760
  @Field(() => [MJAIAgentRunStep_])
1760
1761
  MJ_AIAgentRunSteps_AgentRunIDArray: MJAIAgentRunStep_[]; // Link to MJ_AIAgentRunSteps
1761
1762
 
1763
+ @Field(() => [MJAIAgentRun_])
1764
+ MJ_AIAgentRuns_ParentRunIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
1765
+
1762
1766
  @Field(() => [MJAIPromptRun_])
1763
1767
  MJ_AIPromptRuns_AgentRunIDArray: MJAIPromptRun_[]; // Link to MJ_AIPromptRuns
1764
1768
 
@@ -1879,6 +1883,9 @@ export class CreateMJAIAgentRunInput {
1879
1883
 
1880
1884
  @Field({ nullable: true })
1881
1885
  Comments: string | null;
1886
+
1887
+ @Field({ nullable: true })
1888
+ ScheduledJobRunID: string | null;
1882
1889
  }
1883
1890
 
1884
1891
 
@@ -1998,6 +2005,9 @@ export class UpdateMJAIAgentRunInput {
1998
2005
  @Field({ nullable: true })
1999
2006
  Comments?: string | null;
2000
2007
 
2008
+ @Field({ nullable: true })
2009
+ ScheduledJobRunID?: string | null;
2010
+
2001
2011
  @Field(() => [KeyValuePairInput], { nullable: true })
2002
2012
  OldValues___?: KeyValuePairInput[];
2003
2013
  }
@@ -2060,25 +2070,25 @@ export class MJAIAgentRunResolver extends ResolverBase {
2060
2070
  return result;
2061
2071
  }
2062
2072
 
2063
- @FieldResolver(() => [MJAIAgentRun_])
2064
- async MJ_AIAgentRuns_ParentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2065
- this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
2073
+ @FieldResolver(() => [MJAIAgentRunStep_])
2074
+ async MJ_AIAgentRunSteps_AgentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2075
+ this.CheckUserReadPermissions('MJ: AI Agent Run Steps', userPayload);
2066
2076
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2067
2077
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2068
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRuns] WHERE [ParentRunID]='${mjaiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
2078
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRunSteps] WHERE [AgentRunID]='${mjaiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Run Steps', userPayload, EntityPermissionType.Read, 'AND');
2069
2079
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2070
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows);
2080
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Run Steps', rows);
2071
2081
  return result;
2072
2082
  }
2073
2083
 
2074
- @FieldResolver(() => [MJAIAgentRunStep_])
2075
- async MJ_AIAgentRunSteps_AgentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2076
- this.CheckUserReadPermissions('MJ: AI Agent Run Steps', userPayload);
2084
+ @FieldResolver(() => [MJAIAgentRun_])
2085
+ async MJ_AIAgentRuns_ParentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2086
+ this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
2077
2087
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2078
2088
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2079
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRunSteps] WHERE [AgentRunID]='${mjaiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Run Steps', userPayload, EntityPermissionType.Read, 'AND');
2089
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRuns] WHERE [ParentRunID]='${mjaiagentrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
2080
2090
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2081
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Run Steps', rows);
2091
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows);
2082
2092
  return result;
2083
2093
  }
2084
2094
 
@@ -2152,12 +2162,12 @@ export class MJAIVendor_ {
2152
2162
  @Field(() => [MJAIResultCache_])
2153
2163
  AIResultCache_VendorIDArray: MJAIResultCache_[]; // Link to AIResultCache
2154
2164
 
2155
- @Field(() => [MJAIPromptRun_])
2156
- MJ_AIPromptRuns_VendorIDArray: MJAIPromptRun_[]; // Link to MJ_AIPromptRuns
2157
-
2158
2165
  @Field(() => [MJAIModelVendor_])
2159
2166
  MJ_AIModelVendors_VendorIDArray: MJAIModelVendor_[]; // Link to MJ_AIModelVendors
2160
2167
 
2168
+ @Field(() => [MJAIPromptRun_])
2169
+ MJ_AIPromptRuns_VendorIDArray: MJAIPromptRun_[]; // Link to MJ_AIPromptRuns
2170
+
2161
2171
  @Field(() => [MJAIVendorType_])
2162
2172
  MJ_AIVendorTypes_VendorIDArray: MJAIVendorType_[]; // Link to MJ_AIVendorTypes
2163
2173
 
@@ -2283,25 +2293,25 @@ export class MJAIVendorResolver extends ResolverBase {
2283
2293
  return result;
2284
2294
  }
2285
2295
 
2286
- @FieldResolver(() => [MJAIPromptRun_])
2287
- async MJ_AIPromptRuns_VendorIDArray(@Root() mjaivendor_: MJAIVendor_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2288
- this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
2296
+ @FieldResolver(() => [MJAIModelVendor_])
2297
+ async MJ_AIModelVendors_VendorIDArray(@Root() mjaivendor_: MJAIVendor_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2298
+ this.CheckUserReadPermissions('MJ: AI Model Vendors', userPayload);
2289
2299
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2290
2300
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2291
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [VendorID]='${mjaivendor_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
2301
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIModelVendors] WHERE [VendorID]='${mjaivendor_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Model Vendors', userPayload, EntityPermissionType.Read, 'AND');
2292
2302
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2293
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows);
2303
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Model Vendors', rows);
2294
2304
  return result;
2295
2305
  }
2296
2306
 
2297
- @FieldResolver(() => [MJAIModelVendor_])
2298
- async MJ_AIModelVendors_VendorIDArray(@Root() mjaivendor_: MJAIVendor_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2299
- this.CheckUserReadPermissions('MJ: AI Model Vendors', userPayload);
2307
+ @FieldResolver(() => [MJAIPromptRun_])
2308
+ async MJ_AIPromptRuns_VendorIDArray(@Root() mjaivendor_: MJAIVendor_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2309
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
2300
2310
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2301
2311
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2302
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIModelVendors] WHERE [VendorID]='${mjaivendor_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Model Vendors', userPayload, EntityPermissionType.Read, 'AND');
2312
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [VendorID]='${mjaivendor_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
2303
2313
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2304
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Model Vendors', rows);
2314
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows);
2305
2315
  return result;
2306
2316
  }
2307
2317
 
@@ -2581,14 +2591,14 @@ export class MJAIConfiguration_ {
2581
2591
  @Field(() => [MJAIAgentPrompt_])
2582
2592
  MJ_AIAgentPrompts_ConfigurationIDArray: MJAIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
2583
2593
 
2584
- @Field(() => [MJAIPromptRun_])
2585
- MJ_AIPromptRuns_ConfigurationIDArray: MJAIPromptRun_[]; // Link to MJ_AIPromptRuns
2594
+ @Field(() => [MJAIPromptModel_])
2595
+ MJ_AIPromptModels_ConfigurationIDArray: MJAIPromptModel_[]; // Link to MJ_AIPromptModels
2586
2596
 
2587
2597
  @Field(() => [MJAIResultCache_])
2588
2598
  AIResultCache_ConfigurationIDArray: MJAIResultCache_[]; // Link to AIResultCache
2589
2599
 
2590
- @Field(() => [MJAIPromptModel_])
2591
- MJ_AIPromptModels_ConfigurationIDArray: MJAIPromptModel_[]; // Link to MJ_AIPromptModels
2600
+ @Field(() => [MJAIPromptRun_])
2601
+ MJ_AIPromptRuns_ConfigurationIDArray: MJAIPromptRun_[]; // Link to MJ_AIPromptRuns
2592
2602
 
2593
2603
  @Field(() => [MJAIAgentRun_])
2594
2604
  MJ_AIAgentRuns_ConfigurationIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
@@ -2733,14 +2743,14 @@ export class MJAIConfigurationResolver extends ResolverBase {
2733
2743
  return result;
2734
2744
  }
2735
2745
 
2736
- @FieldResolver(() => [MJAIPromptRun_])
2737
- async MJ_AIPromptRuns_ConfigurationIDArray(@Root() mjaiconfiguration_: MJAIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2738
- this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
2746
+ @FieldResolver(() => [MJAIPromptModel_])
2747
+ async MJ_AIPromptModels_ConfigurationIDArray(@Root() mjaiconfiguration_: MJAIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2748
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
2739
2749
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2740
2750
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2741
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ConfigurationID]='${mjaiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
2751
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [ConfigurationID]='${mjaiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
2742
2752
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2743
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows);
2753
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
2744
2754
  return result;
2745
2755
  }
2746
2756
 
@@ -2755,14 +2765,14 @@ export class MJAIConfigurationResolver extends ResolverBase {
2755
2765
  return result;
2756
2766
  }
2757
2767
 
2758
- @FieldResolver(() => [MJAIPromptModel_])
2759
- async MJ_AIPromptModels_ConfigurationIDArray(@Root() mjaiconfiguration_: MJAIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2760
- this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
2768
+ @FieldResolver(() => [MJAIPromptRun_])
2769
+ async MJ_AIPromptRuns_ConfigurationIDArray(@Root() mjaiconfiguration_: MJAIConfiguration_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2770
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
2761
2771
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2762
2772
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2763
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [ConfigurationID]='${mjaiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
2773
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ConfigurationID]='${mjaiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
2764
2774
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2765
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
2775
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', rows);
2766
2776
  return result;
2767
2777
  }
2768
2778
 
@@ -2977,12 +2987,12 @@ if this limit is exceeded.`})
2977
2987
  @MaxLength(16)
2978
2988
  RootParentID?: string;
2979
2989
 
2980
- @Field(() => [MJAIAgentAction_])
2981
- AIAgentActions_AgentIDArray: MJAIAgentAction_[]; // Link to AIAgentActions
2982
-
2983
2990
  @Field(() => [MJAIAgentModel_])
2984
2991
  AIAgentModels_AgentIDArray: MJAIAgentModel_[]; // Link to AIAgentModels
2985
2992
 
2993
+ @Field(() => [MJAIAgentAction_])
2994
+ AIAgentActions_AgentIDArray: MJAIAgentAction_[]; // Link to AIAgentActions
2995
+
2986
2996
  @Field(() => [MJAIAgentLearningCycle_])
2987
2997
  AIAgentLearningCycles_AgentIDArray: MJAIAgentLearningCycle_[]; // Link to AIAgentLearningCycles
2988
2998
 
@@ -3329,25 +3339,25 @@ export class MJAIAgentResolver extends ResolverBase {
3329
3339
  return result;
3330
3340
  }
3331
3341
 
3332
- @FieldResolver(() => [MJAIAgentAction_])
3333
- async AIAgentActions_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3334
- this.CheckUserReadPermissions('AI Agent Actions', userPayload);
3342
+ @FieldResolver(() => [MJAIAgentModel_])
3343
+ async AIAgentModels_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3344
+ this.CheckUserReadPermissions('AI Agent Models', userPayload);
3335
3345
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3336
3346
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3337
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentActions] WHERE [AgentID]='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Actions', userPayload, EntityPermissionType.Read, 'AND');
3347
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentModels] WHERE [AgentID]='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Models', userPayload, EntityPermissionType.Read, 'AND');
3338
3348
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3339
- const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Actions', rows);
3349
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Models', rows);
3340
3350
  return result;
3341
3351
  }
3342
3352
 
3343
- @FieldResolver(() => [MJAIAgentModel_])
3344
- async AIAgentModels_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3345
- this.CheckUserReadPermissions('AI Agent Models', userPayload);
3353
+ @FieldResolver(() => [MJAIAgentAction_])
3354
+ async AIAgentActions_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3355
+ this.CheckUserReadPermissions('AI Agent Actions', userPayload);
3346
3356
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3347
3357
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3348
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentModels] WHERE [AgentID]='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Models', userPayload, EntityPermissionType.Read, 'AND');
3358
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentActions] WHERE [AgentID]='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Actions', userPayload, EntityPermissionType.Read, 'AND');
3349
3359
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3350
- const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Models', rows);
3360
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Actions', rows);
3351
3361
  return result;
3352
3362
  }
3353
3363
 
@@ -4861,21 +4871,21 @@ export class MJEnvironment_ {
4861
4871
  @MaxLength(10)
4862
4872
  _mj__UpdatedAt: Date;
4863
4873
 
4864
- @Field(() => [MJCollection_])
4865
- MJ_Collections_EnvironmentIDArray: MJCollection_[]; // Link to MJ_Collections
4866
-
4867
4874
  @Field(() => [MJProject_])
4868
4875
  MJ_Projects_EnvironmentIDArray: MJProject_[]; // Link to MJ_Projects
4869
4876
 
4877
+ @Field(() => [MJCollection_])
4878
+ MJ_Collections_EnvironmentIDArray: MJCollection_[]; // Link to MJ_Collections
4879
+
4870
4880
  @Field(() => [MJArtifact_])
4871
4881
  MJ_Artifacts_EnvironmentIDArray: MJArtifact_[]; // Link to MJ_Artifacts
4872
4882
 
4873
- @Field(() => [MJDashboard_])
4874
- Dashboards_EnvironmentIDArray: MJDashboard_[]; // Link to Dashboards
4875
-
4876
4883
  @Field(() => [MJTask_])
4877
4884
  MJ_Tasks_EnvironmentIDArray: MJTask_[]; // Link to MJ_Tasks
4878
4885
 
4886
+ @Field(() => [MJDashboard_])
4887
+ Dashboards_EnvironmentIDArray: MJDashboard_[]; // Link to Dashboards
4888
+
4879
4889
  @Field(() => [MJReport_])
4880
4890
  Reports_EnvironmentIDArray: MJReport_[]; // Link to Reports
4881
4891
 
@@ -4988,25 +4998,25 @@ export class MJEnvironmentResolver extends ResolverBase {
4988
4998
  return result;
4989
4999
  }
4990
5000
 
4991
- @FieldResolver(() => [MJCollection_])
4992
- async MJ_Collections_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
4993
- this.CheckUserReadPermissions('MJ: Collections', userPayload);
5001
+ @FieldResolver(() => [MJProject_])
5002
+ async MJ_Projects_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5003
+ this.CheckUserReadPermissions('MJ: Projects', userPayload);
4994
5004
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4995
5005
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4996
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
5006
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwProjects] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Projects', userPayload, EntityPermissionType.Read, 'AND');
4997
5007
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4998
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
5008
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Projects', rows);
4999
5009
  return result;
5000
5010
  }
5001
5011
 
5002
- @FieldResolver(() => [MJProject_])
5003
- async MJ_Projects_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5004
- this.CheckUserReadPermissions('MJ: Projects', userPayload);
5012
+ @FieldResolver(() => [MJCollection_])
5013
+ async MJ_Collections_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5014
+ this.CheckUserReadPermissions('MJ: Collections', userPayload);
5005
5015
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5006
5016
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5007
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwProjects] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Projects', userPayload, EntityPermissionType.Read, 'AND');
5017
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
5008
5018
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5009
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Projects', rows);
5019
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
5010
5020
  return result;
5011
5021
  }
5012
5022
 
@@ -5021,25 +5031,25 @@ export class MJEnvironmentResolver extends ResolverBase {
5021
5031
  return result;
5022
5032
  }
5023
5033
 
5024
- @FieldResolver(() => [MJDashboard_])
5025
- async Dashboards_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5026
- this.CheckUserReadPermissions('Dashboards', userPayload);
5034
+ @FieldResolver(() => [MJTask_])
5035
+ async MJ_Tasks_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5036
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
5027
5037
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5028
5038
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5029
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboards] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Dashboards', userPayload, EntityPermissionType.Read, 'AND');
5039
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
5030
5040
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5031
- const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', rows);
5041
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
5032
5042
  return result;
5033
5043
  }
5034
5044
 
5035
- @FieldResolver(() => [MJTask_])
5036
- async MJ_Tasks_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5037
- this.CheckUserReadPermissions('MJ: Tasks', userPayload);
5045
+ @FieldResolver(() => [MJDashboard_])
5046
+ async Dashboards_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5047
+ this.CheckUserReadPermissions('Dashboards', userPayload);
5038
5048
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5039
5049
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5040
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
5050
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboards] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Dashboards', userPayload, EntityPermissionType.Read, 'AND');
5041
5051
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5042
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
5052
+ const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', rows);
5043
5053
  return result;
5044
5054
  }
5045
5055
 
@@ -6432,12 +6442,12 @@ export class MJAIPrompt_ {
6432
6442
  @Field(() => [MJAIPrompt_])
6433
6443
  AIPrompts_ResultSelectorPromptIDArray: MJAIPrompt_[]; // Link to AIPrompts
6434
6444
 
6435
- @Field(() => [MJAIAgentPrompt_])
6436
- MJ_AIAgentPrompts_PromptIDArray: MJAIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
6437
-
6438
6445
  @Field(() => [MJAIPromptModel_])
6439
6446
  MJ_AIPromptModels_PromptIDArray: MJAIPromptModel_[]; // Link to MJ_AIPromptModels
6440
6447
 
6448
+ @Field(() => [MJAIAgentPrompt_])
6449
+ MJ_AIAgentPrompts_PromptIDArray: MJAIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
6450
+
6441
6451
  @Field(() => [MJAIAgentStep_])
6442
6452
  MJ_AIAgentSteps_PromptIDArray: MJAIAgentStep_[]; // Link to MJ_AIAgentSteps
6443
6453
 
@@ -6872,25 +6882,25 @@ export class MJAIPromptResolver extends ResolverBase {
6872
6882
  return result;
6873
6883
  }
6874
6884
 
6875
- @FieldResolver(() => [MJAIAgentPrompt_])
6876
- async MJ_AIAgentPrompts_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6877
- this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
6885
+ @FieldResolver(() => [MJAIPromptModel_])
6886
+ async MJ_AIPromptModels_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6887
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
6878
6888
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
6879
6889
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
6880
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [PromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
6890
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [PromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
6881
6891
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
6882
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', rows);
6892
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
6883
6893
  return result;
6884
6894
  }
6885
6895
 
6886
- @FieldResolver(() => [MJAIPromptModel_])
6887
- async MJ_AIPromptModels_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6888
- this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
6896
+ @FieldResolver(() => [MJAIAgentPrompt_])
6897
+ async MJ_AIAgentPrompts_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6898
+ this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
6889
6899
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
6890
6900
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
6891
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [PromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
6901
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [PromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
6892
6902
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
6893
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
6903
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', rows);
6894
6904
  return result;
6895
6905
  }
6896
6906
 
@@ -11946,18 +11956,24 @@ export class MJUser_ {
11946
11956
  @Field(() => [MJReportUserState_])
11947
11957
  MJ_ReportUserStates_UserIDArray: MJReportUserState_[]; // Link to MJ_ReportUserStates
11948
11958
 
11949
- @Field(() => [MJDashboardUserState_])
11950
- MJ_DashboardUserStates_UserIDArray: MJDashboardUserState_[]; // Link to MJ_DashboardUserStates
11951
-
11952
11959
  @Field(() => [MJDashboardUserPreference_])
11953
11960
  MJ_DashboardUserPreferences_UserIDArray: MJDashboardUserPreference_[]; // Link to MJ_DashboardUserPreferences
11954
11961
 
11962
+ @Field(() => [MJDashboardUserState_])
11963
+ MJ_DashboardUserStates_UserIDArray: MJDashboardUserState_[]; // Link to MJ_DashboardUserStates
11964
+
11955
11965
  @Field(() => [MJArtifactVersion_])
11956
11966
  MJ_ArtifactVersions_UserIDArray: MJArtifactVersion_[]; // Link to MJ_ArtifactVersions
11957
11967
 
11958
11968
  @Field(() => [MJPublicLink_])
11959
11969
  MJ_PublicLinks_UserIDArray: MJPublicLink_[]; // Link to MJ_PublicLinks
11960
11970
 
11971
+ @Field(() => [MJScheduledJob_])
11972
+ MJ_ScheduledJobs_NotifyUserIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
11973
+
11974
+ @Field(() => [MJScheduledJobRun_])
11975
+ MJ_ScheduledJobRuns_ExecutedByUserIDArray: MJScheduledJobRun_[]; // Link to MJ_ScheduledJobRuns
11976
+
11961
11977
  @Field(() => [MJResourcePermission_])
11962
11978
  ResourcePermissions_UserIDArray: MJResourcePermission_[]; // Link to ResourcePermissions
11963
11979
 
@@ -11973,6 +11989,9 @@ export class MJUser_ {
11973
11989
  @Field(() => [MJArtifact_])
11974
11990
  MJ_Artifacts_UserIDArray: MJArtifact_[]; // Link to MJ_Artifacts
11975
11991
 
11992
+ @Field(() => [MJScheduledJob_])
11993
+ MJ_ScheduledJobs_OwnerUserIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
11994
+
11976
11995
  @Field(() => [MJAIAgentRun_])
11977
11996
  MJ_AIAgentRuns_UserIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
11978
11997
 
@@ -12540,25 +12559,25 @@ export class MJUserResolverBase extends ResolverBase {
12540
12559
  return result;
12541
12560
  }
12542
12561
 
12543
- @FieldResolver(() => [MJDashboardUserState_])
12544
- async MJ_DashboardUserStates_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12545
- this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
12562
+ @FieldResolver(() => [MJDashboardUserPreference_])
12563
+ async MJ_DashboardUserPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12564
+ this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
12546
12565
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12547
12566
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12548
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
12567
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
12549
12568
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12550
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', rows);
12569
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', rows);
12551
12570
  return result;
12552
12571
  }
12553
12572
 
12554
- @FieldResolver(() => [MJDashboardUserPreference_])
12555
- async MJ_DashboardUserPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12556
- this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
12573
+ @FieldResolver(() => [MJDashboardUserState_])
12574
+ async MJ_DashboardUserStates_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12575
+ this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
12557
12576
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12558
12577
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12559
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
12578
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
12560
12579
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12561
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', rows);
12580
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', rows);
12562
12581
  return result;
12563
12582
  }
12564
12583
 
@@ -12584,6 +12603,28 @@ export class MJUserResolverBase extends ResolverBase {
12584
12603
  return result;
12585
12604
  }
12586
12605
 
12606
+ @FieldResolver(() => [MJScheduledJob_])
12607
+ async MJ_ScheduledJobs_NotifyUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12608
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
12609
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12610
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12611
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [NotifyUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
12612
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12613
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows);
12614
+ return result;
12615
+ }
12616
+
12617
+ @FieldResolver(() => [MJScheduledJobRun_])
12618
+ async MJ_ScheduledJobRuns_ExecutedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12619
+ this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
12620
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12621
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12622
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ExecutedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
12623
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12624
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows);
12625
+ return result;
12626
+ }
12627
+
12587
12628
  @FieldResolver(() => [MJResourcePermission_])
12588
12629
  async ResourcePermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12589
12630
  this.CheckUserReadPermissions('Resource Permissions', userPayload);
@@ -12639,6 +12680,17 @@ export class MJUserResolverBase extends ResolverBase {
12639
12680
  return result;
12640
12681
  }
12641
12682
 
12683
+ @FieldResolver(() => [MJScheduledJob_])
12684
+ async MJ_ScheduledJobs_OwnerUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12685
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
12686
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12687
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12688
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [OwnerUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
12689
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12690
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows);
12691
+ return result;
12692
+ }
12693
+
12642
12694
  @FieldResolver(() => [MJAIAgentRun_])
12643
12695
  async MJ_AIAgentRuns_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12644
12696
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
@@ -39552,6 +39604,243 @@ export class MJQueryEntityResolver extends ResolverBase {
39552
39604
 
39553
39605
  }
39554
39606
 
39607
+ //****************************************************************************
39608
+ // ENTITY CLASS for MJ: Scheduled Job Runs
39609
+ //****************************************************************************
39610
+ @ObjectType({ description: `Records execution history for scheduled jobs. Provides uniform tracking across all job types. Each record represents one execution attempt of a scheduled job.` })
39611
+ export class MJScheduledJobRun_ {
39612
+ @Field()
39613
+ @MaxLength(16)
39614
+ ID: string;
39615
+
39616
+ @Field()
39617
+ @MaxLength(16)
39618
+ ScheduledJobID: string;
39619
+
39620
+ @Field({description: `Timestamp when this job execution began. Set immediately before calling the job plugin's Execute method.`})
39621
+ @MaxLength(10)
39622
+ StartedAt: Date;
39623
+
39624
+ @Field({nullable: true, description: `Timestamp when this job execution completed (successfully or with failure). NULL while the job is still running.`})
39625
+ @MaxLength(10)
39626
+ CompletedAt?: Date;
39627
+
39628
+ @Field({description: `Current status of the job execution. Running=currently executing, Completed=finished (check Success for outcome), Failed=exception during execution, Cancelled=manually cancelled, Timeout=exceeded maximum execution time.`})
39629
+ @MaxLength(40)
39630
+ Status: string;
39631
+
39632
+ @Field(() => Boolean, {nullable: true, description: `Whether the job execution completed successfully. NULL while running, TRUE if successful, FALSE if failed. This is the job-level success from the plugin's Execute method, separate from domain-specific success tracking.`})
39633
+ Success?: boolean;
39634
+
39635
+ @Field({nullable: true, description: `Error message if the job failed. NULL for successful runs. Contains exception messages or error details from the plugin's Execute method.`})
39636
+ ErrorMessage?: string;
39637
+
39638
+ @Field({nullable: true, description: `Job-type specific execution details stored as JSON. May include references to domain-specific run records (e.g., {"AgentRunID": "...", "TokensUsed": 5000}), performance metrics, or other execution metadata. Schema is defined by the job type plugin.`})
39639
+ Details?: string;
39640
+
39641
+ @Field({nullable: true, description: `User context under which the job was executed. Typically the OwnerUserID from the schedule, but can be overridden in job-specific configuration.`})
39642
+ @MaxLength(16)
39643
+ ExecutedByUserID?: string;
39644
+
39645
+ @Field({nullable: true, description: `Timestamp when this execution was queued (for ConcurrencyMode=Queue). NULL for immediate executions. When set, indicates this run is waiting for a previous execution to complete before starting.`})
39646
+ @MaxLength(10)
39647
+ QueuedAt?: Date;
39648
+
39649
+ @Field()
39650
+ @MaxLength(10)
39651
+ _mj__CreatedAt: Date;
39652
+
39653
+ @Field()
39654
+ @MaxLength(10)
39655
+ _mj__UpdatedAt: Date;
39656
+
39657
+ @Field()
39658
+ @MaxLength(400)
39659
+ ScheduledJob: string;
39660
+
39661
+ @Field({nullable: true})
39662
+ @MaxLength(200)
39663
+ ExecutedByUser?: string;
39664
+
39665
+ @Field(() => [MJAIAgentRun_])
39666
+ MJ_AIAgentRuns_ScheduledJobRunIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
39667
+
39668
+ }
39669
+
39670
+ //****************************************************************************
39671
+ // INPUT TYPE for MJ: Scheduled Job Runs
39672
+ //****************************************************************************
39673
+ @InputType()
39674
+ export class CreateMJScheduledJobRunInput {
39675
+ @Field({ nullable: true })
39676
+ ID?: string;
39677
+
39678
+ @Field({ nullable: true })
39679
+ ScheduledJobID?: string;
39680
+
39681
+ @Field({ nullable: true })
39682
+ StartedAt?: Date;
39683
+
39684
+ @Field({ nullable: true })
39685
+ CompletedAt: Date | null;
39686
+
39687
+ @Field({ nullable: true })
39688
+ Status?: string;
39689
+
39690
+ @Field(() => Boolean, { nullable: true })
39691
+ Success: boolean | null;
39692
+
39693
+ @Field({ nullable: true })
39694
+ ErrorMessage: string | null;
39695
+
39696
+ @Field({ nullable: true })
39697
+ Details: string | null;
39698
+
39699
+ @Field({ nullable: true })
39700
+ ExecutedByUserID: string | null;
39701
+
39702
+ @Field({ nullable: true })
39703
+ QueuedAt: Date | null;
39704
+ }
39705
+
39706
+
39707
+ //****************************************************************************
39708
+ // INPUT TYPE for MJ: Scheduled Job Runs
39709
+ //****************************************************************************
39710
+ @InputType()
39711
+ export class UpdateMJScheduledJobRunInput {
39712
+ @Field()
39713
+ ID: string;
39714
+
39715
+ @Field({ nullable: true })
39716
+ ScheduledJobID?: string;
39717
+
39718
+ @Field({ nullable: true })
39719
+ StartedAt?: Date;
39720
+
39721
+ @Field({ nullable: true })
39722
+ CompletedAt?: Date | null;
39723
+
39724
+ @Field({ nullable: true })
39725
+ Status?: string;
39726
+
39727
+ @Field(() => Boolean, { nullable: true })
39728
+ Success?: boolean | null;
39729
+
39730
+ @Field({ nullable: true })
39731
+ ErrorMessage?: string | null;
39732
+
39733
+ @Field({ nullable: true })
39734
+ Details?: string | null;
39735
+
39736
+ @Field({ nullable: true })
39737
+ ExecutedByUserID?: string | null;
39738
+
39739
+ @Field({ nullable: true })
39740
+ QueuedAt?: Date | null;
39741
+
39742
+ @Field(() => [KeyValuePairInput], { nullable: true })
39743
+ OldValues___?: KeyValuePairInput[];
39744
+ }
39745
+
39746
+ //****************************************************************************
39747
+ // RESOLVER for MJ: Scheduled Job Runs
39748
+ //****************************************************************************
39749
+ @ObjectType()
39750
+ export class RunMJScheduledJobRunViewResult {
39751
+ @Field(() => [MJScheduledJobRun_])
39752
+ Results: MJScheduledJobRun_[];
39753
+
39754
+ @Field(() => String, {nullable: true})
39755
+ UserViewRunID?: string;
39756
+
39757
+ @Field(() => Int, {nullable: true})
39758
+ RowCount: number;
39759
+
39760
+ @Field(() => Int, {nullable: true})
39761
+ TotalRowCount: number;
39762
+
39763
+ @Field(() => Int, {nullable: true})
39764
+ ExecutionTime: number;
39765
+
39766
+ @Field({nullable: true})
39767
+ ErrorMessage?: string;
39768
+
39769
+ @Field(() => Boolean, {nullable: false})
39770
+ Success: boolean;
39771
+ }
39772
+
39773
+ @Resolver(MJScheduledJobRun_)
39774
+ export class MJScheduledJobRunResolver extends ResolverBase {
39775
+ @Query(() => RunMJScheduledJobRunViewResult)
39776
+ async RunMJScheduledJobRunViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39777
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39778
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
39779
+ }
39780
+
39781
+ @Query(() => RunMJScheduledJobRunViewResult)
39782
+ async RunMJScheduledJobRunViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39783
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39784
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
39785
+ }
39786
+
39787
+ @Query(() => RunMJScheduledJobRunViewResult)
39788
+ async RunMJScheduledJobRunDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39789
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39790
+ input.EntityName = 'MJ: Scheduled Job Runs';
39791
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
39792
+ }
39793
+ @Query(() => MJScheduledJobRun_, { nullable: true })
39794
+ async MJScheduledJobRun(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJScheduledJobRun_ | null> {
39795
+ this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
39796
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39797
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
39798
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
39799
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
39800
+ const result = this.MapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows && rows.length > 0 ? rows[0] : {})
39801
+ return result;
39802
+ }
39803
+
39804
+ @FieldResolver(() => [MJAIAgentRun_])
39805
+ async MJ_AIAgentRuns_ScheduledJobRunIDArray(@Root() mjscheduledjobrun_: MJScheduledJobRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
39806
+ this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
39807
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39808
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
39809
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRuns] WHERE [ScheduledJobRunID]='${mjscheduledjobrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
39810
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
39811
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows);
39812
+ return result;
39813
+ }
39814
+
39815
+ @Mutation(() => MJScheduledJobRun_)
39816
+ async CreateMJScheduledJobRun(
39817
+ @Arg('input', () => CreateMJScheduledJobRunInput) input: CreateMJScheduledJobRunInput,
39818
+ @Ctx() { providers, userPayload }: AppContext,
39819
+ @PubSub() pubSub: PubSubEngine
39820
+ ) {
39821
+ const provider = GetReadWriteProvider(providers);
39822
+ return this.CreateRecord('MJ: Scheduled Job Runs', input, provider, userPayload, pubSub)
39823
+ }
39824
+
39825
+ @Mutation(() => MJScheduledJobRun_)
39826
+ async UpdateMJScheduledJobRun(
39827
+ @Arg('input', () => UpdateMJScheduledJobRunInput) input: UpdateMJScheduledJobRunInput,
39828
+ @Ctx() { providers, userPayload }: AppContext,
39829
+ @PubSub() pubSub: PubSubEngine
39830
+ ) {
39831
+ const provider = GetReadWriteProvider(providers);
39832
+ return this.UpdateRecord('MJ: Scheduled Job Runs', input, provider, userPayload, pubSub);
39833
+ }
39834
+
39835
+ @Mutation(() => MJScheduledJobRun_)
39836
+ async DeleteMJScheduledJobRun(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39837
+ const provider = GetReadWriteProvider(providers);
39838
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
39839
+ return this.DeleteRecord('MJ: Scheduled Job Runs', key, options, provider, userPayload, pubSub);
39840
+ }
39841
+
39842
+ }
39843
+
39555
39844
  //****************************************************************************
39556
39845
  // ENTITY CLASS for MJ: Dashboard User States
39557
39846
  //****************************************************************************
@@ -41982,6 +42271,206 @@ export class MJComponentLibraryResolver extends ResolverBase {
41982
42271
 
41983
42272
  }
41984
42273
 
42274
+ //****************************************************************************
42275
+ // ENTITY CLASS for MJ: Scheduled Job Types
42276
+ //****************************************************************************
42277
+ @ObjectType({ description: `Defines types of schedulable jobs and their plugin implementations. Each job type represents a different kind of work that can be scheduled (e.g., Agents, Actions, Reports).` })
42278
+ export class MJScheduledJobType_ {
42279
+ @Field()
42280
+ @MaxLength(16)
42281
+ ID: string;
42282
+
42283
+ @Field({description: `Unique name identifying this job type (e.g., Agent, Action, Report).`})
42284
+ @MaxLength(200)
42285
+ Name: string;
42286
+
42287
+ @Field({nullable: true, description: `Human-readable description of what this job type does and when it should be used.`})
42288
+ Description?: string;
42289
+
42290
+ @Field({description: `TypeScript class name that implements BaseScheduledJob for this job type. Used by ClassFactory to instantiate the correct plugin at runtime.`})
42291
+ @MaxLength(510)
42292
+ DriverClass: string;
42293
+
42294
+ @Field({nullable: true, description: `Name of the entity that stores execution records for this job type (e.g., "MJ: AI Agent Runs", "Action Execution Logs"). Used for generic UI linking to domain-specific run records. NULL if job type uses ScheduledJobRun as its only execution record.`})
42295
+ @MaxLength(510)
42296
+ DomainRunEntity?: string;
42297
+
42298
+ @Field({nullable: true, description: `Name of the foreign key field in the DomainRunEntity that links back to ScheduledJobRun (e.g., "ScheduleID"). Used for querying related domain runs. NULL if DomainRunEntity is NULL.`})
42299
+ @MaxLength(200)
42300
+ DomainRunEntityFKey?: string;
42301
+
42302
+ @Field(() => Boolean, {description: `Indicates whether this job type supports sending notifications on completion or failure.`})
42303
+ NotificationsAvailable: boolean;
42304
+
42305
+ @Field()
42306
+ @MaxLength(10)
42307
+ _mj__CreatedAt: Date;
42308
+
42309
+ @Field()
42310
+ @MaxLength(10)
42311
+ _mj__UpdatedAt: Date;
42312
+
42313
+ @Field(() => [MJScheduledJob_])
42314
+ MJ_ScheduledJobs_JobTypeIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
42315
+
42316
+ }
42317
+
42318
+ //****************************************************************************
42319
+ // INPUT TYPE for MJ: Scheduled Job Types
42320
+ //****************************************************************************
42321
+ @InputType()
42322
+ export class CreateMJScheduledJobTypeInput {
42323
+ @Field({ nullable: true })
42324
+ ID?: string;
42325
+
42326
+ @Field({ nullable: true })
42327
+ Name?: string;
42328
+
42329
+ @Field({ nullable: true })
42330
+ Description: string | null;
42331
+
42332
+ @Field({ nullable: true })
42333
+ DriverClass?: string;
42334
+
42335
+ @Field({ nullable: true })
42336
+ DomainRunEntity: string | null;
42337
+
42338
+ @Field({ nullable: true })
42339
+ DomainRunEntityFKey: string | null;
42340
+
42341
+ @Field(() => Boolean, { nullable: true })
42342
+ NotificationsAvailable?: boolean;
42343
+ }
42344
+
42345
+
42346
+ //****************************************************************************
42347
+ // INPUT TYPE for MJ: Scheduled Job Types
42348
+ //****************************************************************************
42349
+ @InputType()
42350
+ export class UpdateMJScheduledJobTypeInput {
42351
+ @Field()
42352
+ ID: string;
42353
+
42354
+ @Field({ nullable: true })
42355
+ Name?: string;
42356
+
42357
+ @Field({ nullable: true })
42358
+ Description?: string | null;
42359
+
42360
+ @Field({ nullable: true })
42361
+ DriverClass?: string;
42362
+
42363
+ @Field({ nullable: true })
42364
+ DomainRunEntity?: string | null;
42365
+
42366
+ @Field({ nullable: true })
42367
+ DomainRunEntityFKey?: string | null;
42368
+
42369
+ @Field(() => Boolean, { nullable: true })
42370
+ NotificationsAvailable?: boolean;
42371
+
42372
+ @Field(() => [KeyValuePairInput], { nullable: true })
42373
+ OldValues___?: KeyValuePairInput[];
42374
+ }
42375
+
42376
+ //****************************************************************************
42377
+ // RESOLVER for MJ: Scheduled Job Types
42378
+ //****************************************************************************
42379
+ @ObjectType()
42380
+ export class RunMJScheduledJobTypeViewResult {
42381
+ @Field(() => [MJScheduledJobType_])
42382
+ Results: MJScheduledJobType_[];
42383
+
42384
+ @Field(() => String, {nullable: true})
42385
+ UserViewRunID?: string;
42386
+
42387
+ @Field(() => Int, {nullable: true})
42388
+ RowCount: number;
42389
+
42390
+ @Field(() => Int, {nullable: true})
42391
+ TotalRowCount: number;
42392
+
42393
+ @Field(() => Int, {nullable: true})
42394
+ ExecutionTime: number;
42395
+
42396
+ @Field({nullable: true})
42397
+ ErrorMessage?: string;
42398
+
42399
+ @Field(() => Boolean, {nullable: false})
42400
+ Success: boolean;
42401
+ }
42402
+
42403
+ @Resolver(MJScheduledJobType_)
42404
+ export class MJScheduledJobTypeResolver extends ResolverBase {
42405
+ @Query(() => RunMJScheduledJobTypeViewResult)
42406
+ async RunMJScheduledJobTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42407
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42408
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
42409
+ }
42410
+
42411
+ @Query(() => RunMJScheduledJobTypeViewResult)
42412
+ async RunMJScheduledJobTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42413
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42414
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
42415
+ }
42416
+
42417
+ @Query(() => RunMJScheduledJobTypeViewResult)
42418
+ async RunMJScheduledJobTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42419
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42420
+ input.EntityName = 'MJ: Scheduled Job Types';
42421
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
42422
+ }
42423
+ @Query(() => MJScheduledJobType_, { nullable: true })
42424
+ async MJScheduledJobType(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJScheduledJobType_ | null> {
42425
+ this.CheckUserReadPermissions('MJ: Scheduled Job Types', userPayload);
42426
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42427
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
42428
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobTypes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Types', userPayload, EntityPermissionType.Read, 'AND');
42429
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
42430
+ const result = this.MapFieldNamesToCodeNames('MJ: Scheduled Job Types', rows && rows.length > 0 ? rows[0] : {})
42431
+ return result;
42432
+ }
42433
+
42434
+ @FieldResolver(() => [MJScheduledJob_])
42435
+ async MJ_ScheduledJobs_JobTypeIDArray(@Root() mjscheduledjobtype_: MJScheduledJobType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
42436
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
42437
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42438
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
42439
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [JobTypeID]='${mjscheduledjobtype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
42440
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
42441
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows);
42442
+ return result;
42443
+ }
42444
+
42445
+ @Mutation(() => MJScheduledJobType_)
42446
+ async CreateMJScheduledJobType(
42447
+ @Arg('input', () => CreateMJScheduledJobTypeInput) input: CreateMJScheduledJobTypeInput,
42448
+ @Ctx() { providers, userPayload }: AppContext,
42449
+ @PubSub() pubSub: PubSubEngine
42450
+ ) {
42451
+ const provider = GetReadWriteProvider(providers);
42452
+ return this.CreateRecord('MJ: Scheduled Job Types', input, provider, userPayload, pubSub)
42453
+ }
42454
+
42455
+ @Mutation(() => MJScheduledJobType_)
42456
+ async UpdateMJScheduledJobType(
42457
+ @Arg('input', () => UpdateMJScheduledJobTypeInput) input: UpdateMJScheduledJobTypeInput,
42458
+ @Ctx() { providers, userPayload }: AppContext,
42459
+ @PubSub() pubSub: PubSubEngine
42460
+ ) {
42461
+ const provider = GetReadWriteProvider(providers);
42462
+ return this.UpdateRecord('MJ: Scheduled Job Types', input, provider, userPayload, pubSub);
42463
+ }
42464
+
42465
+ @Mutation(() => MJScheduledJobType_)
42466
+ async DeleteMJScheduledJobType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42467
+ const provider = GetReadWriteProvider(providers);
42468
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
42469
+ return this.DeleteRecord('MJ: Scheduled Job Types', key, options, provider, userPayload, pubSub);
42470
+ }
42471
+
42472
+ }
42473
+
41985
42474
  //****************************************************************************
41986
42475
  // ENTITY CLASS for MJ: Dashboard User Preferences
41987
42476
  //****************************************************************************
@@ -42641,6 +43130,9 @@ export class MJAIAgentRelationship_ {
42641
43130
  @MaxLength(10)
42642
43131
  _mj__UpdatedAt: Date;
42643
43132
 
43133
+ @Field({nullable: true, description: `JSON configuration mapping sub-agent result payload paths to parent agent payload paths. Enables controlled merging of sub-agent results. Format: {"subAgentPath": "parentPath", "*": "captureAllPath"}. If null, sub-agent results are not automatically merged into parent payload.`})
43134
+ SubAgentOutputMapping?: string;
43135
+
42644
43136
  @Field({nullable: true})
42645
43137
  @MaxLength(510)
42646
43138
  Agent?: string;
@@ -42667,6 +43159,9 @@ export class CreateMJAIAgentRelationshipInput {
42667
43159
 
42668
43160
  @Field({ nullable: true })
42669
43161
  Status?: string;
43162
+
43163
+ @Field({ nullable: true })
43164
+ SubAgentOutputMapping: string | null;
42670
43165
  }
42671
43166
 
42672
43167
 
@@ -42687,6 +43182,9 @@ export class UpdateMJAIAgentRelationshipInput {
42687
43182
  @Field({ nullable: true })
42688
43183
  Status?: string;
42689
43184
 
43185
+ @Field({ nullable: true })
43186
+ SubAgentOutputMapping?: string | null;
43187
+
42690
43188
  @Field(() => [KeyValuePairInput], { nullable: true })
42691
43189
  OldValues___?: KeyValuePairInput[];
42692
43190
  }
@@ -45237,6 +45735,401 @@ export class MJGeneratedCodeResolver extends ResolverBase {
45237
45735
 
45238
45736
  }
45239
45737
 
45738
+ //****************************************************************************
45739
+ // ENTITY CLASS for MJ: Scheduled Jobs
45740
+ //****************************************************************************
45741
+ @ObjectType({ description: `Defines schedules for automated job execution across all schedulable types. Each record represents a scheduled job with its cron expression, configuration, and execution tracking.` })
45742
+ export class MJScheduledJob_ {
45743
+ @Field()
45744
+ @MaxLength(16)
45745
+ ID: string;
45746
+
45747
+ @Field()
45748
+ @MaxLength(16)
45749
+ JobTypeID: string;
45750
+
45751
+ @Field({description: `Human-readable name for this scheduled job. Should clearly identify what the job does.`})
45752
+ @MaxLength(400)
45753
+ Name: string;
45754
+
45755
+ @Field({nullable: true, description: `Detailed description of the job's purpose, what it does, and any important notes about its execution.`})
45756
+ Description?: string;
45757
+
45758
+ @Field({description: `Cron expression defining when the job should execute (e.g., "0 30 9 * * MON-FRI" for weekdays at 9:30 AM). Uses standard cron syntax with seconds precision.`})
45759
+ @MaxLength(240)
45760
+ CronExpression: string;
45761
+
45762
+ @Field({description: `IANA timezone identifier for interpreting the cron expression (e.g., "America/Chicago", "UTC"). Ensures consistent scheduling across different server locations.`})
45763
+ @MaxLength(128)
45764
+ Timezone: string;
45765
+
45766
+ @Field({nullable: true, description: `Optional start date/time for when this schedule becomes active. Job will not execute before this time. NULL means active immediately upon creation.`})
45767
+ @MaxLength(10)
45768
+ StartAt?: Date;
45769
+
45770
+ @Field({nullable: true, description: `Optional end date/time for when this schedule expires. Job will not execute after this time. NULL means no expiration.`})
45771
+ @MaxLength(10)
45772
+ EndAt?: Date;
45773
+
45774
+ @Field({description: `Current status of the schedule. Pending=created but not yet active, Active=currently running on schedule, Paused=temporarily stopped, Disabled=manually disabled, Expired=past EndAt date.`})
45775
+ @MaxLength(40)
45776
+ Status: string;
45777
+
45778
+ @Field({nullable: true, description: `Job-type specific configuration stored as JSON. Schema is defined by the ScheduledJobType plugin. For Agents: includes AgentID, StartingPayload, InitialMessage, etc. For Actions: includes ActionID and parameter mappings.`})
45779
+ Configuration?: string;
45780
+
45781
+ @Field({nullable: true, description: `User who owns this schedule. Used as the execution context if no specific user is configured in the job-specific configuration.`})
45782
+ @MaxLength(16)
45783
+ OwnerUserID?: string;
45784
+
45785
+ @Field({nullable: true, description: `Timestamp of the most recent execution. Updated after each run. Used for monitoring and dashboard displays.`})
45786
+ @MaxLength(10)
45787
+ LastRunAt?: Date;
45788
+
45789
+ @Field({nullable: true, description: `Calculated timestamp of when this job should next execute based on the cron expression. Updated after each run. Used by scheduler to determine which jobs are due.`})
45790
+ @MaxLength(10)
45791
+ NextRunAt?: Date;
45792
+
45793
+ @Field(() => Int, {description: `Total number of times this schedule has been executed, including both successful and failed runs.`})
45794
+ RunCount: number;
45795
+
45796
+ @Field(() => Int, {description: `Number of times this schedule has executed successfully (Success = true in ScheduledJobRun).`})
45797
+ SuccessCount: number;
45798
+
45799
+ @Field(() => Int, {description: `Number of times this schedule has executed but failed (Success = false in ScheduledJobRun).`})
45800
+ FailureCount: number;
45801
+
45802
+ @Field(() => Boolean, {description: `Whether to send notifications when the job completes successfully.`})
45803
+ NotifyOnSuccess: boolean;
45804
+
45805
+ @Field(() => Boolean, {description: `Whether to send notifications when the job fails. Defaults to true for alerting on failures.`})
45806
+ NotifyOnFailure: boolean;
45807
+
45808
+ @Field({nullable: true, description: `User to notify about job execution results. If NULL and notifications are enabled, falls back to OwnerUserID.`})
45809
+ @MaxLength(16)
45810
+ NotifyUserID?: string;
45811
+
45812
+ @Field(() => Boolean, {description: `Whether to send email notifications. Requires NotifyOnSuccess or NotifyOnFailure to also be enabled.`})
45813
+ NotifyViaEmail: boolean;
45814
+
45815
+ @Field(() => Boolean, {description: `Whether to send in-app notifications. Requires NotifyOnSuccess or NotifyOnFailure to also be enabled. Defaults to true.`})
45816
+ NotifyViaInApp: boolean;
45817
+
45818
+ @Field({nullable: true, description: `Unique token used for distributed locking across multiple server instances. Set when a server claims the job for execution. Prevents duplicate executions in multi-server environments.`})
45819
+ @MaxLength(16)
45820
+ LockToken?: string;
45821
+
45822
+ @Field({nullable: true, description: `Timestamp when the lock was acquired. Used with ExpectedCompletionAt to detect stale locks from crashed server instances.`})
45823
+ @MaxLength(10)
45824
+ LockedAt?: Date;
45825
+
45826
+ @Field({nullable: true, description: `Identifier of the server instance that currently holds the lock (e.g., "hostname-12345"). Used for troubleshooting and monitoring which server is executing which job.`})
45827
+ @MaxLength(510)
45828
+ LockedByInstance?: string;
45829
+
45830
+ @Field({nullable: true, description: `Expected completion time for the current execution. If current time exceeds this and lock still exists, the lock is considered stale and can be claimed by another instance. Handles crashed server cleanup.`})
45831
+ @MaxLength(10)
45832
+ ExpectedCompletionAt?: Date;
45833
+
45834
+ @Field({description: `Controls behavior when a new execution is scheduled while a previous execution is still running. Skip=do not start new execution (default), Queue=wait for current to finish then execute, Concurrent=allow multiple simultaneous executions.`})
45835
+ @MaxLength(40)
45836
+ ConcurrencyMode: string;
45837
+
45838
+ @Field()
45839
+ @MaxLength(10)
45840
+ _mj__CreatedAt: Date;
45841
+
45842
+ @Field()
45843
+ @MaxLength(10)
45844
+ _mj__UpdatedAt: Date;
45845
+
45846
+ @Field()
45847
+ @MaxLength(200)
45848
+ JobType: string;
45849
+
45850
+ @Field({nullable: true})
45851
+ @MaxLength(200)
45852
+ OwnerUser?: string;
45853
+
45854
+ @Field({nullable: true})
45855
+ @MaxLength(200)
45856
+ NotifyUser?: string;
45857
+
45858
+ @Field(() => [MJScheduledJobRun_])
45859
+ MJ_ScheduledJobRuns_ScheduledJobIDArray: MJScheduledJobRun_[]; // Link to MJ_ScheduledJobRuns
45860
+
45861
+ }
45862
+
45863
+ //****************************************************************************
45864
+ // INPUT TYPE for MJ: Scheduled Jobs
45865
+ //****************************************************************************
45866
+ @InputType()
45867
+ export class CreateMJScheduledJobInput {
45868
+ @Field({ nullable: true })
45869
+ ID?: string;
45870
+
45871
+ @Field({ nullable: true })
45872
+ JobTypeID?: string;
45873
+
45874
+ @Field({ nullable: true })
45875
+ Name?: string;
45876
+
45877
+ @Field({ nullable: true })
45878
+ Description: string | null;
45879
+
45880
+ @Field({ nullable: true })
45881
+ CronExpression?: string;
45882
+
45883
+ @Field({ nullable: true })
45884
+ Timezone?: string;
45885
+
45886
+ @Field({ nullable: true })
45887
+ StartAt: Date | null;
45888
+
45889
+ @Field({ nullable: true })
45890
+ EndAt: Date | null;
45891
+
45892
+ @Field({ nullable: true })
45893
+ Status?: string;
45894
+
45895
+ @Field({ nullable: true })
45896
+ Configuration: string | null;
45897
+
45898
+ @Field({ nullable: true })
45899
+ OwnerUserID: string | null;
45900
+
45901
+ @Field({ nullable: true })
45902
+ LastRunAt: Date | null;
45903
+
45904
+ @Field({ nullable: true })
45905
+ NextRunAt: Date | null;
45906
+
45907
+ @Field(() => Int, { nullable: true })
45908
+ RunCount?: number;
45909
+
45910
+ @Field(() => Int, { nullable: true })
45911
+ SuccessCount?: number;
45912
+
45913
+ @Field(() => Int, { nullable: true })
45914
+ FailureCount?: number;
45915
+
45916
+ @Field(() => Boolean, { nullable: true })
45917
+ NotifyOnSuccess?: boolean;
45918
+
45919
+ @Field(() => Boolean, { nullable: true })
45920
+ NotifyOnFailure?: boolean;
45921
+
45922
+ @Field({ nullable: true })
45923
+ NotifyUserID: string | null;
45924
+
45925
+ @Field(() => Boolean, { nullable: true })
45926
+ NotifyViaEmail?: boolean;
45927
+
45928
+ @Field(() => Boolean, { nullable: true })
45929
+ NotifyViaInApp?: boolean;
45930
+
45931
+ @Field({ nullable: true })
45932
+ LockToken: string | null;
45933
+
45934
+ @Field({ nullable: true })
45935
+ LockedAt: Date | null;
45936
+
45937
+ @Field({ nullable: true })
45938
+ LockedByInstance: string | null;
45939
+
45940
+ @Field({ nullable: true })
45941
+ ExpectedCompletionAt: Date | null;
45942
+
45943
+ @Field({ nullable: true })
45944
+ ConcurrencyMode?: string;
45945
+ }
45946
+
45947
+
45948
+ //****************************************************************************
45949
+ // INPUT TYPE for MJ: Scheduled Jobs
45950
+ //****************************************************************************
45951
+ @InputType()
45952
+ export class UpdateMJScheduledJobInput {
45953
+ @Field()
45954
+ ID: string;
45955
+
45956
+ @Field({ nullable: true })
45957
+ JobTypeID?: string;
45958
+
45959
+ @Field({ nullable: true })
45960
+ Name?: string;
45961
+
45962
+ @Field({ nullable: true })
45963
+ Description?: string | null;
45964
+
45965
+ @Field({ nullable: true })
45966
+ CronExpression?: string;
45967
+
45968
+ @Field({ nullable: true })
45969
+ Timezone?: string;
45970
+
45971
+ @Field({ nullable: true })
45972
+ StartAt?: Date | null;
45973
+
45974
+ @Field({ nullable: true })
45975
+ EndAt?: Date | null;
45976
+
45977
+ @Field({ nullable: true })
45978
+ Status?: string;
45979
+
45980
+ @Field({ nullable: true })
45981
+ Configuration?: string | null;
45982
+
45983
+ @Field({ nullable: true })
45984
+ OwnerUserID?: string | null;
45985
+
45986
+ @Field({ nullable: true })
45987
+ LastRunAt?: Date | null;
45988
+
45989
+ @Field({ nullable: true })
45990
+ NextRunAt?: Date | null;
45991
+
45992
+ @Field(() => Int, { nullable: true })
45993
+ RunCount?: number;
45994
+
45995
+ @Field(() => Int, { nullable: true })
45996
+ SuccessCount?: number;
45997
+
45998
+ @Field(() => Int, { nullable: true })
45999
+ FailureCount?: number;
46000
+
46001
+ @Field(() => Boolean, { nullable: true })
46002
+ NotifyOnSuccess?: boolean;
46003
+
46004
+ @Field(() => Boolean, { nullable: true })
46005
+ NotifyOnFailure?: boolean;
46006
+
46007
+ @Field({ nullable: true })
46008
+ NotifyUserID?: string | null;
46009
+
46010
+ @Field(() => Boolean, { nullable: true })
46011
+ NotifyViaEmail?: boolean;
46012
+
46013
+ @Field(() => Boolean, { nullable: true })
46014
+ NotifyViaInApp?: boolean;
46015
+
46016
+ @Field({ nullable: true })
46017
+ LockToken?: string | null;
46018
+
46019
+ @Field({ nullable: true })
46020
+ LockedAt?: Date | null;
46021
+
46022
+ @Field({ nullable: true })
46023
+ LockedByInstance?: string | null;
46024
+
46025
+ @Field({ nullable: true })
46026
+ ExpectedCompletionAt?: Date | null;
46027
+
46028
+ @Field({ nullable: true })
46029
+ ConcurrencyMode?: string;
46030
+
46031
+ @Field(() => [KeyValuePairInput], { nullable: true })
46032
+ OldValues___?: KeyValuePairInput[];
46033
+ }
46034
+
46035
+ //****************************************************************************
46036
+ // RESOLVER for MJ: Scheduled Jobs
46037
+ //****************************************************************************
46038
+ @ObjectType()
46039
+ export class RunMJScheduledJobViewResult {
46040
+ @Field(() => [MJScheduledJob_])
46041
+ Results: MJScheduledJob_[];
46042
+
46043
+ @Field(() => String, {nullable: true})
46044
+ UserViewRunID?: string;
46045
+
46046
+ @Field(() => Int, {nullable: true})
46047
+ RowCount: number;
46048
+
46049
+ @Field(() => Int, {nullable: true})
46050
+ TotalRowCount: number;
46051
+
46052
+ @Field(() => Int, {nullable: true})
46053
+ ExecutionTime: number;
46054
+
46055
+ @Field({nullable: true})
46056
+ ErrorMessage?: string;
46057
+
46058
+ @Field(() => Boolean, {nullable: false})
46059
+ Success: boolean;
46060
+ }
46061
+
46062
+ @Resolver(MJScheduledJob_)
46063
+ export class MJScheduledJobResolver extends ResolverBase {
46064
+ @Query(() => RunMJScheduledJobViewResult)
46065
+ async RunMJScheduledJobViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46066
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46067
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
46068
+ }
46069
+
46070
+ @Query(() => RunMJScheduledJobViewResult)
46071
+ async RunMJScheduledJobViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46072
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46073
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
46074
+ }
46075
+
46076
+ @Query(() => RunMJScheduledJobViewResult)
46077
+ async RunMJScheduledJobDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46078
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46079
+ input.EntityName = 'MJ: Scheduled Jobs';
46080
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
46081
+ }
46082
+ @Query(() => MJScheduledJob_, { nullable: true })
46083
+ async MJScheduledJob(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJScheduledJob_ | null> {
46084
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
46085
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46086
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46087
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
46088
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46089
+ const result = this.MapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows && rows.length > 0 ? rows[0] : {})
46090
+ return result;
46091
+ }
46092
+
46093
+ @FieldResolver(() => [MJScheduledJobRun_])
46094
+ async MJ_ScheduledJobRuns_ScheduledJobIDArray(@Root() mjscheduledjob_: MJScheduledJob_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
46095
+ this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
46096
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46097
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46098
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ScheduledJobID]='${mjscheduledjob_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
46099
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46100
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows);
46101
+ return result;
46102
+ }
46103
+
46104
+ @Mutation(() => MJScheduledJob_)
46105
+ async CreateMJScheduledJob(
46106
+ @Arg('input', () => CreateMJScheduledJobInput) input: CreateMJScheduledJobInput,
46107
+ @Ctx() { providers, userPayload }: AppContext,
46108
+ @PubSub() pubSub: PubSubEngine
46109
+ ) {
46110
+ const provider = GetReadWriteProvider(providers);
46111
+ return this.CreateRecord('MJ: Scheduled Jobs', input, provider, userPayload, pubSub)
46112
+ }
46113
+
46114
+ @Mutation(() => MJScheduledJob_)
46115
+ async UpdateMJScheduledJob(
46116
+ @Arg('input', () => UpdateMJScheduledJobInput) input: UpdateMJScheduledJobInput,
46117
+ @Ctx() { providers, userPayload }: AppContext,
46118
+ @PubSub() pubSub: PubSubEngine
46119
+ ) {
46120
+ const provider = GetReadWriteProvider(providers);
46121
+ return this.UpdateRecord('MJ: Scheduled Jobs', input, provider, userPayload, pubSub);
46122
+ }
46123
+
46124
+ @Mutation(() => MJScheduledJob_)
46125
+ async DeleteMJScheduledJob(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46126
+ const provider = GetReadWriteProvider(providers);
46127
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
46128
+ return this.DeleteRecord('MJ: Scheduled Jobs', key, options, provider, userPayload, pubSub);
46129
+ }
46130
+
46131
+ }
46132
+
45240
46133
  //****************************************************************************
45241
46134
  // ENTITY CLASS for MJ: AI Prompt Runs
45242
46135
  //****************************************************************************