@memberjunction/server 2.106.0 → 2.108.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 (37) hide show
  1. package/dist/agents/skip-sdk.d.ts +11 -0
  2. package/dist/agents/skip-sdk.d.ts.map +1 -1
  3. package/dist/agents/skip-sdk.js +262 -3
  4. package/dist/agents/skip-sdk.js.map +1 -1
  5. package/dist/config.d.ts +60 -0
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +8 -0
  8. package/dist/config.js.map +1 -1
  9. package/dist/context.d.ts.map +1 -1
  10. package/dist/context.js +3 -2
  11. package/dist/context.js.map +1 -1
  12. package/dist/generated/generated.d.ts +355 -20
  13. package/dist/generated/generated.d.ts.map +1 -1
  14. package/dist/generated/generated.js +2220 -154
  15. package/dist/generated/generated.js.map +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +38 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/resolvers/AskSkipResolver.d.ts.map +1 -1
  20. package/dist/resolvers/AskSkipResolver.js +0 -2
  21. package/dist/resolvers/AskSkipResolver.js.map +1 -1
  22. package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
  23. package/dist/resolvers/RunAIAgentResolver.js +1 -0
  24. package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
  25. package/dist/services/ScheduledJobsService.d.ts +21 -0
  26. package/dist/services/ScheduledJobsService.d.ts.map +1 -0
  27. package/dist/services/ScheduledJobsService.js +105 -0
  28. package/dist/services/ScheduledJobsService.js.map +1 -0
  29. package/package.json +34 -30
  30. package/src/agents/skip-sdk.ts +351 -8
  31. package/src/config.ts +10 -0
  32. package/src/context.ts +3 -2
  33. package/src/generated/generated.ts +1419 -119
  34. package/src/index.ts +50 -0
  35. package/src/resolvers/AskSkipResolver.ts +5 -3
  36. package/src/resolvers/RunAIAgentResolver.ts +1 -0
  37. package/src/services/ScheduledJobsService.ts +164 -0
@@ -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, CollectionPermissionEntity, 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
 
@@ -2953,6 +2963,10 @@ if this limit is exceeded.`})
2953
2963
  @MaxLength(16)
2954
2964
  OwnerUserID: string;
2955
2965
 
2966
+ @Field({description: `Controls how the agent can be invoked: Any (default - can be top-level or sub-agent), Top-Level (only callable as primary agent), Sub-Agent (only callable as sub-agent). Used to filter available agents in tools like Sage.`})
2967
+ @MaxLength(40)
2968
+ InvocationMode: string;
2969
+
2956
2970
  @Field({nullable: true})
2957
2971
  @MaxLength(510)
2958
2972
  Parent?: string;
@@ -2977,12 +2991,12 @@ if this limit is exceeded.`})
2977
2991
  @MaxLength(16)
2978
2992
  RootParentID?: string;
2979
2993
 
2980
- @Field(() => [MJAIAgentAction_])
2981
- AIAgentActions_AgentIDArray: MJAIAgentAction_[]; // Link to AIAgentActions
2982
-
2983
2994
  @Field(() => [MJAIAgentModel_])
2984
2995
  AIAgentModels_AgentIDArray: MJAIAgentModel_[]; // Link to AIAgentModels
2985
2996
 
2997
+ @Field(() => [MJAIAgentAction_])
2998
+ AIAgentActions_AgentIDArray: MJAIAgentAction_[]; // Link to AIAgentActions
2999
+
2986
3000
  @Field(() => [MJAIAgentLearningCycle_])
2987
3001
  AIAgentLearningCycles_AgentIDArray: MJAIAgentLearningCycle_[]; // Link to AIAgentLearningCycles
2988
3002
 
@@ -3148,6 +3162,9 @@ export class CreateMJAIAgentInput {
3148
3162
 
3149
3163
  @Field({ nullable: true })
3150
3164
  OwnerUserID?: string;
3165
+
3166
+ @Field({ nullable: true })
3167
+ InvocationMode?: string;
3151
3168
  }
3152
3169
 
3153
3170
 
@@ -3267,6 +3284,9 @@ export class UpdateMJAIAgentInput {
3267
3284
  @Field({ nullable: true })
3268
3285
  OwnerUserID?: string;
3269
3286
 
3287
+ @Field({ nullable: true })
3288
+ InvocationMode?: string;
3289
+
3270
3290
  @Field(() => [KeyValuePairInput], { nullable: true })
3271
3291
  OldValues___?: KeyValuePairInput[];
3272
3292
  }
@@ -3329,25 +3349,25 @@ export class MJAIAgentResolver extends ResolverBase {
3329
3349
  return result;
3330
3350
  }
3331
3351
 
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);
3352
+ @FieldResolver(() => [MJAIAgentModel_])
3353
+ async AIAgentModels_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3354
+ this.CheckUserReadPermissions('AI Agent Models', userPayload);
3335
3355
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3336
3356
  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');
3357
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentModels] WHERE [AgentID]='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Models', userPayload, EntityPermissionType.Read, 'AND');
3338
3358
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3339
- const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Actions', rows);
3359
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Models', rows);
3340
3360
  return result;
3341
3361
  }
3342
3362
 
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);
3363
+ @FieldResolver(() => [MJAIAgentAction_])
3364
+ async AIAgentActions_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3365
+ this.CheckUserReadPermissions('AI Agent Actions', userPayload);
3346
3366
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3347
3367
  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');
3368
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentActions] WHERE [AgentID]='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Actions', userPayload, EntityPermissionType.Read, 'AND');
3349
3369
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3350
- const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Models', rows);
3370
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Actions', rows);
3351
3371
  return result;
3352
3372
  }
3353
3373
 
@@ -4861,21 +4881,21 @@ export class MJEnvironment_ {
4861
4881
  @MaxLength(10)
4862
4882
  _mj__UpdatedAt: Date;
4863
4883
 
4864
- @Field(() => [MJCollection_])
4865
- MJ_Collections_EnvironmentIDArray: MJCollection_[]; // Link to MJ_Collections
4866
-
4867
4884
  @Field(() => [MJProject_])
4868
4885
  MJ_Projects_EnvironmentIDArray: MJProject_[]; // Link to MJ_Projects
4869
4886
 
4887
+ @Field(() => [MJCollection_])
4888
+ MJ_Collections_EnvironmentIDArray: MJCollection_[]; // Link to MJ_Collections
4889
+
4870
4890
  @Field(() => [MJArtifact_])
4871
4891
  MJ_Artifacts_EnvironmentIDArray: MJArtifact_[]; // Link to MJ_Artifacts
4872
4892
 
4873
- @Field(() => [MJDashboard_])
4874
- Dashboards_EnvironmentIDArray: MJDashboard_[]; // Link to Dashboards
4875
-
4876
4893
  @Field(() => [MJTask_])
4877
4894
  MJ_Tasks_EnvironmentIDArray: MJTask_[]; // Link to MJ_Tasks
4878
4895
 
4896
+ @Field(() => [MJDashboard_])
4897
+ Dashboards_EnvironmentIDArray: MJDashboard_[]; // Link to Dashboards
4898
+
4879
4899
  @Field(() => [MJReport_])
4880
4900
  Reports_EnvironmentIDArray: MJReport_[]; // Link to Reports
4881
4901
 
@@ -4988,25 +5008,25 @@ export class MJEnvironmentResolver extends ResolverBase {
4988
5008
  return result;
4989
5009
  }
4990
5010
 
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);
5011
+ @FieldResolver(() => [MJProject_])
5012
+ async MJ_Projects_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5013
+ this.CheckUserReadPermissions('MJ: Projects', userPayload);
4994
5014
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4995
5015
  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');
5016
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwProjects] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Projects', userPayload, EntityPermissionType.Read, 'AND');
4997
5017
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4998
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
5018
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Projects', rows);
4999
5019
  return result;
5000
5020
  }
5001
5021
 
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);
5022
+ @FieldResolver(() => [MJCollection_])
5023
+ async MJ_Collections_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5024
+ this.CheckUserReadPermissions('MJ: Collections', userPayload);
5005
5025
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5006
5026
  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');
5027
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
5008
5028
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5009
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Projects', rows);
5029
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
5010
5030
  return result;
5011
5031
  }
5012
5032
 
@@ -5021,25 +5041,25 @@ export class MJEnvironmentResolver extends ResolverBase {
5021
5041
  return result;
5022
5042
  }
5023
5043
 
5024
- @FieldResolver(() => [MJDashboard_])
5025
- async Dashboards_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5026
- this.CheckUserReadPermissions('Dashboards', userPayload);
5044
+ @FieldResolver(() => [MJTask_])
5045
+ async MJ_Tasks_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5046
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
5027
5047
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5028
5048
  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');
5049
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
5030
5050
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5031
- const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', rows);
5051
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
5032
5052
  return result;
5033
5053
  }
5034
5054
 
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);
5055
+ @FieldResolver(() => [MJDashboard_])
5056
+ async Dashboards_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5057
+ this.CheckUserReadPermissions('Dashboards', userPayload);
5038
5058
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5039
5059
  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');
5060
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboards] WHERE [EnvironmentID]='${mjenvironment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Dashboards', userPayload, EntityPermissionType.Read, 'AND');
5041
5061
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5042
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
5062
+ const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', rows);
5043
5063
  return result;
5044
5064
  }
5045
5065
 
@@ -5129,6 +5149,24 @@ export class MJAIAgentAction_ {
5129
5149
  @Field(() => Int, {nullable: true, description: `Maximum number of times this action can be executed per agent run`})
5130
5150
  MaxExecutionsPerRun?: number;
5131
5151
 
5152
+ @Field(() => Int, {nullable: true, description: `Number of conversation turns before action results expire from conversation context. NULL = never expire (default). 0 = expire immediately after next turn.`})
5153
+ ResultExpirationTurns?: number;
5154
+
5155
+ @Field({description: `How to handle expired action results: None (no expiration, default), Remove (delete message entirely), Compact (reduce size via CompactMode while preserving key information).`})
5156
+ @MaxLength(40)
5157
+ ResultExpirationMode: string;
5158
+
5159
+ @Field({nullable: true, description: `How to compact results when ResultExpirationMode=Compact: FirstNChars (truncate to CompactLength characters, fast and free), AISummary (use LLM to intelligently summarize with CompactPromptID or Action.DefaultCompactPromptID).`})
5160
+ @MaxLength(40)
5161
+ CompactMode?: string;
5162
+
5163
+ @Field(() => Int, {nullable: true, description: `Number of characters to keep when CompactMode=FirstNChars. Required when CompactMode is FirstNChars, ignored otherwise.`})
5164
+ CompactLength?: number;
5165
+
5166
+ @Field({nullable: true, description: `Optional override for AI summarization prompt when CompactMode=AISummary. Lookup hierarchy: this field -> Action.DefaultCompactPromptID -> system default. Allows agent-specific summarization focus (e.g., technical vs. marketing perspective).`})
5167
+ @MaxLength(16)
5168
+ CompactPromptID?: string;
5169
+
5132
5170
  @Field({nullable: true})
5133
5171
  @MaxLength(510)
5134
5172
  Agent?: string;
@@ -5137,6 +5175,10 @@ export class MJAIAgentAction_ {
5137
5175
  @MaxLength(850)
5138
5176
  Action?: string;
5139
5177
 
5178
+ @Field({nullable: true})
5179
+ @MaxLength(510)
5180
+ CompactPrompt?: string;
5181
+
5140
5182
  }
5141
5183
 
5142
5184
  //****************************************************************************
@@ -5161,6 +5203,21 @@ export class CreateMJAIAgentActionInput {
5161
5203
 
5162
5204
  @Field(() => Int, { nullable: true })
5163
5205
  MaxExecutionsPerRun: number | null;
5206
+
5207
+ @Field(() => Int, { nullable: true })
5208
+ ResultExpirationTurns: number | null;
5209
+
5210
+ @Field({ nullable: true })
5211
+ ResultExpirationMode?: string;
5212
+
5213
+ @Field({ nullable: true })
5214
+ CompactMode: string | null;
5215
+
5216
+ @Field(() => Int, { nullable: true })
5217
+ CompactLength: number | null;
5218
+
5219
+ @Field({ nullable: true })
5220
+ CompactPromptID: string | null;
5164
5221
  }
5165
5222
 
5166
5223
 
@@ -5187,6 +5244,21 @@ export class UpdateMJAIAgentActionInput {
5187
5244
  @Field(() => Int, { nullable: true })
5188
5245
  MaxExecutionsPerRun?: number | null;
5189
5246
 
5247
+ @Field(() => Int, { nullable: true })
5248
+ ResultExpirationTurns?: number | null;
5249
+
5250
+ @Field({ nullable: true })
5251
+ ResultExpirationMode?: string;
5252
+
5253
+ @Field({ nullable: true })
5254
+ CompactMode?: string | null;
5255
+
5256
+ @Field(() => Int, { nullable: true })
5257
+ CompactLength?: number | null;
5258
+
5259
+ @Field({ nullable: true })
5260
+ CompactPromptID?: string | null;
5261
+
5190
5262
  @Field(() => [KeyValuePairInput], { nullable: true })
5191
5263
  OldValues___?: KeyValuePairInput[];
5192
5264
  }
@@ -5813,6 +5885,10 @@ export class MJCollection_ {
5813
5885
  @MaxLength(10)
5814
5886
  _mj__UpdatedAt: Date;
5815
5887
 
5888
+ @Field({nullable: true, description: `The user who owns this collection and has full permissions`})
5889
+ @MaxLength(16)
5890
+ OwnerID?: string;
5891
+
5816
5892
  @Field()
5817
5893
  @MaxLength(510)
5818
5894
  Environment: string;
@@ -5821,6 +5897,10 @@ export class MJCollection_ {
5821
5897
  @MaxLength(510)
5822
5898
  Parent?: string;
5823
5899
 
5900
+ @Field({nullable: true})
5901
+ @MaxLength(200)
5902
+ Owner?: string;
5903
+
5824
5904
  @Field({nullable: true})
5825
5905
  @MaxLength(16)
5826
5906
  RootParentID?: string;
@@ -5828,6 +5908,9 @@ export class MJCollection_ {
5828
5908
  @Field(() => [MJCollectionArtifact_])
5829
5909
  MJ_CollectionArtifacts_CollectionIDArray: MJCollectionArtifact_[]; // Link to MJ_CollectionArtifacts
5830
5910
 
5911
+ @Field(() => [MJCollectionPermission_])
5912
+ MJ_CollectionPermissions_CollectionIDArray: MJCollectionPermission_[]; // Link to MJ_CollectionPermissions
5913
+
5831
5914
  @Field(() => [MJCollection_])
5832
5915
  MJ_Collections_ParentIDArray: MJCollection_[]; // Link to MJ_Collections
5833
5916
 
@@ -5861,6 +5944,9 @@ export class CreateMJCollectionInput {
5861
5944
 
5862
5945
  @Field(() => Int, { nullable: true })
5863
5946
  Sequence: number | null;
5947
+
5948
+ @Field({ nullable: true })
5949
+ OwnerID: string | null;
5864
5950
  }
5865
5951
 
5866
5952
 
@@ -5893,6 +5979,9 @@ export class UpdateMJCollectionInput {
5893
5979
  @Field(() => Int, { nullable: true })
5894
5980
  Sequence?: number | null;
5895
5981
 
5982
+ @Field({ nullable: true })
5983
+ OwnerID?: string | null;
5984
+
5896
5985
  @Field(() => [KeyValuePairInput], { nullable: true })
5897
5986
  OldValues___?: KeyValuePairInput[];
5898
5987
  }
@@ -5966,6 +6055,17 @@ export class MJCollectionResolver extends ResolverBase {
5966
6055
  return result;
5967
6056
  }
5968
6057
 
6058
+ @FieldResolver(() => [MJCollectionPermission_])
6059
+ async MJ_CollectionPermissions_CollectionIDArray(@Root() mjcollection_: MJCollection_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6060
+ this.CheckUserReadPermissions('MJ: Collection Permissions', userPayload);
6061
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
6062
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
6063
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollectionPermissions] WHERE [CollectionID]='${mjcollection_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collection Permissions', userPayload, EntityPermissionType.Read, 'AND');
6064
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
6065
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collection Permissions', rows);
6066
+ return result;
6067
+ }
6068
+
5969
6069
  @FieldResolver(() => [MJCollection_])
5970
6070
  async MJ_Collections_ParentIDArray(@Root() mjcollection_: MJCollection_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5971
6071
  this.CheckUserReadPermissions('MJ: Collections', userPayload);
@@ -6426,18 +6526,21 @@ export class MJAIPrompt_ {
6426
6526
  @Field(() => [MJAIAgentType_])
6427
6527
  MJ_AIAgentTypes_SystemPromptIDArray: MJAIAgentType_[]; // Link to MJ_AIAgentTypes
6428
6528
 
6529
+ @Field(() => [MJAIAgentAction_])
6530
+ AIAgentActions_CompactPromptIDArray: MJAIAgentAction_[]; // Link to AIAgentActions
6531
+
6429
6532
  @Field(() => [MJAIConfiguration_])
6430
6533
  MJ_AIConfigurations_DefaultPromptForContextSummarizationIDArray: MJAIConfiguration_[]; // Link to MJ_AIConfigurations
6431
6534
 
6432
6535
  @Field(() => [MJAIPrompt_])
6433
6536
  AIPrompts_ResultSelectorPromptIDArray: MJAIPrompt_[]; // Link to AIPrompts
6434
6537
 
6435
- @Field(() => [MJAIAgentPrompt_])
6436
- MJ_AIAgentPrompts_PromptIDArray: MJAIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
6437
-
6438
6538
  @Field(() => [MJAIPromptModel_])
6439
6539
  MJ_AIPromptModels_PromptIDArray: MJAIPromptModel_[]; // Link to MJ_AIPromptModels
6440
6540
 
6541
+ @Field(() => [MJAIAgentPrompt_])
6542
+ MJ_AIAgentPrompts_PromptIDArray: MJAIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
6543
+
6441
6544
  @Field(() => [MJAIAgentStep_])
6442
6545
  MJ_AIAgentSteps_PromptIDArray: MJAIAgentStep_[]; // Link to MJ_AIAgentSteps
6443
6546
 
@@ -6447,6 +6550,9 @@ export class MJAIPrompt_ {
6447
6550
  @Field(() => [MJAIAgent_])
6448
6551
  AIAgents_ContextCompressionPromptIDArray: MJAIAgent_[]; // Link to AIAgents
6449
6552
 
6553
+ @Field(() => [MJAction_])
6554
+ Actions_DefaultCompactPromptIDArray: MJAction_[]; // Link to Actions
6555
+
6450
6556
  }
6451
6557
 
6452
6558
  //****************************************************************************
@@ -6850,6 +6956,17 @@ export class MJAIPromptResolver extends ResolverBase {
6850
6956
  return result;
6851
6957
  }
6852
6958
 
6959
+ @FieldResolver(() => [MJAIAgentAction_])
6960
+ async AIAgentActions_CompactPromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6961
+ this.CheckUserReadPermissions('AI Agent Actions', userPayload);
6962
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
6963
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
6964
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentActions] WHERE [CompactPromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Actions', userPayload, EntityPermissionType.Read, 'AND');
6965
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
6966
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Actions', rows);
6967
+ return result;
6968
+ }
6969
+
6853
6970
  @FieldResolver(() => [MJAIConfiguration_])
6854
6971
  async MJ_AIConfigurations_DefaultPromptForContextSummarizationIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6855
6972
  this.CheckUserReadPermissions('MJ: AI Configurations', userPayload);
@@ -6872,25 +6989,25 @@ export class MJAIPromptResolver extends ResolverBase {
6872
6989
  return result;
6873
6990
  }
6874
6991
 
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);
6992
+ @FieldResolver(() => [MJAIPromptModel_])
6993
+ async MJ_AIPromptModels_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6994
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
6878
6995
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
6879
6996
  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');
6997
+ 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
6998
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
6882
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', rows);
6999
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
6883
7000
  return result;
6884
7001
  }
6885
7002
 
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);
7003
+ @FieldResolver(() => [MJAIAgentPrompt_])
7004
+ async MJ_AIAgentPrompts_PromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
7005
+ this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
6889
7006
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
6890
7007
  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');
7008
+ 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
7009
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
6893
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', rows);
7010
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', rows);
6894
7011
  return result;
6895
7012
  }
6896
7013
 
@@ -6927,6 +7044,17 @@ export class MJAIPromptResolver extends ResolverBase {
6927
7044
  return result;
6928
7045
  }
6929
7046
 
7047
+ @FieldResolver(() => [MJAction_])
7048
+ async Actions_DefaultCompactPromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
7049
+ this.CheckUserReadPermissions('Actions', userPayload);
7050
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
7051
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
7052
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwActions] WHERE [DefaultCompactPromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Actions', userPayload, EntityPermissionType.Read, 'AND');
7053
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
7054
+ const result = this.ArrayMapFieldNamesToCodeNames('Actions', rows);
7055
+ return result;
7056
+ }
7057
+
6930
7058
  @Mutation(() => MJAIPrompt_)
6931
7059
  async CreateMJAIPrompt(
6932
7060
  @Arg('input', () => CreateMJAIPromptInput) input: CreateMJAIPromptInput,
@@ -10868,12 +10996,12 @@ export class MJEntity_ {
10868
10996
  @Field(() => [MJQueryEntity_])
10869
10997
  QueryEntities_EntityIDArray: MJQueryEntity_[]; // Link to QueryEntities
10870
10998
 
10871
- @Field(() => [MJAccessControlRule_])
10872
- MJ_AccessControlRules_EntityIDArray: MJAccessControlRule_[]; // Link to MJ_AccessControlRules
10873
-
10874
10999
  @Field(() => [MJRecordLink_])
10875
11000
  MJ_RecordLinks_SourceEntityIDArray: MJRecordLink_[]; // Link to MJ_RecordLinks
10876
11001
 
11002
+ @Field(() => [MJAccessControlRule_])
11003
+ MJ_AccessControlRules_EntityIDArray: MJAccessControlRule_[]; // Link to MJ_AccessControlRules
11004
+
10877
11005
  @Field(() => [MJGeneratedCode_])
10878
11006
  GeneratedCodes_LinkedEntityIDArray: MJGeneratedCode_[]; // Link to GeneratedCodes
10879
11007
 
@@ -11681,25 +11809,25 @@ export class MJEntityResolverBase extends ResolverBase {
11681
11809
  return result;
11682
11810
  }
11683
11811
 
11684
- @FieldResolver(() => [MJAccessControlRule_])
11685
- async MJ_AccessControlRules_EntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11686
- this.CheckUserReadPermissions('MJ: Access Control Rules', userPayload);
11812
+ @FieldResolver(() => [MJRecordLink_])
11813
+ async MJ_RecordLinks_SourceEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11814
+ this.CheckUserReadPermissions('MJ: Record Links', userPayload);
11687
11815
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11688
11816
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
11689
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAccessControlRules] WHERE [EntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Access Control Rules', userPayload, EntityPermissionType.Read, 'AND');
11817
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecordLinks] WHERE [SourceEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Record Links', userPayload, EntityPermissionType.Read, 'AND');
11690
11818
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
11691
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Access Control Rules', rows);
11819
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Record Links', rows);
11692
11820
  return result;
11693
11821
  }
11694
11822
 
11695
- @FieldResolver(() => [MJRecordLink_])
11696
- async MJ_RecordLinks_SourceEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11697
- this.CheckUserReadPermissions('MJ: Record Links', userPayload);
11823
+ @FieldResolver(() => [MJAccessControlRule_])
11824
+ async MJ_AccessControlRules_EntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11825
+ this.CheckUserReadPermissions('MJ: Access Control Rules', userPayload);
11698
11826
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11699
11827
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
11700
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecordLinks] WHERE [SourceEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Record Links', userPayload, EntityPermissionType.Read, 'AND');
11828
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAccessControlRules] WHERE [EntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Access Control Rules', userPayload, EntityPermissionType.Read, 'AND');
11701
11829
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
11702
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Record Links', rows);
11830
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Access Control Rules', rows);
11703
11831
  return result;
11704
11832
  }
11705
11833
 
@@ -11946,18 +12074,24 @@ export class MJUser_ {
11946
12074
  @Field(() => [MJReportUserState_])
11947
12075
  MJ_ReportUserStates_UserIDArray: MJReportUserState_[]; // Link to MJ_ReportUserStates
11948
12076
 
11949
- @Field(() => [MJDashboardUserState_])
11950
- MJ_DashboardUserStates_UserIDArray: MJDashboardUserState_[]; // Link to MJ_DashboardUserStates
11951
-
11952
12077
  @Field(() => [MJDashboardUserPreference_])
11953
12078
  MJ_DashboardUserPreferences_UserIDArray: MJDashboardUserPreference_[]; // Link to MJ_DashboardUserPreferences
11954
12079
 
12080
+ @Field(() => [MJDashboardUserState_])
12081
+ MJ_DashboardUserStates_UserIDArray: MJDashboardUserState_[]; // Link to MJ_DashboardUserStates
12082
+
11955
12083
  @Field(() => [MJArtifactVersion_])
11956
12084
  MJ_ArtifactVersions_UserIDArray: MJArtifactVersion_[]; // Link to MJ_ArtifactVersions
11957
12085
 
11958
12086
  @Field(() => [MJPublicLink_])
11959
12087
  MJ_PublicLinks_UserIDArray: MJPublicLink_[]; // Link to MJ_PublicLinks
11960
12088
 
12089
+ @Field(() => [MJScheduledJobRun_])
12090
+ MJ_ScheduledJobRuns_ExecutedByUserIDArray: MJScheduledJobRun_[]; // Link to MJ_ScheduledJobRuns
12091
+
12092
+ @Field(() => [MJScheduledJob_])
12093
+ MJ_ScheduledJobs_NotifyUserIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
12094
+
11961
12095
  @Field(() => [MJResourcePermission_])
11962
12096
  ResourcePermissions_UserIDArray: MJResourcePermission_[]; // Link to ResourcePermissions
11963
12097
 
@@ -11973,12 +12107,24 @@ export class MJUser_ {
11973
12107
  @Field(() => [MJArtifact_])
11974
12108
  MJ_Artifacts_UserIDArray: MJArtifact_[]; // Link to MJ_Artifacts
11975
12109
 
12110
+ @Field(() => [MJScheduledJob_])
12111
+ MJ_ScheduledJobs_OwnerUserIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
12112
+
12113
+ @Field(() => [MJCollectionPermission_])
12114
+ MJ_CollectionPermissions_SharedByUserIDArray: MJCollectionPermission_[]; // Link to MJ_CollectionPermissions
12115
+
11976
12116
  @Field(() => [MJAIAgentRun_])
11977
12117
  MJ_AIAgentRuns_UserIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
11978
12118
 
11979
12119
  @Field(() => [MJAIAgentPermission_])
11980
12120
  MJ_AIAgentPermissions_UserIDArray: MJAIAgentPermission_[]; // Link to MJ_AIAgentPermissions
11981
12121
 
12122
+ @Field(() => [MJCollectionPermission_])
12123
+ MJ_CollectionPermissions_UserIDArray: MJCollectionPermission_[]; // Link to MJ_CollectionPermissions
12124
+
12125
+ @Field(() => [MJCollection_])
12126
+ MJ_Collections_OwnerIDArray: MJCollection_[]; // Link to MJ_Collections
12127
+
11982
12128
  @Field(() => [MJTask_])
11983
12129
  MJ_Tasks_UserIDArray: MJTask_[]; // Link to MJ_Tasks
11984
12130
 
@@ -12540,25 +12686,25 @@ export class MJUserResolverBase extends ResolverBase {
12540
12686
  return result;
12541
12687
  }
12542
12688
 
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);
12689
+ @FieldResolver(() => [MJDashboardUserPreference_])
12690
+ async MJ_DashboardUserPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12691
+ this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
12546
12692
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12547
12693
  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');
12694
+ 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
12695
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12550
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', rows);
12696
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', rows);
12551
12697
  return result;
12552
12698
  }
12553
12699
 
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);
12700
+ @FieldResolver(() => [MJDashboardUserState_])
12701
+ async MJ_DashboardUserStates_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12702
+ this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
12557
12703
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12558
12704
  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');
12705
+ 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
12706
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12561
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', rows);
12707
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', rows);
12562
12708
  return result;
12563
12709
  }
12564
12710
 
@@ -12584,6 +12730,28 @@ export class MJUserResolverBase extends ResolverBase {
12584
12730
  return result;
12585
12731
  }
12586
12732
 
12733
+ @FieldResolver(() => [MJScheduledJobRun_])
12734
+ async MJ_ScheduledJobRuns_ExecutedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12735
+ this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
12736
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12737
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12738
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ExecutedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
12739
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12740
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows);
12741
+ return result;
12742
+ }
12743
+
12744
+ @FieldResolver(() => [MJScheduledJob_])
12745
+ async MJ_ScheduledJobs_NotifyUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12746
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
12747
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12748
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12749
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [NotifyUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
12750
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12751
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows);
12752
+ return result;
12753
+ }
12754
+
12587
12755
  @FieldResolver(() => [MJResourcePermission_])
12588
12756
  async ResourcePermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12589
12757
  this.CheckUserReadPermissions('Resource Permissions', userPayload);
@@ -12639,6 +12807,28 @@ export class MJUserResolverBase extends ResolverBase {
12639
12807
  return result;
12640
12808
  }
12641
12809
 
12810
+ @FieldResolver(() => [MJScheduledJob_])
12811
+ async MJ_ScheduledJobs_OwnerUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12812
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
12813
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12814
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12815
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [OwnerUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
12816
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12817
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows);
12818
+ return result;
12819
+ }
12820
+
12821
+ @FieldResolver(() => [MJCollectionPermission_])
12822
+ async MJ_CollectionPermissions_SharedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12823
+ this.CheckUserReadPermissions('MJ: Collection Permissions', userPayload);
12824
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12825
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12826
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollectionPermissions] WHERE [SharedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collection Permissions', userPayload, EntityPermissionType.Read, 'AND');
12827
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12828
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collection Permissions', rows);
12829
+ return result;
12830
+ }
12831
+
12642
12832
  @FieldResolver(() => [MJAIAgentRun_])
12643
12833
  async MJ_AIAgentRuns_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12644
12834
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
@@ -12661,6 +12851,28 @@ export class MJUserResolverBase extends ResolverBase {
12661
12851
  return result;
12662
12852
  }
12663
12853
 
12854
+ @FieldResolver(() => [MJCollectionPermission_])
12855
+ async MJ_CollectionPermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12856
+ this.CheckUserReadPermissions('MJ: Collection Permissions', userPayload);
12857
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12858
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12859
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollectionPermissions] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collection Permissions', userPayload, EntityPermissionType.Read, 'AND');
12860
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12861
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collection Permissions', rows);
12862
+ return result;
12863
+ }
12864
+
12865
+ @FieldResolver(() => [MJCollection_])
12866
+ async MJ_Collections_OwnerIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12867
+ this.CheckUserReadPermissions('MJ: Collections', userPayload);
12868
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12869
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12870
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [OwnerID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
12871
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12872
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
12873
+ return result;
12874
+ }
12875
+
12664
12876
  @FieldResolver(() => [MJTask_])
12665
12877
  async MJ_Tasks_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12666
12878
  this.CheckUserReadPermissions('MJ: Tasks', userPayload);
@@ -23449,6 +23661,9 @@ export class MJConversationDetail_ {
23449
23661
  @MaxLength(40)
23450
23662
  Status: string;
23451
23663
 
23664
+ @Field({nullable: true, description: `JSON array of suggested responses that can be displayed to the user for quick replies. Each response object contains: text (display text), allowInput (boolean), iconClass (optional Font Awesome class), and data (optional payload).`})
23665
+ SuggestedResponses?: string;
23666
+
23452
23667
  @Field({nullable: true})
23453
23668
  @MaxLength(510)
23454
23669
  Conversation?: string;
@@ -23547,6 +23762,9 @@ export class CreateMJConversationDetailInput {
23547
23762
 
23548
23763
  @Field({ nullable: true })
23549
23764
  Status?: string;
23765
+
23766
+ @Field({ nullable: true })
23767
+ SuggestedResponses: string | null;
23550
23768
  }
23551
23769
 
23552
23770
 
@@ -23612,6 +23830,9 @@ export class UpdateMJConversationDetailInput {
23612
23830
  @Field({ nullable: true })
23613
23831
  Status?: string;
23614
23832
 
23833
+ @Field({ nullable: true })
23834
+ SuggestedResponses?: string | null;
23835
+
23615
23836
  @Field(() => [KeyValuePairInput], { nullable: true })
23616
23837
  OldValues___?: KeyValuePairInput[];
23617
23838
  }
@@ -31606,6 +31827,10 @@ export class MJAction_ {
31606
31827
  @MaxLength(200)
31607
31828
  IconClass?: string;
31608
31829
 
31830
+ @Field({nullable: true, description: `Default prompt for compacting/summarizing this action's results when used by agents with CompactMode=AISummary. Action designers define how their specific results should be summarized. Can be overridden per agent in AIAgentAction.CompactPromptID.`})
31831
+ @MaxLength(16)
31832
+ DefaultCompactPromptID?: string;
31833
+
31609
31834
  @Field({nullable: true})
31610
31835
  @MaxLength(510)
31611
31836
  Category?: string;
@@ -31618,6 +31843,10 @@ export class MJAction_ {
31618
31843
  @MaxLength(850)
31619
31844
  Parent?: string;
31620
31845
 
31846
+ @Field({nullable: true})
31847
+ @MaxLength(510)
31848
+ DefaultCompactPrompt?: string;
31849
+
31621
31850
  @Field({nullable: true})
31622
31851
  @MaxLength(16)
31623
31852
  RootParentID?: string;
@@ -31721,6 +31950,9 @@ export class CreateMJActionInput {
31721
31950
 
31722
31951
  @Field({ nullable: true })
31723
31952
  IconClass: string | null;
31953
+
31954
+ @Field({ nullable: true })
31955
+ DefaultCompactPromptID: string | null;
31724
31956
  }
31725
31957
 
31726
31958
 
@@ -31789,6 +32021,9 @@ export class UpdateMJActionInput {
31789
32021
  @Field({ nullable: true })
31790
32022
  IconClass?: string | null;
31791
32023
 
32024
+ @Field({ nullable: true })
32025
+ DefaultCompactPromptID?: string | null;
32026
+
31792
32027
  @Field(() => [KeyValuePairInput], { nullable: true })
31793
32028
  OldValues___?: KeyValuePairInput[];
31794
32029
  }
@@ -39552,6 +39787,243 @@ export class MJQueryEntityResolver extends ResolverBase {
39552
39787
 
39553
39788
  }
39554
39789
 
39790
+ //****************************************************************************
39791
+ // ENTITY CLASS for MJ: Scheduled Job Runs
39792
+ //****************************************************************************
39793
+ @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.` })
39794
+ export class MJScheduledJobRun_ {
39795
+ @Field()
39796
+ @MaxLength(16)
39797
+ ID: string;
39798
+
39799
+ @Field()
39800
+ @MaxLength(16)
39801
+ ScheduledJobID: string;
39802
+
39803
+ @Field({description: `Timestamp when this job execution began. Set immediately before calling the job plugin's Execute method.`})
39804
+ @MaxLength(10)
39805
+ StartedAt: Date;
39806
+
39807
+ @Field({nullable: true, description: `Timestamp when this job execution completed (successfully or with failure). NULL while the job is still running.`})
39808
+ @MaxLength(10)
39809
+ CompletedAt?: Date;
39810
+
39811
+ @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.`})
39812
+ @MaxLength(40)
39813
+ Status: string;
39814
+
39815
+ @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.`})
39816
+ Success?: boolean;
39817
+
39818
+ @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.`})
39819
+ ErrorMessage?: string;
39820
+
39821
+ @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.`})
39822
+ Details?: string;
39823
+
39824
+ @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.`})
39825
+ @MaxLength(16)
39826
+ ExecutedByUserID?: string;
39827
+
39828
+ @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.`})
39829
+ @MaxLength(10)
39830
+ QueuedAt?: Date;
39831
+
39832
+ @Field()
39833
+ @MaxLength(10)
39834
+ _mj__CreatedAt: Date;
39835
+
39836
+ @Field()
39837
+ @MaxLength(10)
39838
+ _mj__UpdatedAt: Date;
39839
+
39840
+ @Field()
39841
+ @MaxLength(400)
39842
+ ScheduledJob: string;
39843
+
39844
+ @Field({nullable: true})
39845
+ @MaxLength(200)
39846
+ ExecutedByUser?: string;
39847
+
39848
+ @Field(() => [MJAIAgentRun_])
39849
+ MJ_AIAgentRuns_ScheduledJobRunIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
39850
+
39851
+ }
39852
+
39853
+ //****************************************************************************
39854
+ // INPUT TYPE for MJ: Scheduled Job Runs
39855
+ //****************************************************************************
39856
+ @InputType()
39857
+ export class CreateMJScheduledJobRunInput {
39858
+ @Field({ nullable: true })
39859
+ ID?: string;
39860
+
39861
+ @Field({ nullable: true })
39862
+ ScheduledJobID?: string;
39863
+
39864
+ @Field({ nullable: true })
39865
+ StartedAt?: Date;
39866
+
39867
+ @Field({ nullable: true })
39868
+ CompletedAt: Date | null;
39869
+
39870
+ @Field({ nullable: true })
39871
+ Status?: string;
39872
+
39873
+ @Field(() => Boolean, { nullable: true })
39874
+ Success: boolean | null;
39875
+
39876
+ @Field({ nullable: true })
39877
+ ErrorMessage: string | null;
39878
+
39879
+ @Field({ nullable: true })
39880
+ Details: string | null;
39881
+
39882
+ @Field({ nullable: true })
39883
+ ExecutedByUserID: string | null;
39884
+
39885
+ @Field({ nullable: true })
39886
+ QueuedAt: Date | null;
39887
+ }
39888
+
39889
+
39890
+ //****************************************************************************
39891
+ // INPUT TYPE for MJ: Scheduled Job Runs
39892
+ //****************************************************************************
39893
+ @InputType()
39894
+ export class UpdateMJScheduledJobRunInput {
39895
+ @Field()
39896
+ ID: string;
39897
+
39898
+ @Field({ nullable: true })
39899
+ ScheduledJobID?: string;
39900
+
39901
+ @Field({ nullable: true })
39902
+ StartedAt?: Date;
39903
+
39904
+ @Field({ nullable: true })
39905
+ CompletedAt?: Date | null;
39906
+
39907
+ @Field({ nullable: true })
39908
+ Status?: string;
39909
+
39910
+ @Field(() => Boolean, { nullable: true })
39911
+ Success?: boolean | null;
39912
+
39913
+ @Field({ nullable: true })
39914
+ ErrorMessage?: string | null;
39915
+
39916
+ @Field({ nullable: true })
39917
+ Details?: string | null;
39918
+
39919
+ @Field({ nullable: true })
39920
+ ExecutedByUserID?: string | null;
39921
+
39922
+ @Field({ nullable: true })
39923
+ QueuedAt?: Date | null;
39924
+
39925
+ @Field(() => [KeyValuePairInput], { nullable: true })
39926
+ OldValues___?: KeyValuePairInput[];
39927
+ }
39928
+
39929
+ //****************************************************************************
39930
+ // RESOLVER for MJ: Scheduled Job Runs
39931
+ //****************************************************************************
39932
+ @ObjectType()
39933
+ export class RunMJScheduledJobRunViewResult {
39934
+ @Field(() => [MJScheduledJobRun_])
39935
+ Results: MJScheduledJobRun_[];
39936
+
39937
+ @Field(() => String, {nullable: true})
39938
+ UserViewRunID?: string;
39939
+
39940
+ @Field(() => Int, {nullable: true})
39941
+ RowCount: number;
39942
+
39943
+ @Field(() => Int, {nullable: true})
39944
+ TotalRowCount: number;
39945
+
39946
+ @Field(() => Int, {nullable: true})
39947
+ ExecutionTime: number;
39948
+
39949
+ @Field({nullable: true})
39950
+ ErrorMessage?: string;
39951
+
39952
+ @Field(() => Boolean, {nullable: false})
39953
+ Success: boolean;
39954
+ }
39955
+
39956
+ @Resolver(MJScheduledJobRun_)
39957
+ export class MJScheduledJobRunResolver extends ResolverBase {
39958
+ @Query(() => RunMJScheduledJobRunViewResult)
39959
+ async RunMJScheduledJobRunViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39960
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39961
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
39962
+ }
39963
+
39964
+ @Query(() => RunMJScheduledJobRunViewResult)
39965
+ async RunMJScheduledJobRunViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39966
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39967
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
39968
+ }
39969
+
39970
+ @Query(() => RunMJScheduledJobRunViewResult)
39971
+ async RunMJScheduledJobRunDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39972
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39973
+ input.EntityName = 'MJ: Scheduled Job Runs';
39974
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
39975
+ }
39976
+ @Query(() => MJScheduledJobRun_, { nullable: true })
39977
+ async MJScheduledJobRun(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJScheduledJobRun_ | null> {
39978
+ this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
39979
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39980
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
39981
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
39982
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
39983
+ const result = this.MapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows && rows.length > 0 ? rows[0] : {})
39984
+ return result;
39985
+ }
39986
+
39987
+ @FieldResolver(() => [MJAIAgentRun_])
39988
+ async MJ_AIAgentRuns_ScheduledJobRunIDArray(@Root() mjscheduledjobrun_: MJScheduledJobRun_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
39989
+ this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
39990
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39991
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
39992
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRuns] WHERE [ScheduledJobRunID]='${mjscheduledjobrun_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
39993
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
39994
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows);
39995
+ return result;
39996
+ }
39997
+
39998
+ @Mutation(() => MJScheduledJobRun_)
39999
+ async CreateMJScheduledJobRun(
40000
+ @Arg('input', () => CreateMJScheduledJobRunInput) input: CreateMJScheduledJobRunInput,
40001
+ @Ctx() { providers, userPayload }: AppContext,
40002
+ @PubSub() pubSub: PubSubEngine
40003
+ ) {
40004
+ const provider = GetReadWriteProvider(providers);
40005
+ return this.CreateRecord('MJ: Scheduled Job Runs', input, provider, userPayload, pubSub)
40006
+ }
40007
+
40008
+ @Mutation(() => MJScheduledJobRun_)
40009
+ async UpdateMJScheduledJobRun(
40010
+ @Arg('input', () => UpdateMJScheduledJobRunInput) input: UpdateMJScheduledJobRunInput,
40011
+ @Ctx() { providers, userPayload }: AppContext,
40012
+ @PubSub() pubSub: PubSubEngine
40013
+ ) {
40014
+ const provider = GetReadWriteProvider(providers);
40015
+ return this.UpdateRecord('MJ: Scheduled Job Runs', input, provider, userPayload, pubSub);
40016
+ }
40017
+
40018
+ @Mutation(() => MJScheduledJobRun_)
40019
+ async DeleteMJScheduledJobRun(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
40020
+ const provider = GetReadWriteProvider(providers);
40021
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
40022
+ return this.DeleteRecord('MJ: Scheduled Job Runs', key, options, provider, userPayload, pubSub);
40023
+ }
40024
+
40025
+ }
40026
+
39555
40027
  //****************************************************************************
39556
40028
  // ENTITY CLASS for MJ: Dashboard User States
39557
40029
  //****************************************************************************
@@ -41506,6 +41978,212 @@ export class MJConversationArtifactResolver extends ResolverBase {
41506
41978
 
41507
41979
  }
41508
41980
 
41981
+ //****************************************************************************
41982
+ // ENTITY CLASS for MJ: Collection Permissions
41983
+ //****************************************************************************
41984
+ @ObjectType({ description: `Manages sharing permissions for collections, allowing granular access control` })
41985
+ export class MJCollectionPermission_ {
41986
+ @Field()
41987
+ @MaxLength(16)
41988
+ ID: string;
41989
+
41990
+ @Field()
41991
+ @MaxLength(16)
41992
+ CollectionID: string;
41993
+
41994
+ @Field()
41995
+ @MaxLength(16)
41996
+ UserID: string;
41997
+
41998
+ @Field(() => Boolean, {description: `Always 1 - users must have read permission to access a shared collection`})
41999
+ CanRead: boolean;
42000
+
42001
+ @Field(() => Boolean, {description: `Can share this collection with others (but cannot grant more permissions than they have)`})
42002
+ CanShare: boolean;
42003
+
42004
+ @Field(() => Boolean, {description: `Can add/remove artifacts to/from this collection`})
42005
+ CanEdit: boolean;
42006
+
42007
+ @Field(() => Boolean, {description: `Can delete the collection, child collections, and artifacts`})
42008
+ CanDelete: boolean;
42009
+
42010
+ @Field({nullable: true, description: `The user who shared this collection (NULL if shared by owner)`})
42011
+ @MaxLength(16)
42012
+ SharedByUserID?: string;
42013
+
42014
+ @Field()
42015
+ @MaxLength(10)
42016
+ _mj__CreatedAt: Date;
42017
+
42018
+ @Field()
42019
+ @MaxLength(10)
42020
+ _mj__UpdatedAt: Date;
42021
+
42022
+ @Field()
42023
+ @MaxLength(510)
42024
+ Collection: string;
42025
+
42026
+ @Field()
42027
+ @MaxLength(200)
42028
+ User: string;
42029
+
42030
+ @Field({nullable: true})
42031
+ @MaxLength(200)
42032
+ SharedByUser?: string;
42033
+
42034
+ }
42035
+
42036
+ //****************************************************************************
42037
+ // INPUT TYPE for MJ: Collection Permissions
42038
+ //****************************************************************************
42039
+ @InputType()
42040
+ export class CreateMJCollectionPermissionInput {
42041
+ @Field({ nullable: true })
42042
+ ID?: string;
42043
+
42044
+ @Field({ nullable: true })
42045
+ CollectionID?: string;
42046
+
42047
+ @Field({ nullable: true })
42048
+ UserID?: string;
42049
+
42050
+ @Field(() => Boolean, { nullable: true })
42051
+ CanRead?: boolean;
42052
+
42053
+ @Field(() => Boolean, { nullable: true })
42054
+ CanShare?: boolean;
42055
+
42056
+ @Field(() => Boolean, { nullable: true })
42057
+ CanEdit?: boolean;
42058
+
42059
+ @Field(() => Boolean, { nullable: true })
42060
+ CanDelete?: boolean;
42061
+
42062
+ @Field({ nullable: true })
42063
+ SharedByUserID: string | null;
42064
+ }
42065
+
42066
+
42067
+ //****************************************************************************
42068
+ // INPUT TYPE for MJ: Collection Permissions
42069
+ //****************************************************************************
42070
+ @InputType()
42071
+ export class UpdateMJCollectionPermissionInput {
42072
+ @Field()
42073
+ ID: string;
42074
+
42075
+ @Field({ nullable: true })
42076
+ CollectionID?: string;
42077
+
42078
+ @Field({ nullable: true })
42079
+ UserID?: string;
42080
+
42081
+ @Field(() => Boolean, { nullable: true })
42082
+ CanRead?: boolean;
42083
+
42084
+ @Field(() => Boolean, { nullable: true })
42085
+ CanShare?: boolean;
42086
+
42087
+ @Field(() => Boolean, { nullable: true })
42088
+ CanEdit?: boolean;
42089
+
42090
+ @Field(() => Boolean, { nullable: true })
42091
+ CanDelete?: boolean;
42092
+
42093
+ @Field({ nullable: true })
42094
+ SharedByUserID?: string | null;
42095
+
42096
+ @Field(() => [KeyValuePairInput], { nullable: true })
42097
+ OldValues___?: KeyValuePairInput[];
42098
+ }
42099
+
42100
+ //****************************************************************************
42101
+ // RESOLVER for MJ: Collection Permissions
42102
+ //****************************************************************************
42103
+ @ObjectType()
42104
+ export class RunMJCollectionPermissionViewResult {
42105
+ @Field(() => [MJCollectionPermission_])
42106
+ Results: MJCollectionPermission_[];
42107
+
42108
+ @Field(() => String, {nullable: true})
42109
+ UserViewRunID?: string;
42110
+
42111
+ @Field(() => Int, {nullable: true})
42112
+ RowCount: number;
42113
+
42114
+ @Field(() => Int, {nullable: true})
42115
+ TotalRowCount: number;
42116
+
42117
+ @Field(() => Int, {nullable: true})
42118
+ ExecutionTime: number;
42119
+
42120
+ @Field({nullable: true})
42121
+ ErrorMessage?: string;
42122
+
42123
+ @Field(() => Boolean, {nullable: false})
42124
+ Success: boolean;
42125
+ }
42126
+
42127
+ @Resolver(MJCollectionPermission_)
42128
+ export class MJCollectionPermissionResolver extends ResolverBase {
42129
+ @Query(() => RunMJCollectionPermissionViewResult)
42130
+ async RunMJCollectionPermissionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42131
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42132
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
42133
+ }
42134
+
42135
+ @Query(() => RunMJCollectionPermissionViewResult)
42136
+ async RunMJCollectionPermissionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42137
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42138
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
42139
+ }
42140
+
42141
+ @Query(() => RunMJCollectionPermissionViewResult)
42142
+ async RunMJCollectionPermissionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42143
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42144
+ input.EntityName = 'MJ: Collection Permissions';
42145
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
42146
+ }
42147
+ @Query(() => MJCollectionPermission_, { nullable: true })
42148
+ async MJCollectionPermission(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJCollectionPermission_ | null> {
42149
+ this.CheckUserReadPermissions('MJ: Collection Permissions', userPayload);
42150
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42151
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
42152
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollectionPermissions] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collection Permissions', userPayload, EntityPermissionType.Read, 'AND');
42153
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
42154
+ const result = this.MapFieldNamesToCodeNames('MJ: Collection Permissions', rows && rows.length > 0 ? rows[0] : {})
42155
+ return result;
42156
+ }
42157
+
42158
+ @Mutation(() => MJCollectionPermission_)
42159
+ async CreateMJCollectionPermission(
42160
+ @Arg('input', () => CreateMJCollectionPermissionInput) input: CreateMJCollectionPermissionInput,
42161
+ @Ctx() { providers, userPayload }: AppContext,
42162
+ @PubSub() pubSub: PubSubEngine
42163
+ ) {
42164
+ const provider = GetReadWriteProvider(providers);
42165
+ return this.CreateRecord('MJ: Collection Permissions', input, provider, userPayload, pubSub)
42166
+ }
42167
+
42168
+ @Mutation(() => MJCollectionPermission_)
42169
+ async UpdateMJCollectionPermission(
42170
+ @Arg('input', () => UpdateMJCollectionPermissionInput) input: UpdateMJCollectionPermissionInput,
42171
+ @Ctx() { providers, userPayload }: AppContext,
42172
+ @PubSub() pubSub: PubSubEngine
42173
+ ) {
42174
+ const provider = GetReadWriteProvider(providers);
42175
+ return this.UpdateRecord('MJ: Collection Permissions', input, provider, userPayload, pubSub);
42176
+ }
42177
+
42178
+ @Mutation(() => MJCollectionPermission_)
42179
+ async DeleteMJCollectionPermission(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42180
+ const provider = GetReadWriteProvider(providers);
42181
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
42182
+ return this.DeleteRecord('MJ: Collection Permissions', key, options, provider, userPayload, pubSub);
42183
+ }
42184
+
42185
+ }
42186
+
41509
42187
  //****************************************************************************
41510
42188
  // ENTITY CLASS for MJ: AI Agent Prompts
41511
42189
  //****************************************************************************
@@ -41982,6 +42660,206 @@ export class MJComponentLibraryResolver extends ResolverBase {
41982
42660
 
41983
42661
  }
41984
42662
 
42663
+ //****************************************************************************
42664
+ // ENTITY CLASS for MJ: Scheduled Job Types
42665
+ //****************************************************************************
42666
+ @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).` })
42667
+ export class MJScheduledJobType_ {
42668
+ @Field()
42669
+ @MaxLength(16)
42670
+ ID: string;
42671
+
42672
+ @Field({description: `Unique name identifying this job type (e.g., Agent, Action, Report).`})
42673
+ @MaxLength(200)
42674
+ Name: string;
42675
+
42676
+ @Field({nullable: true, description: `Human-readable description of what this job type does and when it should be used.`})
42677
+ Description?: string;
42678
+
42679
+ @Field({description: `TypeScript class name that implements BaseScheduledJob for this job type. Used by ClassFactory to instantiate the correct plugin at runtime.`})
42680
+ @MaxLength(510)
42681
+ DriverClass: string;
42682
+
42683
+ @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.`})
42684
+ @MaxLength(510)
42685
+ DomainRunEntity?: string;
42686
+
42687
+ @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.`})
42688
+ @MaxLength(200)
42689
+ DomainRunEntityFKey?: string;
42690
+
42691
+ @Field(() => Boolean, {description: `Indicates whether this job type supports sending notifications on completion or failure.`})
42692
+ NotificationsAvailable: boolean;
42693
+
42694
+ @Field()
42695
+ @MaxLength(10)
42696
+ _mj__CreatedAt: Date;
42697
+
42698
+ @Field()
42699
+ @MaxLength(10)
42700
+ _mj__UpdatedAt: Date;
42701
+
42702
+ @Field(() => [MJScheduledJob_])
42703
+ MJ_ScheduledJobs_JobTypeIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
42704
+
42705
+ }
42706
+
42707
+ //****************************************************************************
42708
+ // INPUT TYPE for MJ: Scheduled Job Types
42709
+ //****************************************************************************
42710
+ @InputType()
42711
+ export class CreateMJScheduledJobTypeInput {
42712
+ @Field({ nullable: true })
42713
+ ID?: string;
42714
+
42715
+ @Field({ nullable: true })
42716
+ Name?: string;
42717
+
42718
+ @Field({ nullable: true })
42719
+ Description: string | null;
42720
+
42721
+ @Field({ nullable: true })
42722
+ DriverClass?: string;
42723
+
42724
+ @Field({ nullable: true })
42725
+ DomainRunEntity: string | null;
42726
+
42727
+ @Field({ nullable: true })
42728
+ DomainRunEntityFKey: string | null;
42729
+
42730
+ @Field(() => Boolean, { nullable: true })
42731
+ NotificationsAvailable?: boolean;
42732
+ }
42733
+
42734
+
42735
+ //****************************************************************************
42736
+ // INPUT TYPE for MJ: Scheduled Job Types
42737
+ //****************************************************************************
42738
+ @InputType()
42739
+ export class UpdateMJScheduledJobTypeInput {
42740
+ @Field()
42741
+ ID: string;
42742
+
42743
+ @Field({ nullable: true })
42744
+ Name?: string;
42745
+
42746
+ @Field({ nullable: true })
42747
+ Description?: string | null;
42748
+
42749
+ @Field({ nullable: true })
42750
+ DriverClass?: string;
42751
+
42752
+ @Field({ nullable: true })
42753
+ DomainRunEntity?: string | null;
42754
+
42755
+ @Field({ nullable: true })
42756
+ DomainRunEntityFKey?: string | null;
42757
+
42758
+ @Field(() => Boolean, { nullable: true })
42759
+ NotificationsAvailable?: boolean;
42760
+
42761
+ @Field(() => [KeyValuePairInput], { nullable: true })
42762
+ OldValues___?: KeyValuePairInput[];
42763
+ }
42764
+
42765
+ //****************************************************************************
42766
+ // RESOLVER for MJ: Scheduled Job Types
42767
+ //****************************************************************************
42768
+ @ObjectType()
42769
+ export class RunMJScheduledJobTypeViewResult {
42770
+ @Field(() => [MJScheduledJobType_])
42771
+ Results: MJScheduledJobType_[];
42772
+
42773
+ @Field(() => String, {nullable: true})
42774
+ UserViewRunID?: string;
42775
+
42776
+ @Field(() => Int, {nullable: true})
42777
+ RowCount: number;
42778
+
42779
+ @Field(() => Int, {nullable: true})
42780
+ TotalRowCount: number;
42781
+
42782
+ @Field(() => Int, {nullable: true})
42783
+ ExecutionTime: number;
42784
+
42785
+ @Field({nullable: true})
42786
+ ErrorMessage?: string;
42787
+
42788
+ @Field(() => Boolean, {nullable: false})
42789
+ Success: boolean;
42790
+ }
42791
+
42792
+ @Resolver(MJScheduledJobType_)
42793
+ export class MJScheduledJobTypeResolver extends ResolverBase {
42794
+ @Query(() => RunMJScheduledJobTypeViewResult)
42795
+ async RunMJScheduledJobTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42796
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42797
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
42798
+ }
42799
+
42800
+ @Query(() => RunMJScheduledJobTypeViewResult)
42801
+ async RunMJScheduledJobTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42802
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42803
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
42804
+ }
42805
+
42806
+ @Query(() => RunMJScheduledJobTypeViewResult)
42807
+ async RunMJScheduledJobTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42808
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42809
+ input.EntityName = 'MJ: Scheduled Job Types';
42810
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
42811
+ }
42812
+ @Query(() => MJScheduledJobType_, { nullable: true })
42813
+ async MJScheduledJobType(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJScheduledJobType_ | null> {
42814
+ this.CheckUserReadPermissions('MJ: Scheduled Job Types', userPayload);
42815
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42816
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
42817
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobTypes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Types', userPayload, EntityPermissionType.Read, 'AND');
42818
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
42819
+ const result = this.MapFieldNamesToCodeNames('MJ: Scheduled Job Types', rows && rows.length > 0 ? rows[0] : {})
42820
+ return result;
42821
+ }
42822
+
42823
+ @FieldResolver(() => [MJScheduledJob_])
42824
+ async MJ_ScheduledJobs_JobTypeIDArray(@Root() mjscheduledjobtype_: MJScheduledJobType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
42825
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
42826
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42827
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
42828
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [JobTypeID]='${mjscheduledjobtype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
42829
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
42830
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows);
42831
+ return result;
42832
+ }
42833
+
42834
+ @Mutation(() => MJScheduledJobType_)
42835
+ async CreateMJScheduledJobType(
42836
+ @Arg('input', () => CreateMJScheduledJobTypeInput) input: CreateMJScheduledJobTypeInput,
42837
+ @Ctx() { providers, userPayload }: AppContext,
42838
+ @PubSub() pubSub: PubSubEngine
42839
+ ) {
42840
+ const provider = GetReadWriteProvider(providers);
42841
+ return this.CreateRecord('MJ: Scheduled Job Types', input, provider, userPayload, pubSub)
42842
+ }
42843
+
42844
+ @Mutation(() => MJScheduledJobType_)
42845
+ async UpdateMJScheduledJobType(
42846
+ @Arg('input', () => UpdateMJScheduledJobTypeInput) input: UpdateMJScheduledJobTypeInput,
42847
+ @Ctx() { providers, userPayload }: AppContext,
42848
+ @PubSub() pubSub: PubSubEngine
42849
+ ) {
42850
+ const provider = GetReadWriteProvider(providers);
42851
+ return this.UpdateRecord('MJ: Scheduled Job Types', input, provider, userPayload, pubSub);
42852
+ }
42853
+
42854
+ @Mutation(() => MJScheduledJobType_)
42855
+ async DeleteMJScheduledJobType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42856
+ const provider = GetReadWriteProvider(providers);
42857
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
42858
+ return this.DeleteRecord('MJ: Scheduled Job Types', key, options, provider, userPayload, pubSub);
42859
+ }
42860
+
42861
+ }
42862
+
41985
42863
  //****************************************************************************
41986
42864
  // ENTITY CLASS for MJ: Dashboard User Preferences
41987
42865
  //****************************************************************************
@@ -42641,6 +43519,15 @@ export class MJAIAgentRelationship_ {
42641
43519
  @MaxLength(10)
42642
43520
  _mj__UpdatedAt: Date;
42643
43521
 
43522
+ @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.`})
43523
+ SubAgentOutputMapping?: string;
43524
+
43525
+ @Field({nullable: true, description: `JSON mapping of parent payload paths to sub-agent initial payload paths. Enables structural data transfer from parent to related sub-agent. Format: {"parentPath": "subAgentPath", "parent.nested": "subAgent.field"}. Example: {"searchQuery": "query", "maxResults": "limit"}. If null, sub-agent starts with empty payload (default behavior).`})
43526
+ SubAgentInputMapping?: string;
43527
+
43528
+ @Field({nullable: true, description: `JSON array of parent payload paths to send as LLM context to related sub-agent. Sub-agent receives this data in a formatted context message before its task message. Format: ["path1", "path2.nested", "path3.*", "*"]. Use "*" to send entire parent payload. Example: ["userPreferences", "priorFindings.summary", "sources[*]"]. If null, no parent context is sent (default behavior).`})
43529
+ SubAgentContextPaths?: string;
43530
+
42644
43531
  @Field({nullable: true})
42645
43532
  @MaxLength(510)
42646
43533
  Agent?: string;
@@ -42667,6 +43554,15 @@ export class CreateMJAIAgentRelationshipInput {
42667
43554
 
42668
43555
  @Field({ nullable: true })
42669
43556
  Status?: string;
43557
+
43558
+ @Field({ nullable: true })
43559
+ SubAgentOutputMapping: string | null;
43560
+
43561
+ @Field({ nullable: true })
43562
+ SubAgentInputMapping: string | null;
43563
+
43564
+ @Field({ nullable: true })
43565
+ SubAgentContextPaths: string | null;
42670
43566
  }
42671
43567
 
42672
43568
 
@@ -42687,6 +43583,15 @@ export class UpdateMJAIAgentRelationshipInput {
42687
43583
  @Field({ nullable: true })
42688
43584
  Status?: string;
42689
43585
 
43586
+ @Field({ nullable: true })
43587
+ SubAgentOutputMapping?: string | null;
43588
+
43589
+ @Field({ nullable: true })
43590
+ SubAgentInputMapping?: string | null;
43591
+
43592
+ @Field({ nullable: true })
43593
+ SubAgentContextPaths?: string | null;
43594
+
42690
43595
  @Field(() => [KeyValuePairInput], { nullable: true })
42691
43596
  OldValues___?: KeyValuePairInput[];
42692
43597
  }
@@ -45237,6 +46142,401 @@ export class MJGeneratedCodeResolver extends ResolverBase {
45237
46142
 
45238
46143
  }
45239
46144
 
46145
+ //****************************************************************************
46146
+ // ENTITY CLASS for MJ: Scheduled Jobs
46147
+ //****************************************************************************
46148
+ @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.` })
46149
+ export class MJScheduledJob_ {
46150
+ @Field()
46151
+ @MaxLength(16)
46152
+ ID: string;
46153
+
46154
+ @Field()
46155
+ @MaxLength(16)
46156
+ JobTypeID: string;
46157
+
46158
+ @Field({description: `Human-readable name for this scheduled job. Should clearly identify what the job does.`})
46159
+ @MaxLength(400)
46160
+ Name: string;
46161
+
46162
+ @Field({nullable: true, description: `Detailed description of the job's purpose, what it does, and any important notes about its execution.`})
46163
+ Description?: string;
46164
+
46165
+ @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.`})
46166
+ @MaxLength(240)
46167
+ CronExpression: string;
46168
+
46169
+ @Field({description: `IANA timezone identifier for interpreting the cron expression (e.g., "America/Chicago", "UTC"). Ensures consistent scheduling across different server locations.`})
46170
+ @MaxLength(128)
46171
+ Timezone: string;
46172
+
46173
+ @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.`})
46174
+ @MaxLength(10)
46175
+ StartAt?: Date;
46176
+
46177
+ @Field({nullable: true, description: `Optional end date/time for when this schedule expires. Job will not execute after this time. NULL means no expiration.`})
46178
+ @MaxLength(10)
46179
+ EndAt?: Date;
46180
+
46181
+ @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.`})
46182
+ @MaxLength(40)
46183
+ Status: string;
46184
+
46185
+ @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.`})
46186
+ Configuration?: string;
46187
+
46188
+ @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.`})
46189
+ @MaxLength(16)
46190
+ OwnerUserID?: string;
46191
+
46192
+ @Field({nullable: true, description: `Timestamp of the most recent execution. Updated after each run. Used for monitoring and dashboard displays.`})
46193
+ @MaxLength(10)
46194
+ LastRunAt?: Date;
46195
+
46196
+ @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.`})
46197
+ @MaxLength(10)
46198
+ NextRunAt?: Date;
46199
+
46200
+ @Field(() => Int, {description: `Total number of times this schedule has been executed, including both successful and failed runs.`})
46201
+ RunCount: number;
46202
+
46203
+ @Field(() => Int, {description: `Number of times this schedule has executed successfully (Success = true in ScheduledJobRun).`})
46204
+ SuccessCount: number;
46205
+
46206
+ @Field(() => Int, {description: `Number of times this schedule has executed but failed (Success = false in ScheduledJobRun).`})
46207
+ FailureCount: number;
46208
+
46209
+ @Field(() => Boolean, {description: `Whether to send notifications when the job completes successfully.`})
46210
+ NotifyOnSuccess: boolean;
46211
+
46212
+ @Field(() => Boolean, {description: `Whether to send notifications when the job fails. Defaults to true for alerting on failures.`})
46213
+ NotifyOnFailure: boolean;
46214
+
46215
+ @Field({nullable: true, description: `User to notify about job execution results. If NULL and notifications are enabled, falls back to OwnerUserID.`})
46216
+ @MaxLength(16)
46217
+ NotifyUserID?: string;
46218
+
46219
+ @Field(() => Boolean, {description: `Whether to send email notifications. Requires NotifyOnSuccess or NotifyOnFailure to also be enabled.`})
46220
+ NotifyViaEmail: boolean;
46221
+
46222
+ @Field(() => Boolean, {description: `Whether to send in-app notifications. Requires NotifyOnSuccess or NotifyOnFailure to also be enabled. Defaults to true.`})
46223
+ NotifyViaInApp: boolean;
46224
+
46225
+ @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.`})
46226
+ @MaxLength(16)
46227
+ LockToken?: string;
46228
+
46229
+ @Field({nullable: true, description: `Timestamp when the lock was acquired. Used with ExpectedCompletionAt to detect stale locks from crashed server instances.`})
46230
+ @MaxLength(10)
46231
+ LockedAt?: Date;
46232
+
46233
+ @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.`})
46234
+ @MaxLength(510)
46235
+ LockedByInstance?: string;
46236
+
46237
+ @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.`})
46238
+ @MaxLength(10)
46239
+ ExpectedCompletionAt?: Date;
46240
+
46241
+ @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.`})
46242
+ @MaxLength(40)
46243
+ ConcurrencyMode: string;
46244
+
46245
+ @Field()
46246
+ @MaxLength(10)
46247
+ _mj__CreatedAt: Date;
46248
+
46249
+ @Field()
46250
+ @MaxLength(10)
46251
+ _mj__UpdatedAt: Date;
46252
+
46253
+ @Field()
46254
+ @MaxLength(200)
46255
+ JobType: string;
46256
+
46257
+ @Field({nullable: true})
46258
+ @MaxLength(200)
46259
+ OwnerUser?: string;
46260
+
46261
+ @Field({nullable: true})
46262
+ @MaxLength(200)
46263
+ NotifyUser?: string;
46264
+
46265
+ @Field(() => [MJScheduledJobRun_])
46266
+ MJ_ScheduledJobRuns_ScheduledJobIDArray: MJScheduledJobRun_[]; // Link to MJ_ScheduledJobRuns
46267
+
46268
+ }
46269
+
46270
+ //****************************************************************************
46271
+ // INPUT TYPE for MJ: Scheduled Jobs
46272
+ //****************************************************************************
46273
+ @InputType()
46274
+ export class CreateMJScheduledJobInput {
46275
+ @Field({ nullable: true })
46276
+ ID?: string;
46277
+
46278
+ @Field({ nullable: true })
46279
+ JobTypeID?: string;
46280
+
46281
+ @Field({ nullable: true })
46282
+ Name?: string;
46283
+
46284
+ @Field({ nullable: true })
46285
+ Description: string | null;
46286
+
46287
+ @Field({ nullable: true })
46288
+ CronExpression?: string;
46289
+
46290
+ @Field({ nullable: true })
46291
+ Timezone?: string;
46292
+
46293
+ @Field({ nullable: true })
46294
+ StartAt: Date | null;
46295
+
46296
+ @Field({ nullable: true })
46297
+ EndAt: Date | null;
46298
+
46299
+ @Field({ nullable: true })
46300
+ Status?: string;
46301
+
46302
+ @Field({ nullable: true })
46303
+ Configuration: string | null;
46304
+
46305
+ @Field({ nullable: true })
46306
+ OwnerUserID: string | null;
46307
+
46308
+ @Field({ nullable: true })
46309
+ LastRunAt: Date | null;
46310
+
46311
+ @Field({ nullable: true })
46312
+ NextRunAt: Date | null;
46313
+
46314
+ @Field(() => Int, { nullable: true })
46315
+ RunCount?: number;
46316
+
46317
+ @Field(() => Int, { nullable: true })
46318
+ SuccessCount?: number;
46319
+
46320
+ @Field(() => Int, { nullable: true })
46321
+ FailureCount?: number;
46322
+
46323
+ @Field(() => Boolean, { nullable: true })
46324
+ NotifyOnSuccess?: boolean;
46325
+
46326
+ @Field(() => Boolean, { nullable: true })
46327
+ NotifyOnFailure?: boolean;
46328
+
46329
+ @Field({ nullable: true })
46330
+ NotifyUserID: string | null;
46331
+
46332
+ @Field(() => Boolean, { nullable: true })
46333
+ NotifyViaEmail?: boolean;
46334
+
46335
+ @Field(() => Boolean, { nullable: true })
46336
+ NotifyViaInApp?: boolean;
46337
+
46338
+ @Field({ nullable: true })
46339
+ LockToken: string | null;
46340
+
46341
+ @Field({ nullable: true })
46342
+ LockedAt: Date | null;
46343
+
46344
+ @Field({ nullable: true })
46345
+ LockedByInstance: string | null;
46346
+
46347
+ @Field({ nullable: true })
46348
+ ExpectedCompletionAt: Date | null;
46349
+
46350
+ @Field({ nullable: true })
46351
+ ConcurrencyMode?: string;
46352
+ }
46353
+
46354
+
46355
+ //****************************************************************************
46356
+ // INPUT TYPE for MJ: Scheduled Jobs
46357
+ //****************************************************************************
46358
+ @InputType()
46359
+ export class UpdateMJScheduledJobInput {
46360
+ @Field()
46361
+ ID: string;
46362
+
46363
+ @Field({ nullable: true })
46364
+ JobTypeID?: string;
46365
+
46366
+ @Field({ nullable: true })
46367
+ Name?: string;
46368
+
46369
+ @Field({ nullable: true })
46370
+ Description?: string | null;
46371
+
46372
+ @Field({ nullable: true })
46373
+ CronExpression?: string;
46374
+
46375
+ @Field({ nullable: true })
46376
+ Timezone?: string;
46377
+
46378
+ @Field({ nullable: true })
46379
+ StartAt?: Date | null;
46380
+
46381
+ @Field({ nullable: true })
46382
+ EndAt?: Date | null;
46383
+
46384
+ @Field({ nullable: true })
46385
+ Status?: string;
46386
+
46387
+ @Field({ nullable: true })
46388
+ Configuration?: string | null;
46389
+
46390
+ @Field({ nullable: true })
46391
+ OwnerUserID?: string | null;
46392
+
46393
+ @Field({ nullable: true })
46394
+ LastRunAt?: Date | null;
46395
+
46396
+ @Field({ nullable: true })
46397
+ NextRunAt?: Date | null;
46398
+
46399
+ @Field(() => Int, { nullable: true })
46400
+ RunCount?: number;
46401
+
46402
+ @Field(() => Int, { nullable: true })
46403
+ SuccessCount?: number;
46404
+
46405
+ @Field(() => Int, { nullable: true })
46406
+ FailureCount?: number;
46407
+
46408
+ @Field(() => Boolean, { nullable: true })
46409
+ NotifyOnSuccess?: boolean;
46410
+
46411
+ @Field(() => Boolean, { nullable: true })
46412
+ NotifyOnFailure?: boolean;
46413
+
46414
+ @Field({ nullable: true })
46415
+ NotifyUserID?: string | null;
46416
+
46417
+ @Field(() => Boolean, { nullable: true })
46418
+ NotifyViaEmail?: boolean;
46419
+
46420
+ @Field(() => Boolean, { nullable: true })
46421
+ NotifyViaInApp?: boolean;
46422
+
46423
+ @Field({ nullable: true })
46424
+ LockToken?: string | null;
46425
+
46426
+ @Field({ nullable: true })
46427
+ LockedAt?: Date | null;
46428
+
46429
+ @Field({ nullable: true })
46430
+ LockedByInstance?: string | null;
46431
+
46432
+ @Field({ nullable: true })
46433
+ ExpectedCompletionAt?: Date | null;
46434
+
46435
+ @Field({ nullable: true })
46436
+ ConcurrencyMode?: string;
46437
+
46438
+ @Field(() => [KeyValuePairInput], { nullable: true })
46439
+ OldValues___?: KeyValuePairInput[];
46440
+ }
46441
+
46442
+ //****************************************************************************
46443
+ // RESOLVER for MJ: Scheduled Jobs
46444
+ //****************************************************************************
46445
+ @ObjectType()
46446
+ export class RunMJScheduledJobViewResult {
46447
+ @Field(() => [MJScheduledJob_])
46448
+ Results: MJScheduledJob_[];
46449
+
46450
+ @Field(() => String, {nullable: true})
46451
+ UserViewRunID?: string;
46452
+
46453
+ @Field(() => Int, {nullable: true})
46454
+ RowCount: number;
46455
+
46456
+ @Field(() => Int, {nullable: true})
46457
+ TotalRowCount: number;
46458
+
46459
+ @Field(() => Int, {nullable: true})
46460
+ ExecutionTime: number;
46461
+
46462
+ @Field({nullable: true})
46463
+ ErrorMessage?: string;
46464
+
46465
+ @Field(() => Boolean, {nullable: false})
46466
+ Success: boolean;
46467
+ }
46468
+
46469
+ @Resolver(MJScheduledJob_)
46470
+ export class MJScheduledJobResolver extends ResolverBase {
46471
+ @Query(() => RunMJScheduledJobViewResult)
46472
+ async RunMJScheduledJobViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46473
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46474
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
46475
+ }
46476
+
46477
+ @Query(() => RunMJScheduledJobViewResult)
46478
+ async RunMJScheduledJobViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46479
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46480
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
46481
+ }
46482
+
46483
+ @Query(() => RunMJScheduledJobViewResult)
46484
+ async RunMJScheduledJobDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46485
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46486
+ input.EntityName = 'MJ: Scheduled Jobs';
46487
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
46488
+ }
46489
+ @Query(() => MJScheduledJob_, { nullable: true })
46490
+ async MJScheduledJob(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJScheduledJob_ | null> {
46491
+ this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
46492
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46493
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46494
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobs] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Jobs', userPayload, EntityPermissionType.Read, 'AND');
46495
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46496
+ const result = this.MapFieldNamesToCodeNames('MJ: Scheduled Jobs', rows && rows.length > 0 ? rows[0] : {})
46497
+ return result;
46498
+ }
46499
+
46500
+ @FieldResolver(() => [MJScheduledJobRun_])
46501
+ async MJ_ScheduledJobRuns_ScheduledJobIDArray(@Root() mjscheduledjob_: MJScheduledJob_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
46502
+ this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
46503
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46504
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46505
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ScheduledJobID]='${mjscheduledjob_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
46506
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46507
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows);
46508
+ return result;
46509
+ }
46510
+
46511
+ @Mutation(() => MJScheduledJob_)
46512
+ async CreateMJScheduledJob(
46513
+ @Arg('input', () => CreateMJScheduledJobInput) input: CreateMJScheduledJobInput,
46514
+ @Ctx() { providers, userPayload }: AppContext,
46515
+ @PubSub() pubSub: PubSubEngine
46516
+ ) {
46517
+ const provider = GetReadWriteProvider(providers);
46518
+ return this.CreateRecord('MJ: Scheduled Jobs', input, provider, userPayload, pubSub)
46519
+ }
46520
+
46521
+ @Mutation(() => MJScheduledJob_)
46522
+ async UpdateMJScheduledJob(
46523
+ @Arg('input', () => UpdateMJScheduledJobInput) input: UpdateMJScheduledJobInput,
46524
+ @Ctx() { providers, userPayload }: AppContext,
46525
+ @PubSub() pubSub: PubSubEngine
46526
+ ) {
46527
+ const provider = GetReadWriteProvider(providers);
46528
+ return this.UpdateRecord('MJ: Scheduled Jobs', input, provider, userPayload, pubSub);
46529
+ }
46530
+
46531
+ @Mutation(() => MJScheduledJob_)
46532
+ async DeleteMJScheduledJob(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46533
+ const provider = GetReadWriteProvider(providers);
46534
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
46535
+ return this.DeleteRecord('MJ: Scheduled Jobs', key, options, provider, userPayload, pubSub);
46536
+ }
46537
+
46538
+ }
46539
+
45240
46540
  //****************************************************************************
45241
46541
  // ENTITY CLASS for MJ: AI Prompt Runs
45242
46542
  //****************************************************************************