@memberjunction/server 2.100.3 → 2.102.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ import { mj_core_schema } from '../config.js';
19
19
 
20
20
 
21
21
 
22
- import { ScheduledActionEntity, ScheduledActionParamEntity, ExplorerNavigationItemEntity, GeneratedCodeCategoryEntity, AIAgentModelEntity, ComponentRegistryEntity, AIAgentNoteTypeEntity, ComponentDependencyEntity, AIAgentRunEntity, AIVendorEntity, AIConfigurationEntity, AIAgentEntity, AIAgentStepEntity, AIModelCostEntity, AIPromptModelEntity, AIAgentTypeEntity, AIAgentNoteEntity, AIAgentActionEntity, AIModelPriceTypeEntity, 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, ConversationArtifactVersionEntity, AIAgentRequestEntity, AIModelVendorEntity, AIVendorTypeDefinitionEntity, ReportUserStateEntity, QueryEntityEntity, DashboardUserStateEntity, ComponentEntity, ArtifactTypeEntity, AIVendorTypeEntity, ConversationArtifactEntity, AIAgentPromptEntity, ComponentLibraryEntity, DashboardUserPreferenceEntity, QueryParameterEntity, AIAgentRelationshipEntity, ComponentLibraryLinkEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, AIPromptRunEntity, AIAgentRunStepEntity, ConversationArtifactPermissionEntity, AIModelPriceUnitTypeEntity, AIAgentStepPathEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity } 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, 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, ConversationArtifactVersionEntity, AIAgentRequestEntity, AIModelVendorEntity, AIVendorTypeDefinitionEntity, ReportUserStateEntity, QueryEntityEntity, DashboardUserStateEntity, ComponentEntity, AccessControlRuleEntity, PublicLinkEntity, ArtifactTypeEntity, AIVendorTypeEntity, ArtifactEntity, ConversationArtifactEntity, AIAgentPromptEntity, ComponentLibraryEntity, DashboardUserPreferenceEntity, QueryParameterEntity, AIAgentRelationshipEntity, ComponentLibraryLinkEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, AIPromptRunEntity, AIAgentRunStepEntity, TaskEntity, ProjectEntity, ConversationArtifactPermissionEntity, AIModelPriceUnitTypeEntity, ArtifactVersionEntity, AIAgentStepPathEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity } from '@memberjunction/core-entities';
23
23
 
24
24
 
25
25
  //****************************************************************************
@@ -2355,6 +2355,167 @@ export class AIVendorResolver extends ResolverBase {
2355
2355
 
2356
2356
  }
2357
2357
 
2358
+ //****************************************************************************
2359
+ // ENTITY CLASS for MJ: Task Types
2360
+ //****************************************************************************
2361
+ @ObjectType({ description: `Categorization system for different types of tasks that can be created and managed within the system` })
2362
+ export class TaskType_ {
2363
+ @Field()
2364
+ @MaxLength(16)
2365
+ ID: string;
2366
+
2367
+ @Field({description: `Display name for the task type`})
2368
+ @MaxLength(510)
2369
+ Name: string;
2370
+
2371
+ @Field({nullable: true, description: `Detailed description of what this task type represents and when it should be used`})
2372
+ Description?: string;
2373
+
2374
+ @Field()
2375
+ @MaxLength(10)
2376
+ _mj__CreatedAt: Date;
2377
+
2378
+ @Field()
2379
+ @MaxLength(10)
2380
+ _mj__UpdatedAt: Date;
2381
+
2382
+ @Field(() => [Task_])
2383
+ MJ_Tasks_TypeIDArray: Task_[]; // Link to MJ_Tasks
2384
+
2385
+ }
2386
+
2387
+ //****************************************************************************
2388
+ // INPUT TYPE for MJ: Task Types
2389
+ //****************************************************************************
2390
+ @InputType()
2391
+ export class CreateTaskTypeInput {
2392
+ @Field({ nullable: true })
2393
+ ID?: string;
2394
+
2395
+ @Field({ nullable: true })
2396
+ Name?: string;
2397
+
2398
+ @Field({ nullable: true })
2399
+ Description: string | null;
2400
+ }
2401
+
2402
+
2403
+ //****************************************************************************
2404
+ // INPUT TYPE for MJ: Task Types
2405
+ //****************************************************************************
2406
+ @InputType()
2407
+ export class UpdateTaskTypeInput {
2408
+ @Field()
2409
+ ID: string;
2410
+
2411
+ @Field({ nullable: true })
2412
+ Name?: string;
2413
+
2414
+ @Field({ nullable: true })
2415
+ Description?: string | null;
2416
+
2417
+ @Field(() => [KeyValuePairInput], { nullable: true })
2418
+ OldValues___?: KeyValuePairInput[];
2419
+ }
2420
+
2421
+ //****************************************************************************
2422
+ // RESOLVER for MJ: Task Types
2423
+ //****************************************************************************
2424
+ @ObjectType()
2425
+ export class RunTaskTypeViewResult {
2426
+ @Field(() => [TaskType_])
2427
+ Results: TaskType_[];
2428
+
2429
+ @Field(() => String, {nullable: true})
2430
+ UserViewRunID?: string;
2431
+
2432
+ @Field(() => Int, {nullable: true})
2433
+ RowCount: number;
2434
+
2435
+ @Field(() => Int, {nullable: true})
2436
+ TotalRowCount: number;
2437
+
2438
+ @Field(() => Int, {nullable: true})
2439
+ ExecutionTime: number;
2440
+
2441
+ @Field({nullable: true})
2442
+ ErrorMessage?: string;
2443
+
2444
+ @Field(() => Boolean, {nullable: false})
2445
+ Success: boolean;
2446
+ }
2447
+
2448
+ @Resolver(TaskType_)
2449
+ export class TaskTypeResolver extends ResolverBase {
2450
+ @Query(() => RunTaskTypeViewResult)
2451
+ async RunTaskTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
2452
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2453
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
2454
+ }
2455
+
2456
+ @Query(() => RunTaskTypeViewResult)
2457
+ async RunTaskTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
2458
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2459
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
2460
+ }
2461
+
2462
+ @Query(() => RunTaskTypeViewResult)
2463
+ async RunTaskTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
2464
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2465
+ input.EntityName = 'MJ: Task Types';
2466
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
2467
+ }
2468
+ @Query(() => TaskType_, { nullable: true })
2469
+ async TaskType(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<TaskType_ | null> {
2470
+ this.CheckUserReadPermissions('MJ: Task Types', userPayload);
2471
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2472
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2473
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTaskTypes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Task Types', userPayload, EntityPermissionType.Read, 'AND');
2474
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2475
+ const result = this.MapFieldNamesToCodeNames('MJ: Task Types', rows && rows.length > 0 ? rows[0] : {})
2476
+ return result;
2477
+ }
2478
+
2479
+ @FieldResolver(() => [Task_])
2480
+ async MJ_Tasks_TypeIDArray(@Root() tasktype_: TaskType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
2481
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
2482
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
2483
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2484
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [TypeID]='${tasktype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
2485
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
2486
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
2487
+ return result;
2488
+ }
2489
+
2490
+ @Mutation(() => TaskType_)
2491
+ async CreateTaskType(
2492
+ @Arg('input', () => CreateTaskTypeInput) input: CreateTaskTypeInput,
2493
+ @Ctx() { providers, userPayload }: AppContext,
2494
+ @PubSub() pubSub: PubSubEngine
2495
+ ) {
2496
+ const provider = GetReadWriteProvider(providers);
2497
+ return this.CreateRecord('MJ: Task Types', input, provider, userPayload, pubSub)
2498
+ }
2499
+
2500
+ @Mutation(() => TaskType_)
2501
+ async UpdateTaskType(
2502
+ @Arg('input', () => UpdateTaskTypeInput) input: UpdateTaskTypeInput,
2503
+ @Ctx() { providers, userPayload }: AppContext,
2504
+ @PubSub() pubSub: PubSubEngine
2505
+ ) {
2506
+ const provider = GetReadWriteProvider(providers);
2507
+ return this.UpdateRecord('MJ: Task Types', input, provider, userPayload, pubSub);
2508
+ }
2509
+
2510
+ @Mutation(() => TaskType_)
2511
+ async DeleteTaskType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
2512
+ const provider = GetReadWriteProvider(providers);
2513
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
2514
+ return this.DeleteRecord('MJ: Task Types', key, options, provider, userPayload, pubSub);
2515
+ }
2516
+
2517
+ }
2518
+
2358
2519
  //****************************************************************************
2359
2520
  // ENTITY CLASS for MJ: AI Configurations
2360
2521
  //****************************************************************************
@@ -2784,12 +2945,12 @@ if this limit is exceeded.`})
2784
2945
  @MaxLength(200)
2785
2946
  Type?: string;
2786
2947
 
2787
- @Field(() => [AIAgentModel_])
2788
- AIAgentModels_AgentIDArray: AIAgentModel_[]; // Link to AIAgentModels
2789
-
2790
2948
  @Field(() => [AIAgentAction_])
2791
2949
  AIAgentActions_AgentIDArray: AIAgentAction_[]; // Link to AIAgentActions
2792
2950
 
2951
+ @Field(() => [AIAgentModel_])
2952
+ AIAgentModels_AgentIDArray: AIAgentModel_[]; // Link to AIAgentModels
2953
+
2793
2954
  @Field(() => [AIAgentLearningCycle_])
2794
2955
  AIAgentLearningCycles_AgentIDArray: AIAgentLearningCycle_[]; // Link to AIAgentLearningCycles
2795
2956
 
@@ -2817,6 +2978,9 @@ if this limit is exceeded.`})
2817
2978
  @Field(() => [AIAgentRelationship_])
2818
2979
  MJ_AIAgentRelationships_SubAgentIDArray: AIAgentRelationship_[]; // Link to MJ_AIAgentRelationships
2819
2980
 
2981
+ @Field(() => [Task_])
2982
+ MJ_Tasks_AgentIDArray: Task_[]; // Link to MJ_Tasks
2983
+
2820
2984
  @Field(() => [AIResultCache_])
2821
2985
  AIResultCache_AgentIDArray: AIResultCache_[]; // Link to AIResultCache
2822
2986
 
@@ -3112,25 +3276,25 @@ export class AIAgentResolver extends ResolverBase {
3112
3276
  return result;
3113
3277
  }
3114
3278
 
3115
- @FieldResolver(() => [AIAgentModel_])
3116
- async AIAgentModels_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3117
- this.CheckUserReadPermissions('AI Agent Models', userPayload);
3279
+ @FieldResolver(() => [AIAgentAction_])
3280
+ async AIAgentActions_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3281
+ this.CheckUserReadPermissions('AI Agent Actions', userPayload);
3118
3282
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3119
3283
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3120
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentModels] WHERE [AgentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Models', userPayload, EntityPermissionType.Read, 'AND');
3284
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentActions] WHERE [AgentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Actions', userPayload, EntityPermissionType.Read, 'AND');
3121
3285
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3122
- const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Models', rows);
3286
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Actions', rows);
3123
3287
  return result;
3124
3288
  }
3125
3289
 
3126
- @FieldResolver(() => [AIAgentAction_])
3127
- async AIAgentActions_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3128
- this.CheckUserReadPermissions('AI Agent Actions', userPayload);
3290
+ @FieldResolver(() => [AIAgentModel_])
3291
+ async AIAgentModels_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3292
+ this.CheckUserReadPermissions('AI Agent Models', userPayload);
3129
3293
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3130
3294
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3131
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentActions] WHERE [AgentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Actions', userPayload, EntityPermissionType.Read, 'AND');
3295
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentModels] WHERE [AgentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Models', userPayload, EntityPermissionType.Read, 'AND');
3132
3296
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3133
- const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Actions', rows);
3297
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Models', rows);
3134
3298
  return result;
3135
3299
  }
3136
3300
 
@@ -3233,6 +3397,17 @@ export class AIAgentResolver extends ResolverBase {
3233
3397
  return result;
3234
3398
  }
3235
3399
 
3400
+ @FieldResolver(() => [Task_])
3401
+ async MJ_Tasks_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3402
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
3403
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3404
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3405
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [AgentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
3406
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3407
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
3408
+ return result;
3409
+ }
3410
+
3236
3411
  @FieldResolver(() => [AIResultCache_])
3237
3412
  async AIResultCache_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3238
3413
  this.CheckUserReadPermissions('AI Result Cache', userPayload);
@@ -4570,6 +4745,269 @@ export class AIAgentNoteResolver extends ResolverBase {
4570
4745
 
4571
4746
  }
4572
4747
 
4748
+ //****************************************************************************
4749
+ // ENTITY CLASS for MJ: Environments
4750
+ //****************************************************************************
4751
+ @ObjectType({ description: `Top-level container for organizing conversations, artifacts, and collections. Provides isolation and grouping for different teams, clients, or functional areas.` })
4752
+ export class Environment_ {
4753
+ @Field()
4754
+ @MaxLength(16)
4755
+ ID: string;
4756
+
4757
+ @Field({description: `Display name for the environment`})
4758
+ @MaxLength(510)
4759
+ Name: string;
4760
+
4761
+ @Field({nullable: true, description: `Detailed description of the environment purpose and scope`})
4762
+ Description?: string;
4763
+
4764
+ @Field(() => Boolean, {description: `Indicates if this is the default environment for the organization`})
4765
+ IsDefault: boolean;
4766
+
4767
+ @Field({nullable: true, description: `JSON configuration for environment-specific settings and features`})
4768
+ Settings?: string;
4769
+
4770
+ @Field()
4771
+ @MaxLength(10)
4772
+ _mj__CreatedAt: Date;
4773
+
4774
+ @Field()
4775
+ @MaxLength(10)
4776
+ _mj__UpdatedAt: Date;
4777
+
4778
+ @Field(() => [Collection_])
4779
+ MJ_Collections_EnvironmentIDArray: Collection_[]; // Link to MJ_Collections
4780
+
4781
+ @Field(() => [Project_])
4782
+ MJ_Projects_EnvironmentIDArray: Project_[]; // Link to MJ_Projects
4783
+
4784
+ @Field(() => [Artifact_])
4785
+ MJ_Artifacts_EnvironmentIDArray: Artifact_[]; // Link to MJ_Artifacts
4786
+
4787
+ @Field(() => [Dashboard_])
4788
+ Dashboards_EnvironmentIDArray: Dashboard_[]; // Link to Dashboards
4789
+
4790
+ @Field(() => [Task_])
4791
+ MJ_Tasks_EnvironmentIDArray: Task_[]; // Link to MJ_Tasks
4792
+
4793
+ @Field(() => [Report_])
4794
+ Reports_EnvironmentIDArray: Report_[]; // Link to Reports
4795
+
4796
+ @Field(() => [Conversation_])
4797
+ Conversations_EnvironmentIDArray: Conversation_[]; // Link to Conversations
4798
+
4799
+ }
4800
+
4801
+ //****************************************************************************
4802
+ // INPUT TYPE for MJ: Environments
4803
+ //****************************************************************************
4804
+ @InputType()
4805
+ export class CreateEnvironmentInput {
4806
+ @Field({ nullable: true })
4807
+ ID?: string;
4808
+
4809
+ @Field({ nullable: true })
4810
+ Name?: string;
4811
+
4812
+ @Field({ nullable: true })
4813
+ Description: string | null;
4814
+
4815
+ @Field(() => Boolean, { nullable: true })
4816
+ IsDefault?: boolean;
4817
+
4818
+ @Field({ nullable: true })
4819
+ Settings: string | null;
4820
+ }
4821
+
4822
+
4823
+ //****************************************************************************
4824
+ // INPUT TYPE for MJ: Environments
4825
+ //****************************************************************************
4826
+ @InputType()
4827
+ export class UpdateEnvironmentInput {
4828
+ @Field()
4829
+ ID: string;
4830
+
4831
+ @Field({ nullable: true })
4832
+ Name?: string;
4833
+
4834
+ @Field({ nullable: true })
4835
+ Description?: string | null;
4836
+
4837
+ @Field(() => Boolean, { nullable: true })
4838
+ IsDefault?: boolean;
4839
+
4840
+ @Field({ nullable: true })
4841
+ Settings?: string | null;
4842
+
4843
+ @Field(() => [KeyValuePairInput], { nullable: true })
4844
+ OldValues___?: KeyValuePairInput[];
4845
+ }
4846
+
4847
+ //****************************************************************************
4848
+ // RESOLVER for MJ: Environments
4849
+ //****************************************************************************
4850
+ @ObjectType()
4851
+ export class RunEnvironmentViewResult {
4852
+ @Field(() => [Environment_])
4853
+ Results: Environment_[];
4854
+
4855
+ @Field(() => String, {nullable: true})
4856
+ UserViewRunID?: string;
4857
+
4858
+ @Field(() => Int, {nullable: true})
4859
+ RowCount: number;
4860
+
4861
+ @Field(() => Int, {nullable: true})
4862
+ TotalRowCount: number;
4863
+
4864
+ @Field(() => Int, {nullable: true})
4865
+ ExecutionTime: number;
4866
+
4867
+ @Field({nullable: true})
4868
+ ErrorMessage?: string;
4869
+
4870
+ @Field(() => Boolean, {nullable: false})
4871
+ Success: boolean;
4872
+ }
4873
+
4874
+ @Resolver(Environment_)
4875
+ export class EnvironmentResolver extends ResolverBase {
4876
+ @Query(() => RunEnvironmentViewResult)
4877
+ async RunEnvironmentViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
4878
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4879
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
4880
+ }
4881
+
4882
+ @Query(() => RunEnvironmentViewResult)
4883
+ async RunEnvironmentViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
4884
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4885
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
4886
+ }
4887
+
4888
+ @Query(() => RunEnvironmentViewResult)
4889
+ async RunEnvironmentDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
4890
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4891
+ input.EntityName = 'MJ: Environments';
4892
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
4893
+ }
4894
+ @Query(() => Environment_, { nullable: true })
4895
+ async Environment(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Environment_ | null> {
4896
+ this.CheckUserReadPermissions('MJ: Environments', userPayload);
4897
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4898
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4899
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEnvironments] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Environments', userPayload, EntityPermissionType.Read, 'AND');
4900
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4901
+ const result = this.MapFieldNamesToCodeNames('MJ: Environments', rows && rows.length > 0 ? rows[0] : {})
4902
+ return result;
4903
+ }
4904
+
4905
+ @FieldResolver(() => [Collection_])
4906
+ async MJ_Collections_EnvironmentIDArray(@Root() environment_: Environment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
4907
+ this.CheckUserReadPermissions('MJ: Collections', userPayload);
4908
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4909
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4910
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [EnvironmentID]='${environment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
4911
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4912
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
4913
+ return result;
4914
+ }
4915
+
4916
+ @FieldResolver(() => [Project_])
4917
+ async MJ_Projects_EnvironmentIDArray(@Root() environment_: Environment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
4918
+ this.CheckUserReadPermissions('MJ: Projects', userPayload);
4919
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4920
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4921
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwProjects] WHERE [EnvironmentID]='${environment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Projects', userPayload, EntityPermissionType.Read, 'AND');
4922
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4923
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Projects', rows);
4924
+ return result;
4925
+ }
4926
+
4927
+ @FieldResolver(() => [Artifact_])
4928
+ async MJ_Artifacts_EnvironmentIDArray(@Root() environment_: Environment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
4929
+ this.CheckUserReadPermissions('MJ: Artifacts', userPayload);
4930
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4931
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4932
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifacts] WHERE [EnvironmentID]='${environment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifacts', userPayload, EntityPermissionType.Read, 'AND');
4933
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4934
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Artifacts', rows);
4935
+ return result;
4936
+ }
4937
+
4938
+ @FieldResolver(() => [Dashboard_])
4939
+ async Dashboards_EnvironmentIDArray(@Root() environment_: Environment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
4940
+ this.CheckUserReadPermissions('Dashboards', userPayload);
4941
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4942
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4943
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboards] WHERE [EnvironmentID]='${environment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Dashboards', userPayload, EntityPermissionType.Read, 'AND');
4944
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4945
+ const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', rows);
4946
+ return result;
4947
+ }
4948
+
4949
+ @FieldResolver(() => [Task_])
4950
+ async MJ_Tasks_EnvironmentIDArray(@Root() environment_: Environment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
4951
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
4952
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4953
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4954
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [EnvironmentID]='${environment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
4955
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4956
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
4957
+ return result;
4958
+ }
4959
+
4960
+ @FieldResolver(() => [Report_])
4961
+ async Reports_EnvironmentIDArray(@Root() environment_: Environment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
4962
+ this.CheckUserReadPermissions('Reports', userPayload);
4963
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4964
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4965
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwReports] WHERE [EnvironmentID]='${environment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Reports', userPayload, EntityPermissionType.Read, 'AND');
4966
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4967
+ const result = this.ArrayMapFieldNamesToCodeNames('Reports', rows);
4968
+ return result;
4969
+ }
4970
+
4971
+ @FieldResolver(() => [Conversation_])
4972
+ async Conversations_EnvironmentIDArray(@Root() environment_: Environment_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
4973
+ this.CheckUserReadPermissions('Conversations', userPayload);
4974
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
4975
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
4976
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwConversations] WHERE [EnvironmentID]='${environment_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Conversations', userPayload, EntityPermissionType.Read, 'AND');
4977
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
4978
+ const result = this.ArrayMapFieldNamesToCodeNames('Conversations', rows);
4979
+ return result;
4980
+ }
4981
+
4982
+ @Mutation(() => Environment_)
4983
+ async CreateEnvironment(
4984
+ @Arg('input', () => CreateEnvironmentInput) input: CreateEnvironmentInput,
4985
+ @Ctx() { providers, userPayload }: AppContext,
4986
+ @PubSub() pubSub: PubSubEngine
4987
+ ) {
4988
+ const provider = GetReadWriteProvider(providers);
4989
+ return this.CreateRecord('MJ: Environments', input, provider, userPayload, pubSub)
4990
+ }
4991
+
4992
+ @Mutation(() => Environment_)
4993
+ async UpdateEnvironment(
4994
+ @Arg('input', () => UpdateEnvironmentInput) input: UpdateEnvironmentInput,
4995
+ @Ctx() { providers, userPayload }: AppContext,
4996
+ @PubSub() pubSub: PubSubEngine
4997
+ ) {
4998
+ const provider = GetReadWriteProvider(providers);
4999
+ return this.UpdateRecord('MJ: Environments', input, provider, userPayload, pubSub);
5000
+ }
5001
+
5002
+ @Mutation(() => Environment_)
5003
+ async DeleteEnvironment(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5004
+ const provider = GetReadWriteProvider(providers);
5005
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
5006
+ return this.DeleteRecord('MJ: Environments', key, options, provider, userPayload, pubSub);
5007
+ }
5008
+
5009
+ }
5010
+
4573
5011
  //****************************************************************************
4574
5012
  // ENTITY CLASS for AI Agent Actions
4575
5013
  //****************************************************************************
@@ -4754,6 +5192,172 @@ export class AIAgentActionResolver extends ResolverBase {
4754
5192
 
4755
5193
  }
4756
5194
 
5195
+ //****************************************************************************
5196
+ // ENTITY CLASS for MJ: Task Dependencies
5197
+ //****************************************************************************
5198
+ @ObjectType({ description: `Defines dependencies between tasks to create a directed acyclic graph (DAG) for workflow orchestration` })
5199
+ export class TaskDependency_ {
5200
+ @Field()
5201
+ @MaxLength(16)
5202
+ ID: string;
5203
+
5204
+ @Field()
5205
+ @MaxLength(16)
5206
+ TaskID: string;
5207
+
5208
+ @Field()
5209
+ @MaxLength(16)
5210
+ DependsOnTaskID: string;
5211
+
5212
+ @Field({description: `Type of dependency relationship (Prerequisite, Corequisite, Optional)`})
5213
+ @MaxLength(100)
5214
+ DependencyType: string;
5215
+
5216
+ @Field()
5217
+ @MaxLength(10)
5218
+ _mj__CreatedAt: Date;
5219
+
5220
+ @Field()
5221
+ @MaxLength(10)
5222
+ _mj__UpdatedAt: Date;
5223
+
5224
+ @Field()
5225
+ @MaxLength(510)
5226
+ Task: string;
5227
+
5228
+ @Field()
5229
+ @MaxLength(510)
5230
+ DependsOnTask: string;
5231
+
5232
+ }
5233
+
5234
+ //****************************************************************************
5235
+ // INPUT TYPE for MJ: Task Dependencies
5236
+ //****************************************************************************
5237
+ @InputType()
5238
+ export class CreateTaskDependencyInput {
5239
+ @Field({ nullable: true })
5240
+ ID?: string;
5241
+
5242
+ @Field({ nullable: true })
5243
+ TaskID?: string;
5244
+
5245
+ @Field({ nullable: true })
5246
+ DependsOnTaskID?: string;
5247
+
5248
+ @Field({ nullable: true })
5249
+ DependencyType?: string;
5250
+ }
5251
+
5252
+
5253
+ //****************************************************************************
5254
+ // INPUT TYPE for MJ: Task Dependencies
5255
+ //****************************************************************************
5256
+ @InputType()
5257
+ export class UpdateTaskDependencyInput {
5258
+ @Field()
5259
+ ID: string;
5260
+
5261
+ @Field({ nullable: true })
5262
+ TaskID?: string;
5263
+
5264
+ @Field({ nullable: true })
5265
+ DependsOnTaskID?: string;
5266
+
5267
+ @Field({ nullable: true })
5268
+ DependencyType?: string;
5269
+
5270
+ @Field(() => [KeyValuePairInput], { nullable: true })
5271
+ OldValues___?: KeyValuePairInput[];
5272
+ }
5273
+
5274
+ //****************************************************************************
5275
+ // RESOLVER for MJ: Task Dependencies
5276
+ //****************************************************************************
5277
+ @ObjectType()
5278
+ export class RunTaskDependencyViewResult {
5279
+ @Field(() => [TaskDependency_])
5280
+ Results: TaskDependency_[];
5281
+
5282
+ @Field(() => String, {nullable: true})
5283
+ UserViewRunID?: string;
5284
+
5285
+ @Field(() => Int, {nullable: true})
5286
+ RowCount: number;
5287
+
5288
+ @Field(() => Int, {nullable: true})
5289
+ TotalRowCount: number;
5290
+
5291
+ @Field(() => Int, {nullable: true})
5292
+ ExecutionTime: number;
5293
+
5294
+ @Field({nullable: true})
5295
+ ErrorMessage?: string;
5296
+
5297
+ @Field(() => Boolean, {nullable: false})
5298
+ Success: boolean;
5299
+ }
5300
+
5301
+ @Resolver(TaskDependency_)
5302
+ export class TaskDependencyResolver extends ResolverBase {
5303
+ @Query(() => RunTaskDependencyViewResult)
5304
+ async RunTaskDependencyViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5305
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5306
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
5307
+ }
5308
+
5309
+ @Query(() => RunTaskDependencyViewResult)
5310
+ async RunTaskDependencyViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5311
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5312
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
5313
+ }
5314
+
5315
+ @Query(() => RunTaskDependencyViewResult)
5316
+ async RunTaskDependencyDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5317
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5318
+ input.EntityName = 'MJ: Task Dependencies';
5319
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
5320
+ }
5321
+ @Query(() => TaskDependency_, { nullable: true })
5322
+ async TaskDependency(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<TaskDependency_ | null> {
5323
+ this.CheckUserReadPermissions('MJ: Task Dependencies', userPayload);
5324
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5325
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5326
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTaskDependencies] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Task Dependencies', userPayload, EntityPermissionType.Read, 'AND');
5327
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5328
+ const result = this.MapFieldNamesToCodeNames('MJ: Task Dependencies', rows && rows.length > 0 ? rows[0] : {})
5329
+ return result;
5330
+ }
5331
+
5332
+ @Mutation(() => TaskDependency_)
5333
+ async CreateTaskDependency(
5334
+ @Arg('input', () => CreateTaskDependencyInput) input: CreateTaskDependencyInput,
5335
+ @Ctx() { providers, userPayload }: AppContext,
5336
+ @PubSub() pubSub: PubSubEngine
5337
+ ) {
5338
+ const provider = GetReadWriteProvider(providers);
5339
+ return this.CreateRecord('MJ: Task Dependencies', input, provider, userPayload, pubSub)
5340
+ }
5341
+
5342
+ @Mutation(() => TaskDependency_)
5343
+ async UpdateTaskDependency(
5344
+ @Arg('input', () => UpdateTaskDependencyInput) input: UpdateTaskDependencyInput,
5345
+ @Ctx() { providers, userPayload }: AppContext,
5346
+ @PubSub() pubSub: PubSubEngine
5347
+ ) {
5348
+ const provider = GetReadWriteProvider(providers);
5349
+ return this.UpdateRecord('MJ: Task Dependencies', input, provider, userPayload, pubSub);
5350
+ }
5351
+
5352
+ @Mutation(() => TaskDependency_)
5353
+ async DeleteTaskDependency(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5354
+ const provider = GetReadWriteProvider(providers);
5355
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
5356
+ return this.DeleteRecord('MJ: Task Dependencies', key, options, provider, userPayload, pubSub);
5357
+ }
5358
+
5359
+ }
5360
+
4757
5361
  //****************************************************************************
4758
5362
  // ENTITY CLASS for MJ: AI Model Price Types
4759
5363
  //****************************************************************************
@@ -4915,6 +5519,428 @@ export class AIModelPriceTypeResolver extends ResolverBase {
4915
5519
 
4916
5520
  }
4917
5521
 
5522
+ //****************************************************************************
5523
+ // ENTITY CLASS for MJ: Collections
5524
+ //****************************************************************************
5525
+ @ObjectType({ description: `Organizational folders for storing and categorizing artifacts. Supports nested folder structure for hierarchical organization.` })
5526
+ export class Collection_ {
5527
+ @Field()
5528
+ @MaxLength(16)
5529
+ ID: string;
5530
+
5531
+ @Field()
5532
+ @MaxLength(16)
5533
+ EnvironmentID: string;
5534
+
5535
+ @Field({nullable: true})
5536
+ @MaxLength(16)
5537
+ ParentID?: string;
5538
+
5539
+ @Field({description: `Display name for the collection`})
5540
+ @MaxLength(510)
5541
+ Name: string;
5542
+
5543
+ @Field({nullable: true, description: `Detailed description of the collection purpose`})
5544
+ Description?: string;
5545
+
5546
+ @Field({nullable: true, description: `Font Awesome icon class for UI display`})
5547
+ @MaxLength(100)
5548
+ Icon?: string;
5549
+
5550
+ @Field({nullable: true, description: `Hex color code for UI display (#RRGGBB format)`})
5551
+ @MaxLength(14)
5552
+ Color?: string;
5553
+
5554
+ @Field(() => Int, {nullable: true, description: `Display sequence for ordering collections in UI`})
5555
+ Sequence?: number;
5556
+
5557
+ @Field()
5558
+ @MaxLength(10)
5559
+ _mj__CreatedAt: Date;
5560
+
5561
+ @Field()
5562
+ @MaxLength(10)
5563
+ _mj__UpdatedAt: Date;
5564
+
5565
+ @Field()
5566
+ @MaxLength(510)
5567
+ Environment: string;
5568
+
5569
+ @Field({nullable: true})
5570
+ @MaxLength(510)
5571
+ Parent?: string;
5572
+
5573
+ @Field(() => [Collection_])
5574
+ MJ_Collections_ParentIDArray: Collection_[]; // Link to MJ_Collections
5575
+
5576
+ }
5577
+
5578
+ //****************************************************************************
5579
+ // INPUT TYPE for MJ: Collections
5580
+ //****************************************************************************
5581
+ @InputType()
5582
+ export class CreateCollectionInput {
5583
+ @Field({ nullable: true })
5584
+ ID?: string;
5585
+
5586
+ @Field({ nullable: true })
5587
+ EnvironmentID?: string;
5588
+
5589
+ @Field({ nullable: true })
5590
+ ParentID: string | null;
5591
+
5592
+ @Field({ nullable: true })
5593
+ Name?: string;
5594
+
5595
+ @Field({ nullable: true })
5596
+ Description: string | null;
5597
+
5598
+ @Field({ nullable: true })
5599
+ Icon: string | null;
5600
+
5601
+ @Field({ nullable: true })
5602
+ Color: string | null;
5603
+
5604
+ @Field(() => Int, { nullable: true })
5605
+ Sequence: number | null;
5606
+ }
5607
+
5608
+
5609
+ //****************************************************************************
5610
+ // INPUT TYPE for MJ: Collections
5611
+ //****************************************************************************
5612
+ @InputType()
5613
+ export class UpdateCollectionInput {
5614
+ @Field()
5615
+ ID: string;
5616
+
5617
+ @Field({ nullable: true })
5618
+ EnvironmentID?: string;
5619
+
5620
+ @Field({ nullable: true })
5621
+ ParentID?: string | null;
5622
+
5623
+ @Field({ nullable: true })
5624
+ Name?: string;
5625
+
5626
+ @Field({ nullable: true })
5627
+ Description?: string | null;
5628
+
5629
+ @Field({ nullable: true })
5630
+ Icon?: string | null;
5631
+
5632
+ @Field({ nullable: true })
5633
+ Color?: string | null;
5634
+
5635
+ @Field(() => Int, { nullable: true })
5636
+ Sequence?: number | null;
5637
+
5638
+ @Field(() => [KeyValuePairInput], { nullable: true })
5639
+ OldValues___?: KeyValuePairInput[];
5640
+ }
5641
+
5642
+ //****************************************************************************
5643
+ // RESOLVER for MJ: Collections
5644
+ //****************************************************************************
5645
+ @ObjectType()
5646
+ export class RunCollectionViewResult {
5647
+ @Field(() => [Collection_])
5648
+ Results: Collection_[];
5649
+
5650
+ @Field(() => String, {nullable: true})
5651
+ UserViewRunID?: string;
5652
+
5653
+ @Field(() => Int, {nullable: true})
5654
+ RowCount: number;
5655
+
5656
+ @Field(() => Int, {nullable: true})
5657
+ TotalRowCount: number;
5658
+
5659
+ @Field(() => Int, {nullable: true})
5660
+ ExecutionTime: number;
5661
+
5662
+ @Field({nullable: true})
5663
+ ErrorMessage?: string;
5664
+
5665
+ @Field(() => Boolean, {nullable: false})
5666
+ Success: boolean;
5667
+ }
5668
+
5669
+ @Resolver(Collection_)
5670
+ export class CollectionResolver extends ResolverBase {
5671
+ @Query(() => RunCollectionViewResult)
5672
+ async RunCollectionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5673
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5674
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
5675
+ }
5676
+
5677
+ @Query(() => RunCollectionViewResult)
5678
+ async RunCollectionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5679
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5680
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
5681
+ }
5682
+
5683
+ @Query(() => RunCollectionViewResult)
5684
+ async RunCollectionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5685
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5686
+ input.EntityName = 'MJ: Collections';
5687
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
5688
+ }
5689
+ @Query(() => Collection_, { nullable: true })
5690
+ async Collection(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Collection_ | null> {
5691
+ this.CheckUserReadPermissions('MJ: Collections', userPayload);
5692
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5693
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5694
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
5695
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5696
+ const result = this.MapFieldNamesToCodeNames('MJ: Collections', rows && rows.length > 0 ? rows[0] : {})
5697
+ return result;
5698
+ }
5699
+
5700
+ @FieldResolver(() => [Collection_])
5701
+ async MJ_Collections_ParentIDArray(@Root() collection_: Collection_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5702
+ this.CheckUserReadPermissions('MJ: Collections', userPayload);
5703
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5704
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5705
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [ParentID]='${collection_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
5706
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5707
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
5708
+ return result;
5709
+ }
5710
+
5711
+ @Mutation(() => Collection_)
5712
+ async CreateCollection(
5713
+ @Arg('input', () => CreateCollectionInput) input: CreateCollectionInput,
5714
+ @Ctx() { providers, userPayload }: AppContext,
5715
+ @PubSub() pubSub: PubSubEngine
5716
+ ) {
5717
+ const provider = GetReadWriteProvider(providers);
5718
+ return this.CreateRecord('MJ: Collections', input, provider, userPayload, pubSub)
5719
+ }
5720
+
5721
+ @Mutation(() => Collection_)
5722
+ async UpdateCollection(
5723
+ @Arg('input', () => UpdateCollectionInput) input: UpdateCollectionInput,
5724
+ @Ctx() { providers, userPayload }: AppContext,
5725
+ @PubSub() pubSub: PubSubEngine
5726
+ ) {
5727
+ const provider = GetReadWriteProvider(providers);
5728
+ return this.UpdateRecord('MJ: Collections', input, provider, userPayload, pubSub);
5729
+ }
5730
+
5731
+ @Mutation(() => Collection_)
5732
+ async DeleteCollection(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5733
+ const provider = GetReadWriteProvider(providers);
5734
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
5735
+ return this.DeleteRecord('MJ: Collections', key, options, provider, userPayload, pubSub);
5736
+ }
5737
+
5738
+ }
5739
+
5740
+ //****************************************************************************
5741
+ // ENTITY CLASS for MJ: Record Links
5742
+ //****************************************************************************
5743
+ @ObjectType({ description: `Generic linking table that can connect any two records in the system, providing a flexible relationship management system.` })
5744
+ export class RecordLink_ {
5745
+ @Field()
5746
+ @MaxLength(16)
5747
+ ID: string;
5748
+
5749
+ @Field()
5750
+ @MaxLength(16)
5751
+ SourceEntityID: string;
5752
+
5753
+ @Field({description: `Primary key value(s) of the source record - scalar for simple PKs or JSON KeyValuePair array for composite PKs`})
5754
+ @MaxLength(1000)
5755
+ SourceRecordID: string;
5756
+
5757
+ @Field()
5758
+ @MaxLength(16)
5759
+ TargetEntityID: string;
5760
+
5761
+ @Field({description: `Primary key value(s) of the target record - scalar for simple PKs or JSON KeyValuePair array for composite PKs`})
5762
+ @MaxLength(1000)
5763
+ TargetRecordID: string;
5764
+
5765
+ @Field({nullable: true, description: `Application-specific relationship type describing how the records are related`})
5766
+ @MaxLength(100)
5767
+ LinkType?: string;
5768
+
5769
+ @Field(() => Int, {nullable: true, description: `Display sequence for ordering linked records in UI`})
5770
+ Sequence?: number;
5771
+
5772
+ @Field({nullable: true, description: `JSON field for storing additional link-specific metadata`})
5773
+ Metadata?: string;
5774
+
5775
+ @Field()
5776
+ @MaxLength(10)
5777
+ _mj__CreatedAt: Date;
5778
+
5779
+ @Field()
5780
+ @MaxLength(10)
5781
+ _mj__UpdatedAt: Date;
5782
+
5783
+ @Field()
5784
+ @MaxLength(510)
5785
+ SourceEntity: string;
5786
+
5787
+ @Field()
5788
+ @MaxLength(510)
5789
+ TargetEntity: string;
5790
+
5791
+ }
5792
+
5793
+ //****************************************************************************
5794
+ // INPUT TYPE for MJ: Record Links
5795
+ //****************************************************************************
5796
+ @InputType()
5797
+ export class CreateRecordLinkInput {
5798
+ @Field({ nullable: true })
5799
+ ID?: string;
5800
+
5801
+ @Field({ nullable: true })
5802
+ SourceEntityID?: string;
5803
+
5804
+ @Field({ nullable: true })
5805
+ SourceRecordID?: string;
5806
+
5807
+ @Field({ nullable: true })
5808
+ TargetEntityID?: string;
5809
+
5810
+ @Field({ nullable: true })
5811
+ TargetRecordID?: string;
5812
+
5813
+ @Field({ nullable: true })
5814
+ LinkType: string | null;
5815
+
5816
+ @Field(() => Int, { nullable: true })
5817
+ Sequence: number | null;
5818
+
5819
+ @Field({ nullable: true })
5820
+ Metadata: string | null;
5821
+ }
5822
+
5823
+
5824
+ //****************************************************************************
5825
+ // INPUT TYPE for MJ: Record Links
5826
+ //****************************************************************************
5827
+ @InputType()
5828
+ export class UpdateRecordLinkInput {
5829
+ @Field()
5830
+ ID: string;
5831
+
5832
+ @Field({ nullable: true })
5833
+ SourceEntityID?: string;
5834
+
5835
+ @Field({ nullable: true })
5836
+ SourceRecordID?: string;
5837
+
5838
+ @Field({ nullable: true })
5839
+ TargetEntityID?: string;
5840
+
5841
+ @Field({ nullable: true })
5842
+ TargetRecordID?: string;
5843
+
5844
+ @Field({ nullable: true })
5845
+ LinkType?: string | null;
5846
+
5847
+ @Field(() => Int, { nullable: true })
5848
+ Sequence?: number | null;
5849
+
5850
+ @Field({ nullable: true })
5851
+ Metadata?: string | null;
5852
+
5853
+ @Field(() => [KeyValuePairInput], { nullable: true })
5854
+ OldValues___?: KeyValuePairInput[];
5855
+ }
5856
+
5857
+ //****************************************************************************
5858
+ // RESOLVER for MJ: Record Links
5859
+ //****************************************************************************
5860
+ @ObjectType()
5861
+ export class RunRecordLinkViewResult {
5862
+ @Field(() => [RecordLink_])
5863
+ Results: RecordLink_[];
5864
+
5865
+ @Field(() => String, {nullable: true})
5866
+ UserViewRunID?: string;
5867
+
5868
+ @Field(() => Int, {nullable: true})
5869
+ RowCount: number;
5870
+
5871
+ @Field(() => Int, {nullable: true})
5872
+ TotalRowCount: number;
5873
+
5874
+ @Field(() => Int, {nullable: true})
5875
+ ExecutionTime: number;
5876
+
5877
+ @Field({nullable: true})
5878
+ ErrorMessage?: string;
5879
+
5880
+ @Field(() => Boolean, {nullable: false})
5881
+ Success: boolean;
5882
+ }
5883
+
5884
+ @Resolver(RecordLink_)
5885
+ export class RecordLinkResolver extends ResolverBase {
5886
+ @Query(() => RunRecordLinkViewResult)
5887
+ async RunRecordLinkViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5888
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5889
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
5890
+ }
5891
+
5892
+ @Query(() => RunRecordLinkViewResult)
5893
+ async RunRecordLinkViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5894
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5895
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
5896
+ }
5897
+
5898
+ @Query(() => RunRecordLinkViewResult)
5899
+ async RunRecordLinkDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5900
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5901
+ input.EntityName = 'MJ: Record Links';
5902
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
5903
+ }
5904
+ @Query(() => RecordLink_, { nullable: true })
5905
+ async RecordLink(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<RecordLink_ | null> {
5906
+ this.CheckUserReadPermissions('MJ: Record Links', userPayload);
5907
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5908
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5909
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecordLinks] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Record Links', userPayload, EntityPermissionType.Read, 'AND');
5910
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5911
+ const result = this.MapFieldNamesToCodeNames('MJ: Record Links', rows && rows.length > 0 ? rows[0] : {})
5912
+ return result;
5913
+ }
5914
+
5915
+ @Mutation(() => RecordLink_)
5916
+ async CreateRecordLink(
5917
+ @Arg('input', () => CreateRecordLinkInput) input: CreateRecordLinkInput,
5918
+ @Ctx() { providers, userPayload }: AppContext,
5919
+ @PubSub() pubSub: PubSubEngine
5920
+ ) {
5921
+ const provider = GetReadWriteProvider(providers);
5922
+ return this.CreateRecord('MJ: Record Links', input, provider, userPayload, pubSub)
5923
+ }
5924
+
5925
+ @Mutation(() => RecordLink_)
5926
+ async UpdateRecordLink(
5927
+ @Arg('input', () => UpdateRecordLinkInput) input: UpdateRecordLinkInput,
5928
+ @Ctx() { providers, userPayload }: AppContext,
5929
+ @PubSub() pubSub: PubSubEngine
5930
+ ) {
5931
+ const provider = GetReadWriteProvider(providers);
5932
+ return this.UpdateRecord('MJ: Record Links', input, provider, userPayload, pubSub);
5933
+ }
5934
+
5935
+ @Mutation(() => RecordLink_)
5936
+ async DeleteRecordLink(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5937
+ const provider = GetReadWriteProvider(providers);
5938
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
5939
+ return this.DeleteRecord('MJ: Record Links', key, options, provider, userPayload, pubSub);
5940
+ }
5941
+
5942
+ }
5943
+
4918
5944
  //****************************************************************************
4919
5945
  // ENTITY CLASS for AI Prompts
4920
5946
  //****************************************************************************
@@ -9547,9 +10573,18 @@ export class Entity_ {
9547
10573
  @Field(() => [QueryEntity_])
9548
10574
  QueryEntities_EntityIDArray: QueryEntity_[]; // Link to QueryEntities
9549
10575
 
10576
+ @Field(() => [RecordLink_])
10577
+ MJ_RecordLinks_SourceEntityIDArray: RecordLink_[]; // Link to MJ_RecordLinks
10578
+
10579
+ @Field(() => [AccessControlRule_])
10580
+ MJ_AccessControlRules_EntityIDArray: AccessControlRule_[]; // Link to MJ_AccessControlRules
10581
+
9550
10582
  @Field(() => [GeneratedCode_])
9551
10583
  GeneratedCodes_LinkedEntityIDArray: GeneratedCode_[]; // Link to GeneratedCodes
9552
10584
 
10585
+ @Field(() => [RecordLink_])
10586
+ MJ_RecordLinks_TargetEntityIDArray: RecordLink_[]; // Link to MJ_RecordLinks
10587
+
9553
10588
  }
9554
10589
 
9555
10590
  //****************************************************************************
@@ -10351,6 +11386,28 @@ export class EntityResolverBase extends ResolverBase {
10351
11386
  return result;
10352
11387
  }
10353
11388
 
11389
+ @FieldResolver(() => [RecordLink_])
11390
+ async MJ_RecordLinks_SourceEntityIDArray(@Root() entity_: Entity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11391
+ this.CheckUserReadPermissions('MJ: Record Links', userPayload);
11392
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11393
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
11394
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecordLinks] WHERE [SourceEntityID]='${entity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Record Links', userPayload, EntityPermissionType.Read, 'AND');
11395
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
11396
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Record Links', rows);
11397
+ return result;
11398
+ }
11399
+
11400
+ @FieldResolver(() => [AccessControlRule_])
11401
+ async MJ_AccessControlRules_EntityIDArray(@Root() entity_: Entity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11402
+ this.CheckUserReadPermissions('MJ: Access Control Rules', userPayload);
11403
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11404
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
11405
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAccessControlRules] WHERE [EntityID]='${entity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Access Control Rules', userPayload, EntityPermissionType.Read, 'AND');
11406
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
11407
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Access Control Rules', rows);
11408
+ return result;
11409
+ }
11410
+
10354
11411
  @FieldResolver(() => [GeneratedCode_])
10355
11412
  async GeneratedCodes_LinkedEntityIDArray(@Root() entity_: Entity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10356
11413
  this.CheckUserReadPermissions('Generated Codes', userPayload);
@@ -10362,6 +11419,17 @@ export class EntityResolverBase extends ResolverBase {
10362
11419
  return result;
10363
11420
  }
10364
11421
 
11422
+ @FieldResolver(() => [RecordLink_])
11423
+ async MJ_RecordLinks_TargetEntityIDArray(@Root() entity_: Entity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11424
+ this.CheckUserReadPermissions('MJ: Record Links', userPayload);
11425
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11426
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
11427
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecordLinks] WHERE [TargetEntityID]='${entity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Record Links', userPayload, EntityPermissionType.Read, 'AND');
11428
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
11429
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Record Links', rows);
11430
+ return result;
11431
+ }
11432
+
10365
11433
  @Mutation(() => Entity_)
10366
11434
  async CreateEntity(
10367
11435
  @Arg('input', () => CreateEntityInput) input: CreateEntityInput,
@@ -10589,6 +11657,12 @@ export class User_ {
10589
11657
  @Field(() => [DashboardUserState_])
10590
11658
  MJ_DashboardUserStates_UserIDArray: DashboardUserState_[]; // Link to MJ_DashboardUserStates
10591
11659
 
11660
+ @Field(() => [PublicLink_])
11661
+ MJ_PublicLinks_UserIDArray: PublicLink_[]; // Link to MJ_PublicLinks
11662
+
11663
+ @Field(() => [ArtifactVersion_])
11664
+ MJ_ArtifactVersions_UserIDArray: ArtifactVersion_[]; // Link to MJ_ArtifactVersions
11665
+
10592
11666
  @Field(() => [ResourcePermission_])
10593
11667
  ResourcePermissions_UserIDArray: ResourcePermission_[]; // Link to ResourcePermissions
10594
11668
 
@@ -10598,9 +11672,18 @@ export class User_ {
10598
11672
  @Field(() => [ConversationDetail_])
10599
11673
  ConversationDetails_UserIDArray: ConversationDetail_[]; // Link to ConversationDetails
10600
11674
 
11675
+ @Field(() => [AccessControlRule_])
11676
+ MJ_AccessControlRules_GrantedByUserIDArray: AccessControlRule_[]; // Link to MJ_AccessControlRules
11677
+
11678
+ @Field(() => [Artifact_])
11679
+ MJ_Artifacts_UserIDArray: Artifact_[]; // Link to MJ_Artifacts
11680
+
10601
11681
  @Field(() => [AIAgentRun_])
10602
11682
  MJ_AIAgentRuns_UserIDArray: AIAgentRun_[]; // Link to MJ_AIAgentRuns
10603
11683
 
11684
+ @Field(() => [Task_])
11685
+ MJ_Tasks_UserIDArray: Task_[]; // Link to MJ_Tasks
11686
+
10604
11687
  }
10605
11688
 
10606
11689
  //****************************************************************************
@@ -11178,6 +12261,28 @@ export class UserResolverBase extends ResolverBase {
11178
12261
  return result;
11179
12262
  }
11180
12263
 
12264
+ @FieldResolver(() => [PublicLink_])
12265
+ async MJ_PublicLinks_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12266
+ this.CheckUserReadPermissions('MJ: Public Links', userPayload);
12267
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12268
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12269
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwPublicLinks] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Public Links', userPayload, EntityPermissionType.Read, 'AND');
12270
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12271
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Public Links', rows);
12272
+ return result;
12273
+ }
12274
+
12275
+ @FieldResolver(() => [ArtifactVersion_])
12276
+ async MJ_ArtifactVersions_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12277
+ this.CheckUserReadPermissions('MJ: Artifact Versions', userPayload);
12278
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12279
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12280
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactVersions] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Versions', userPayload, EntityPermissionType.Read, 'AND');
12281
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12282
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Artifact Versions', rows);
12283
+ return result;
12284
+ }
12285
+
11181
12286
  @FieldResolver(() => [ResourcePermission_])
11182
12287
  async ResourcePermissions_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11183
12288
  this.CheckUserReadPermissions('Resource Permissions', userPayload);
@@ -11211,6 +12316,28 @@ export class UserResolverBase extends ResolverBase {
11211
12316
  return result;
11212
12317
  }
11213
12318
 
12319
+ @FieldResolver(() => [AccessControlRule_])
12320
+ async MJ_AccessControlRules_GrantedByUserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12321
+ this.CheckUserReadPermissions('MJ: Access Control Rules', userPayload);
12322
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12323
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12324
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAccessControlRules] WHERE [GrantedByUserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Access Control Rules', userPayload, EntityPermissionType.Read, 'AND');
12325
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12326
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Access Control Rules', rows);
12327
+ return result;
12328
+ }
12329
+
12330
+ @FieldResolver(() => [Artifact_])
12331
+ async MJ_Artifacts_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12332
+ this.CheckUserReadPermissions('MJ: Artifacts', userPayload);
12333
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12334
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12335
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifacts] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifacts', userPayload, EntityPermissionType.Read, 'AND');
12336
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12337
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Artifacts', rows);
12338
+ return result;
12339
+ }
12340
+
11214
12341
  @FieldResolver(() => [AIAgentRun_])
11215
12342
  async MJ_AIAgentRuns_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11216
12343
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
@@ -11222,6 +12349,17 @@ export class UserResolverBase extends ResolverBase {
11222
12349
  return result;
11223
12350
  }
11224
12351
 
12352
+ @FieldResolver(() => [Task_])
12353
+ async MJ_Tasks_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12354
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
12355
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12356
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12357
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
12358
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12359
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
12360
+ return result;
12361
+ }
12362
+
11225
12363
  @Mutation(() => User_)
11226
12364
  async CreateUser(
11227
12365
  @Arg('input', () => CreateUserInput) input: CreateUserInput,
@@ -19268,6 +20406,10 @@ export class Dashboard_ {
19268
20406
  @MaxLength(510)
19269
20407
  Code?: string;
19270
20408
 
20409
+ @Field()
20410
+ @MaxLength(16)
20411
+ EnvironmentID: string;
20412
+
19271
20413
  @Field()
19272
20414
  @MaxLength(200)
19273
20415
  User: string;
@@ -19280,6 +20422,10 @@ export class Dashboard_ {
19280
20422
  @MaxLength(200)
19281
20423
  Application?: string;
19282
20424
 
20425
+ @Field()
20426
+ @MaxLength(510)
20427
+ Environment: string;
20428
+
19283
20429
  @Field(() => [DashboardUserState_])
19284
20430
  MJ_DashboardUserStates_DashboardIDArray: DashboardUserState_[]; // Link to MJ_DashboardUserStates
19285
20431
 
@@ -19328,6 +20474,9 @@ export class CreateDashboardInput {
19328
20474
 
19329
20475
  @Field({ nullable: true })
19330
20476
  Code: string | null;
20477
+
20478
+ @Field({ nullable: true })
20479
+ EnvironmentID?: string;
19331
20480
  }
19332
20481
 
19333
20482
 
@@ -19372,6 +20521,9 @@ export class UpdateDashboardInput {
19372
20521
  @Field({ nullable: true })
19373
20522
  Code?: string | null;
19374
20523
 
20524
+ @Field({ nullable: true })
20525
+ EnvironmentID?: string;
20526
+
19375
20527
  @Field(() => [KeyValuePairInput], { nullable: true })
19376
20528
  OldValues___?: KeyValuePairInput[];
19377
20529
  }
@@ -20055,6 +21207,10 @@ export class Report_ {
20055
21207
  @Field({nullable: true, description: `Thumbnail image for the report that can be displayed in gallery views. Can contain either a URL to an image file or a Base64-encoded image string.`})
20056
21208
  Thumbnail?: string;
20057
21209
 
21210
+ @Field()
21211
+ @MaxLength(16)
21212
+ EnvironmentID: string;
21213
+
20058
21214
  @Field({nullable: true})
20059
21215
  @MaxLength(200)
20060
21216
  Category?: string;
@@ -20087,6 +21243,10 @@ export class Report_ {
20087
21243
  @MaxLength(200)
20088
21244
  OutputWorkflow?: string;
20089
21245
 
21246
+ @Field()
21247
+ @MaxLength(510)
21248
+ Environment: string;
21249
+
20090
21250
  @Field(() => [ReportSnapshot_])
20091
21251
  ReportSnapshots_ReportIDArray: ReportSnapshot_[]; // Link to ReportSnapshots
20092
21252
 
@@ -20153,6 +21313,9 @@ export class CreateReportInput {
20153
21313
 
20154
21314
  @Field({ nullable: true })
20155
21315
  Thumbnail: string | null;
21316
+
21317
+ @Field({ nullable: true })
21318
+ EnvironmentID?: string;
20156
21319
  }
20157
21320
 
20158
21321
 
@@ -20212,6 +21375,9 @@ export class UpdateReportInput {
20212
21375
  @Field({ nullable: true })
20213
21376
  Thumbnail?: string | null;
20214
21377
 
21378
+ @Field({ nullable: true })
21379
+ EnvironmentID?: string;
21380
+
20215
21381
  @Field(() => [KeyValuePairInput], { nullable: true })
20216
21382
  OldValues___?: KeyValuePairInput[];
20217
21383
  }
@@ -21933,6 +23099,9 @@ export class ConversationDetail_ {
21933
23099
  @Field(() => Int, {nullable: true, description: `Duration in milliseconds representing how long the AI response processing took to complete for this conversation detail.`})
21934
23100
  CompletionTime?: number;
21935
23101
 
23102
+ @Field(() => Boolean, {description: `Indicates if this message is pinned within the conversation for easy reference`})
23103
+ IsPinned: boolean;
23104
+
21936
23105
  @Field({nullable: true})
21937
23106
  @MaxLength(510)
21938
23107
  Conversation?: string;
@@ -21951,6 +23120,9 @@ export class ConversationDetail_ {
21951
23120
  @Field(() => [AIAgentRun_])
21952
23121
  MJ_AIAgentRuns_ConversationDetailIDArray: AIAgentRun_[]; // Link to MJ_AIAgentRuns
21953
23122
 
23123
+ @Field(() => [Task_])
23124
+ MJ_Tasks_ConversationDetailIDArray: Task_[]; // Link to MJ_Tasks
23125
+
21954
23126
  }
21955
23127
 
21956
23128
  //****************************************************************************
@@ -22002,6 +23174,9 @@ export class CreateConversationDetailInput {
22002
23174
 
22003
23175
  @Field(() => Int, { nullable: true })
22004
23176
  CompletionTime: number | null;
23177
+
23178
+ @Field(() => Boolean, { nullable: true })
23179
+ IsPinned?: boolean;
22005
23180
  }
22006
23181
 
22007
23182
 
@@ -22055,6 +23230,9 @@ export class UpdateConversationDetailInput {
22055
23230
  @Field(() => Int, { nullable: true })
22056
23231
  CompletionTime?: number | null;
22057
23232
 
23233
+ @Field(() => Boolean, { nullable: true })
23234
+ IsPinned?: boolean;
23235
+
22058
23236
  @Field(() => [KeyValuePairInput], { nullable: true })
22059
23237
  OldValues___?: KeyValuePairInput[];
22060
23238
  }
@@ -22139,6 +23317,17 @@ export class ConversationDetailResolver extends ResolverBase {
22139
23317
  return result;
22140
23318
  }
22141
23319
 
23320
+ @FieldResolver(() => [Task_])
23321
+ async MJ_Tasks_ConversationDetailIDArray(@Root() conversationdetail_: ConversationDetail_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
23322
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
23323
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
23324
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
23325
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [ConversationDetailID]='${conversationdetail_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
23326
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
23327
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
23328
+ return result;
23329
+ }
23330
+
22142
23331
  @Mutation(() => ConversationDetail_)
22143
23332
  async CreateConversationDetail(
22144
23333
  @Arg('input', () => CreateConversationDetailInput) input: CreateConversationDetailInput,
@@ -22223,6 +23412,17 @@ export class Conversation_ {
22223
23412
  @MaxLength(40)
22224
23413
  Status: string;
22225
23414
 
23415
+ @Field()
23416
+ @MaxLength(16)
23417
+ EnvironmentID: string;
23418
+
23419
+ @Field({nullable: true})
23420
+ @MaxLength(16)
23421
+ ProjectID?: string;
23422
+
23423
+ @Field(() => Boolean, {description: `Indicates if this conversation is pinned to the top of lists`})
23424
+ IsPinned: boolean;
23425
+
22226
23426
  @Field()
22227
23427
  @MaxLength(200)
22228
23428
  User: string;
@@ -22235,6 +23435,14 @@ export class Conversation_ {
22235
23435
  @MaxLength(510)
22236
23436
  DataContext?: string;
22237
23437
 
23438
+ @Field()
23439
+ @MaxLength(510)
23440
+ Environment: string;
23441
+
23442
+ @Field({nullable: true})
23443
+ @MaxLength(510)
23444
+ Project?: string;
23445
+
22238
23446
  @Field(() => [ConversationDetail_])
22239
23447
  ConversationDetails_ConversationIDArray: ConversationDetail_[]; // Link to ConversationDetails
22240
23448
 
@@ -22286,6 +23494,15 @@ export class CreateConversationInput {
22286
23494
 
22287
23495
  @Field({ nullable: true })
22288
23496
  Status?: string;
23497
+
23498
+ @Field({ nullable: true })
23499
+ EnvironmentID?: string;
23500
+
23501
+ @Field({ nullable: true })
23502
+ ProjectID: string | null;
23503
+
23504
+ @Field(() => Boolean, { nullable: true })
23505
+ IsPinned?: boolean;
22289
23506
  }
22290
23507
 
22291
23508
 
@@ -22327,6 +23544,15 @@ export class UpdateConversationInput {
22327
23544
  @Field({ nullable: true })
22328
23545
  Status?: string;
22329
23546
 
23547
+ @Field({ nullable: true })
23548
+ EnvironmentID?: string;
23549
+
23550
+ @Field({ nullable: true })
23551
+ ProjectID?: string | null;
23552
+
23553
+ @Field(() => Boolean, { nullable: true })
23554
+ IsPinned?: boolean;
23555
+
22330
23556
  @Field(() => [KeyValuePairInput], { nullable: true })
22331
23557
  OldValues___?: KeyValuePairInput[];
22332
23558
  }
@@ -38308,6 +39534,466 @@ export class ComponentResolver extends ResolverBase {
38308
39534
 
38309
39535
  }
38310
39536
 
39537
+ //****************************************************************************
39538
+ // ENTITY CLASS for MJ: Access Control Rules
39539
+ //****************************************************************************
39540
+ @ObjectType({ description: `Generic ACL-style permission system that can control access to any entity record in the system with granular CRUD permissions.` })
39541
+ export class AccessControlRule_ {
39542
+ @Field()
39543
+ @MaxLength(16)
39544
+ ID: string;
39545
+
39546
+ @Field()
39547
+ @MaxLength(16)
39548
+ EntityID: string;
39549
+
39550
+ @Field({description: `Primary key value(s) of the record being protected - scalar for simple PKs or JSON for composite PKs`})
39551
+ @MaxLength(1000)
39552
+ RecordID: string;
39553
+
39554
+ @Field({description: `Type of grantee receiving permission (User, Role, Everyone, Public). "Everyone" means all authenticated users whereas "Public" means any authenticated OR anonymous user.`})
39555
+ @MaxLength(100)
39556
+ GranteeType: string;
39557
+
39558
+ @Field({nullable: true})
39559
+ @MaxLength(16)
39560
+ GranteeID?: string;
39561
+
39562
+ @Field(() => Boolean, {description: `Permission to read/view the record`})
39563
+ CanRead: boolean;
39564
+
39565
+ @Field(() => Boolean, {description: `Permission to create new related records`})
39566
+ CanCreate: boolean;
39567
+
39568
+ @Field(() => Boolean, {description: `Permission to update/modify the record`})
39569
+ CanUpdate: boolean;
39570
+
39571
+ @Field(() => Boolean, {description: `Permission to delete the record`})
39572
+ CanDelete: boolean;
39573
+
39574
+ @Field(() => Boolean, {description: `Permission to share/grant permissions to other users`})
39575
+ CanShare: boolean;
39576
+
39577
+ @Field({nullable: true, description: `Optional expiration date/time for this access rule`})
39578
+ @MaxLength(10)
39579
+ ExpiresAt?: Date;
39580
+
39581
+ @Field()
39582
+ @MaxLength(16)
39583
+ GrantedByUserID: string;
39584
+
39585
+ @Field()
39586
+ @MaxLength(10)
39587
+ _mj__CreatedAt: Date;
39588
+
39589
+ @Field()
39590
+ @MaxLength(10)
39591
+ _mj__UpdatedAt: Date;
39592
+
39593
+ @Field()
39594
+ @MaxLength(510)
39595
+ Entity: string;
39596
+
39597
+ @Field()
39598
+ @MaxLength(200)
39599
+ GrantedByUser: string;
39600
+
39601
+ }
39602
+
39603
+ //****************************************************************************
39604
+ // INPUT TYPE for MJ: Access Control Rules
39605
+ //****************************************************************************
39606
+ @InputType()
39607
+ export class CreateAccessControlRuleInput {
39608
+ @Field({ nullable: true })
39609
+ ID?: string;
39610
+
39611
+ @Field({ nullable: true })
39612
+ EntityID?: string;
39613
+
39614
+ @Field({ nullable: true })
39615
+ RecordID?: string;
39616
+
39617
+ @Field({ nullable: true })
39618
+ GranteeType?: string;
39619
+
39620
+ @Field({ nullable: true })
39621
+ GranteeID: string | null;
39622
+
39623
+ @Field(() => Boolean, { nullable: true })
39624
+ CanRead?: boolean;
39625
+
39626
+ @Field(() => Boolean, { nullable: true })
39627
+ CanCreate?: boolean;
39628
+
39629
+ @Field(() => Boolean, { nullable: true })
39630
+ CanUpdate?: boolean;
39631
+
39632
+ @Field(() => Boolean, { nullable: true })
39633
+ CanDelete?: boolean;
39634
+
39635
+ @Field(() => Boolean, { nullable: true })
39636
+ CanShare?: boolean;
39637
+
39638
+ @Field({ nullable: true })
39639
+ ExpiresAt: Date | null;
39640
+
39641
+ @Field({ nullable: true })
39642
+ GrantedByUserID?: string;
39643
+ }
39644
+
39645
+
39646
+ //****************************************************************************
39647
+ // INPUT TYPE for MJ: Access Control Rules
39648
+ //****************************************************************************
39649
+ @InputType()
39650
+ export class UpdateAccessControlRuleInput {
39651
+ @Field()
39652
+ ID: string;
39653
+
39654
+ @Field({ nullable: true })
39655
+ EntityID?: string;
39656
+
39657
+ @Field({ nullable: true })
39658
+ RecordID?: string;
39659
+
39660
+ @Field({ nullable: true })
39661
+ GranteeType?: string;
39662
+
39663
+ @Field({ nullable: true })
39664
+ GranteeID?: string | null;
39665
+
39666
+ @Field(() => Boolean, { nullable: true })
39667
+ CanRead?: boolean;
39668
+
39669
+ @Field(() => Boolean, { nullable: true })
39670
+ CanCreate?: boolean;
39671
+
39672
+ @Field(() => Boolean, { nullable: true })
39673
+ CanUpdate?: boolean;
39674
+
39675
+ @Field(() => Boolean, { nullable: true })
39676
+ CanDelete?: boolean;
39677
+
39678
+ @Field(() => Boolean, { nullable: true })
39679
+ CanShare?: boolean;
39680
+
39681
+ @Field({ nullable: true })
39682
+ ExpiresAt?: Date | null;
39683
+
39684
+ @Field({ nullable: true })
39685
+ GrantedByUserID?: string;
39686
+
39687
+ @Field(() => [KeyValuePairInput], { nullable: true })
39688
+ OldValues___?: KeyValuePairInput[];
39689
+ }
39690
+
39691
+ //****************************************************************************
39692
+ // RESOLVER for MJ: Access Control Rules
39693
+ //****************************************************************************
39694
+ @ObjectType()
39695
+ export class RunAccessControlRuleViewResult {
39696
+ @Field(() => [AccessControlRule_])
39697
+ Results: AccessControlRule_[];
39698
+
39699
+ @Field(() => String, {nullable: true})
39700
+ UserViewRunID?: string;
39701
+
39702
+ @Field(() => Int, {nullable: true})
39703
+ RowCount: number;
39704
+
39705
+ @Field(() => Int, {nullable: true})
39706
+ TotalRowCount: number;
39707
+
39708
+ @Field(() => Int, {nullable: true})
39709
+ ExecutionTime: number;
39710
+
39711
+ @Field({nullable: true})
39712
+ ErrorMessage?: string;
39713
+
39714
+ @Field(() => Boolean, {nullable: false})
39715
+ Success: boolean;
39716
+ }
39717
+
39718
+ @Resolver(AccessControlRule_)
39719
+ export class AccessControlRuleResolver extends ResolverBase {
39720
+ @Query(() => RunAccessControlRuleViewResult)
39721
+ async RunAccessControlRuleViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39722
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39723
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
39724
+ }
39725
+
39726
+ @Query(() => RunAccessControlRuleViewResult)
39727
+ async RunAccessControlRuleViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39728
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39729
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
39730
+ }
39731
+
39732
+ @Query(() => RunAccessControlRuleViewResult)
39733
+ async RunAccessControlRuleDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39734
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39735
+ input.EntityName = 'MJ: Access Control Rules';
39736
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
39737
+ }
39738
+ @Query(() => AccessControlRule_, { nullable: true })
39739
+ async AccessControlRule(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AccessControlRule_ | null> {
39740
+ this.CheckUserReadPermissions('MJ: Access Control Rules', userPayload);
39741
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39742
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
39743
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAccessControlRules] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Access Control Rules', userPayload, EntityPermissionType.Read, 'AND');
39744
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
39745
+ const result = this.MapFieldNamesToCodeNames('MJ: Access Control Rules', rows && rows.length > 0 ? rows[0] : {})
39746
+ return result;
39747
+ }
39748
+
39749
+ @Mutation(() => AccessControlRule_)
39750
+ async CreateAccessControlRule(
39751
+ @Arg('input', () => CreateAccessControlRuleInput) input: CreateAccessControlRuleInput,
39752
+ @Ctx() { providers, userPayload }: AppContext,
39753
+ @PubSub() pubSub: PubSubEngine
39754
+ ) {
39755
+ const provider = GetReadWriteProvider(providers);
39756
+ return this.CreateRecord('MJ: Access Control Rules', input, provider, userPayload, pubSub)
39757
+ }
39758
+
39759
+ @Mutation(() => AccessControlRule_)
39760
+ async UpdateAccessControlRule(
39761
+ @Arg('input', () => UpdateAccessControlRuleInput) input: UpdateAccessControlRuleInput,
39762
+ @Ctx() { providers, userPayload }: AppContext,
39763
+ @PubSub() pubSub: PubSubEngine
39764
+ ) {
39765
+ const provider = GetReadWriteProvider(providers);
39766
+ return this.UpdateRecord('MJ: Access Control Rules', input, provider, userPayload, pubSub);
39767
+ }
39768
+
39769
+ @Mutation(() => AccessControlRule_)
39770
+ async DeleteAccessControlRule(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39771
+ const provider = GetReadWriteProvider(providers);
39772
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
39773
+ return this.DeleteRecord('MJ: Access Control Rules', key, options, provider, userPayload, pubSub);
39774
+ }
39775
+
39776
+ }
39777
+
39778
+ //****************************************************************************
39779
+ // ENTITY CLASS for MJ: Public Links
39780
+ //****************************************************************************
39781
+ @ObjectType({ description: `Shareable links for external access to artifacts and other resources. Supports password protection and expiration.` })
39782
+ export class PublicLink_ {
39783
+ @Field()
39784
+ @MaxLength(16)
39785
+ ID: string;
39786
+
39787
+ @Field({description: `Type of resource being shared (Artifact, Conversation, Collection)`})
39788
+ @MaxLength(100)
39789
+ ResourceType: string;
39790
+
39791
+ @Field()
39792
+ @MaxLength(16)
39793
+ ResourceID: string;
39794
+
39795
+ @Field({description: `Unique token for accessing the shared resource via URL`})
39796
+ @MaxLength(510)
39797
+ Token: string;
39798
+
39799
+ @Field({nullable: true, description: `SHA256 hash of optional password for additional security`})
39800
+ @MaxLength(510)
39801
+ PasswordHash?: string;
39802
+
39803
+ @Field({nullable: true, description: `Optional expiration date/time for this public link`})
39804
+ @MaxLength(10)
39805
+ ExpiresAt?: Date;
39806
+
39807
+ @Field(() => Int, {nullable: true, description: `Maximum number of times this link can be viewed`})
39808
+ MaxViews?: number;
39809
+
39810
+ @Field(() => Int, {description: `Current count of how many times this link has been viewed`})
39811
+ CurrentViews: number;
39812
+
39813
+ @Field()
39814
+ @MaxLength(16)
39815
+ UserID: string;
39816
+
39817
+ @Field(() => Boolean, {description: `Indicates if this link is currently active and accessible`})
39818
+ IsActive: boolean;
39819
+
39820
+ @Field()
39821
+ @MaxLength(10)
39822
+ _mj__CreatedAt: Date;
39823
+
39824
+ @Field()
39825
+ @MaxLength(10)
39826
+ _mj__UpdatedAt: Date;
39827
+
39828
+ @Field()
39829
+ @MaxLength(200)
39830
+ User: string;
39831
+
39832
+ }
39833
+
39834
+ //****************************************************************************
39835
+ // INPUT TYPE for MJ: Public Links
39836
+ //****************************************************************************
39837
+ @InputType()
39838
+ export class CreatePublicLinkInput {
39839
+ @Field({ nullable: true })
39840
+ ID?: string;
39841
+
39842
+ @Field({ nullable: true })
39843
+ ResourceType?: string;
39844
+
39845
+ @Field({ nullable: true })
39846
+ ResourceID?: string;
39847
+
39848
+ @Field({ nullable: true })
39849
+ Token?: string;
39850
+
39851
+ @Field({ nullable: true })
39852
+ PasswordHash: string | null;
39853
+
39854
+ @Field({ nullable: true })
39855
+ ExpiresAt: Date | null;
39856
+
39857
+ @Field(() => Int, { nullable: true })
39858
+ MaxViews: number | null;
39859
+
39860
+ @Field(() => Int, { nullable: true })
39861
+ CurrentViews?: number;
39862
+
39863
+ @Field({ nullable: true })
39864
+ UserID?: string;
39865
+
39866
+ @Field(() => Boolean, { nullable: true })
39867
+ IsActive?: boolean;
39868
+ }
39869
+
39870
+
39871
+ //****************************************************************************
39872
+ // INPUT TYPE for MJ: Public Links
39873
+ //****************************************************************************
39874
+ @InputType()
39875
+ export class UpdatePublicLinkInput {
39876
+ @Field()
39877
+ ID: string;
39878
+
39879
+ @Field({ nullable: true })
39880
+ ResourceType?: string;
39881
+
39882
+ @Field({ nullable: true })
39883
+ ResourceID?: string;
39884
+
39885
+ @Field({ nullable: true })
39886
+ Token?: string;
39887
+
39888
+ @Field({ nullable: true })
39889
+ PasswordHash?: string | null;
39890
+
39891
+ @Field({ nullable: true })
39892
+ ExpiresAt?: Date | null;
39893
+
39894
+ @Field(() => Int, { nullable: true })
39895
+ MaxViews?: number | null;
39896
+
39897
+ @Field(() => Int, { nullable: true })
39898
+ CurrentViews?: number;
39899
+
39900
+ @Field({ nullable: true })
39901
+ UserID?: string;
39902
+
39903
+ @Field(() => Boolean, { nullable: true })
39904
+ IsActive?: boolean;
39905
+
39906
+ @Field(() => [KeyValuePairInput], { nullable: true })
39907
+ OldValues___?: KeyValuePairInput[];
39908
+ }
39909
+
39910
+ //****************************************************************************
39911
+ // RESOLVER for MJ: Public Links
39912
+ //****************************************************************************
39913
+ @ObjectType()
39914
+ export class RunPublicLinkViewResult {
39915
+ @Field(() => [PublicLink_])
39916
+ Results: PublicLink_[];
39917
+
39918
+ @Field(() => String, {nullable: true})
39919
+ UserViewRunID?: string;
39920
+
39921
+ @Field(() => Int, {nullable: true})
39922
+ RowCount: number;
39923
+
39924
+ @Field(() => Int, {nullable: true})
39925
+ TotalRowCount: number;
39926
+
39927
+ @Field(() => Int, {nullable: true})
39928
+ ExecutionTime: number;
39929
+
39930
+ @Field({nullable: true})
39931
+ ErrorMessage?: string;
39932
+
39933
+ @Field(() => Boolean, {nullable: false})
39934
+ Success: boolean;
39935
+ }
39936
+
39937
+ @Resolver(PublicLink_)
39938
+ export class PublicLinkResolver extends ResolverBase {
39939
+ @Query(() => RunPublicLinkViewResult)
39940
+ async RunPublicLinkViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39941
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39942
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
39943
+ }
39944
+
39945
+ @Query(() => RunPublicLinkViewResult)
39946
+ async RunPublicLinkViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39947
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39948
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
39949
+ }
39950
+
39951
+ @Query(() => RunPublicLinkViewResult)
39952
+ async RunPublicLinkDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39953
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39954
+ input.EntityName = 'MJ: Public Links';
39955
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
39956
+ }
39957
+ @Query(() => PublicLink_, { nullable: true })
39958
+ async PublicLink(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<PublicLink_ | null> {
39959
+ this.CheckUserReadPermissions('MJ: Public Links', userPayload);
39960
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39961
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
39962
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwPublicLinks] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Public Links', userPayload, EntityPermissionType.Read, 'AND');
39963
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
39964
+ const result = this.MapFieldNamesToCodeNames('MJ: Public Links', rows && rows.length > 0 ? rows[0] : {})
39965
+ return result;
39966
+ }
39967
+
39968
+ @Mutation(() => PublicLink_)
39969
+ async CreatePublicLink(
39970
+ @Arg('input', () => CreatePublicLinkInput) input: CreatePublicLinkInput,
39971
+ @Ctx() { providers, userPayload }: AppContext,
39972
+ @PubSub() pubSub: PubSubEngine
39973
+ ) {
39974
+ const provider = GetReadWriteProvider(providers);
39975
+ return this.CreateRecord('MJ: Public Links', input, provider, userPayload, pubSub)
39976
+ }
39977
+
39978
+ @Mutation(() => PublicLink_)
39979
+ async UpdatePublicLink(
39980
+ @Arg('input', () => UpdatePublicLinkInput) input: UpdatePublicLinkInput,
39981
+ @Ctx() { providers, userPayload }: AppContext,
39982
+ @PubSub() pubSub: PubSubEngine
39983
+ ) {
39984
+ const provider = GetReadWriteProvider(providers);
39985
+ return this.UpdateRecord('MJ: Public Links', input, provider, userPayload, pubSub);
39986
+ }
39987
+
39988
+ @Mutation(() => PublicLink_)
39989
+ async DeletePublicLink(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
39990
+ const provider = GetReadWriteProvider(providers);
39991
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
39992
+ return this.DeleteRecord('MJ: Public Links', key, options, provider, userPayload, pubSub);
39993
+ }
39994
+
39995
+ }
39996
+
38311
39997
  //****************************************************************************
38312
39998
  // ENTITY CLASS for MJ: Artifact Types
38313
39999
  //****************************************************************************
@@ -38342,6 +40028,9 @@ export class ArtifactType_ {
38342
40028
  @Field(() => [ConversationArtifact_])
38343
40029
  MJ_ConversationArtifacts_ArtifactTypeIDArray: ConversationArtifact_[]; // Link to MJ_ConversationArtifacts
38344
40030
 
40031
+ @Field(() => [Artifact_])
40032
+ MJ_Artifacts_TypeIDArray: Artifact_[]; // Link to MJ_Artifacts
40033
+
38345
40034
  }
38346
40035
 
38347
40036
  //****************************************************************************
@@ -38459,6 +40148,17 @@ export class ArtifactTypeResolver extends ResolverBase {
38459
40148
  return result;
38460
40149
  }
38461
40150
 
40151
+ @FieldResolver(() => [Artifact_])
40152
+ async MJ_Artifacts_TypeIDArray(@Root() artifacttype_: ArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
40153
+ this.CheckUserReadPermissions('MJ: Artifacts', userPayload);
40154
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
40155
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
40156
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifacts] WHERE [TypeID]='${artifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifacts', userPayload, EntityPermissionType.Read, 'AND');
40157
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
40158
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Artifacts', rows);
40159
+ return result;
40160
+ }
40161
+
38462
40162
  @Mutation(() => ArtifactType_)
38463
40163
  async CreateArtifactType(
38464
40164
  @Arg('input', () => CreateArtifactTypeInput) input: CreateArtifactTypeInput,
@@ -38663,6 +40363,218 @@ export class AIVendorTypeResolver extends ResolverBase {
38663
40363
 
38664
40364
  }
38665
40365
 
40366
+ //****************************************************************************
40367
+ // ENTITY CLASS for MJ: Artifacts
40368
+ //****************************************************************************
40369
+ @ObjectType({ description: `Independent content items (code, documents, charts) that can be linked to multiple conversations and collections. Supports versioning and sharing.` })
40370
+ export class Artifact_ {
40371
+ @Field()
40372
+ @MaxLength(16)
40373
+ ID: string;
40374
+
40375
+ @Field()
40376
+ @MaxLength(16)
40377
+ EnvironmentID: string;
40378
+
40379
+ @Field({description: `Display name for the artifact`})
40380
+ @MaxLength(510)
40381
+ Name: string;
40382
+
40383
+ @Field({nullable: true, description: `Detailed description of the artifact contents and purpose`})
40384
+ Description?: string;
40385
+
40386
+ @Field()
40387
+ @MaxLength(16)
40388
+ TypeID: string;
40389
+
40390
+ @Field({nullable: true, description: `User comments about the artifact`})
40391
+ Comments?: string;
40392
+
40393
+ @Field()
40394
+ @MaxLength(16)
40395
+ UserID: string;
40396
+
40397
+ @Field()
40398
+ @MaxLength(10)
40399
+ _mj__CreatedAt: Date;
40400
+
40401
+ @Field()
40402
+ @MaxLength(10)
40403
+ _mj__UpdatedAt: Date;
40404
+
40405
+ @Field()
40406
+ @MaxLength(510)
40407
+ Environment: string;
40408
+
40409
+ @Field()
40410
+ @MaxLength(200)
40411
+ Type: string;
40412
+
40413
+ @Field()
40414
+ @MaxLength(200)
40415
+ User: string;
40416
+
40417
+ @Field(() => [ArtifactVersion_])
40418
+ MJ_ArtifactVersions_ArtifactIDArray: ArtifactVersion_[]; // Link to MJ_ArtifactVersions
40419
+
40420
+ }
40421
+
40422
+ //****************************************************************************
40423
+ // INPUT TYPE for MJ: Artifacts
40424
+ //****************************************************************************
40425
+ @InputType()
40426
+ export class CreateArtifactInput {
40427
+ @Field({ nullable: true })
40428
+ ID?: string;
40429
+
40430
+ @Field({ nullable: true })
40431
+ EnvironmentID?: string;
40432
+
40433
+ @Field({ nullable: true })
40434
+ Name?: string;
40435
+
40436
+ @Field({ nullable: true })
40437
+ Description: string | null;
40438
+
40439
+ @Field({ nullable: true })
40440
+ TypeID?: string;
40441
+
40442
+ @Field({ nullable: true })
40443
+ Comments: string | null;
40444
+
40445
+ @Field({ nullable: true })
40446
+ UserID?: string;
40447
+ }
40448
+
40449
+
40450
+ //****************************************************************************
40451
+ // INPUT TYPE for MJ: Artifacts
40452
+ //****************************************************************************
40453
+ @InputType()
40454
+ export class UpdateArtifactInput {
40455
+ @Field()
40456
+ ID: string;
40457
+
40458
+ @Field({ nullable: true })
40459
+ EnvironmentID?: string;
40460
+
40461
+ @Field({ nullable: true })
40462
+ Name?: string;
40463
+
40464
+ @Field({ nullable: true })
40465
+ Description?: string | null;
40466
+
40467
+ @Field({ nullable: true })
40468
+ TypeID?: string;
40469
+
40470
+ @Field({ nullable: true })
40471
+ Comments?: string | null;
40472
+
40473
+ @Field({ nullable: true })
40474
+ UserID?: string;
40475
+
40476
+ @Field(() => [KeyValuePairInput], { nullable: true })
40477
+ OldValues___?: KeyValuePairInput[];
40478
+ }
40479
+
40480
+ //****************************************************************************
40481
+ // RESOLVER for MJ: Artifacts
40482
+ //****************************************************************************
40483
+ @ObjectType()
40484
+ export class RunArtifactViewResult {
40485
+ @Field(() => [Artifact_])
40486
+ Results: Artifact_[];
40487
+
40488
+ @Field(() => String, {nullable: true})
40489
+ UserViewRunID?: string;
40490
+
40491
+ @Field(() => Int, {nullable: true})
40492
+ RowCount: number;
40493
+
40494
+ @Field(() => Int, {nullable: true})
40495
+ TotalRowCount: number;
40496
+
40497
+ @Field(() => Int, {nullable: true})
40498
+ ExecutionTime: number;
40499
+
40500
+ @Field({nullable: true})
40501
+ ErrorMessage?: string;
40502
+
40503
+ @Field(() => Boolean, {nullable: false})
40504
+ Success: boolean;
40505
+ }
40506
+
40507
+ @Resolver(Artifact_)
40508
+ export class ArtifactResolver extends ResolverBase {
40509
+ @Query(() => RunArtifactViewResult)
40510
+ async RunArtifactViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
40511
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
40512
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
40513
+ }
40514
+
40515
+ @Query(() => RunArtifactViewResult)
40516
+ async RunArtifactViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
40517
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
40518
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
40519
+ }
40520
+
40521
+ @Query(() => RunArtifactViewResult)
40522
+ async RunArtifactDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
40523
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
40524
+ input.EntityName = 'MJ: Artifacts';
40525
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
40526
+ }
40527
+ @Query(() => Artifact_, { nullable: true })
40528
+ async Artifact(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Artifact_ | null> {
40529
+ this.CheckUserReadPermissions('MJ: Artifacts', userPayload);
40530
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
40531
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
40532
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifacts] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifacts', userPayload, EntityPermissionType.Read, 'AND');
40533
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
40534
+ const result = this.MapFieldNamesToCodeNames('MJ: Artifacts', rows && rows.length > 0 ? rows[0] : {})
40535
+ return result;
40536
+ }
40537
+
40538
+ @FieldResolver(() => [ArtifactVersion_])
40539
+ async MJ_ArtifactVersions_ArtifactIDArray(@Root() artifact_: Artifact_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
40540
+ this.CheckUserReadPermissions('MJ: Artifact Versions', userPayload);
40541
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
40542
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
40543
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactVersions] WHERE [ArtifactID]='${artifact_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Versions', userPayload, EntityPermissionType.Read, 'AND');
40544
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
40545
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Artifact Versions', rows);
40546
+ return result;
40547
+ }
40548
+
40549
+ @Mutation(() => Artifact_)
40550
+ async CreateArtifact(
40551
+ @Arg('input', () => CreateArtifactInput) input: CreateArtifactInput,
40552
+ @Ctx() { providers, userPayload }: AppContext,
40553
+ @PubSub() pubSub: PubSubEngine
40554
+ ) {
40555
+ const provider = GetReadWriteProvider(providers);
40556
+ return this.CreateRecord('MJ: Artifacts', input, provider, userPayload, pubSub)
40557
+ }
40558
+
40559
+ @Mutation(() => Artifact_)
40560
+ async UpdateArtifact(
40561
+ @Arg('input', () => UpdateArtifactInput) input: UpdateArtifactInput,
40562
+ @Ctx() { providers, userPayload }: AppContext,
40563
+ @PubSub() pubSub: PubSubEngine
40564
+ ) {
40565
+ const provider = GetReadWriteProvider(providers);
40566
+ return this.UpdateRecord('MJ: Artifacts', input, provider, userPayload, pubSub);
40567
+ }
40568
+
40569
+ @Mutation(() => Artifact_)
40570
+ async DeleteArtifact(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
40571
+ const provider = GetReadWriteProvider(providers);
40572
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
40573
+ return this.DeleteRecord('MJ: Artifacts', key, options, provider, userPayload, pubSub);
40574
+ }
40575
+
40576
+ }
40577
+
38666
40578
  //****************************************************************************
38667
40579
  // ENTITY CLASS for MJ: Conversation Artifacts
38668
40580
  //****************************************************************************
@@ -43676,6 +45588,584 @@ export class AIAgentRunStepResolver extends ResolverBase {
43676
45588
 
43677
45589
  }
43678
45590
 
45591
+ //****************************************************************************
45592
+ // ENTITY CLASS for MJ: Tasks
45593
+ //****************************************************************************
45594
+ @ObjectType({ description: `Core task management entity supporting multi-agent and multi-human collaboration with dependency tracking` })
45595
+ export class Task_ {
45596
+ @Field()
45597
+ @MaxLength(16)
45598
+ ID: string;
45599
+
45600
+ @Field({nullable: true})
45601
+ @MaxLength(16)
45602
+ ParentID?: string;
45603
+
45604
+ @Field({description: `Display name for the task`})
45605
+ @MaxLength(510)
45606
+ Name: string;
45607
+
45608
+ @Field({nullable: true, description: `Detailed description of the task requirements and objectives`})
45609
+ Description?: string;
45610
+
45611
+ @Field()
45612
+ @MaxLength(16)
45613
+ TypeID: string;
45614
+
45615
+ @Field()
45616
+ @MaxLength(16)
45617
+ EnvironmentID: string;
45618
+
45619
+ @Field({nullable: true})
45620
+ @MaxLength(16)
45621
+ ProjectID?: string;
45622
+
45623
+ @Field({nullable: true})
45624
+ @MaxLength(16)
45625
+ ConversationDetailID?: string;
45626
+
45627
+ @Field({nullable: true})
45628
+ @MaxLength(16)
45629
+ UserID?: string;
45630
+
45631
+ @Field({nullable: true})
45632
+ @MaxLength(16)
45633
+ AgentID?: string;
45634
+
45635
+ @Field({description: `Current status of the task (Pending, In Progress, Complete, Cancelled, Failed, Blocked, Deferred)`})
45636
+ @MaxLength(100)
45637
+ Status: string;
45638
+
45639
+ @Field(() => Int, {nullable: true, description: `Completion percentage for tracking progress (0-100)`})
45640
+ PercentComplete?: number;
45641
+
45642
+ @Field({nullable: true, description: `Due date and time for task completion`})
45643
+ @MaxLength(10)
45644
+ DueAt?: Date;
45645
+
45646
+ @Field({nullable: true, description: `Timestamp when work on the task began`})
45647
+ @MaxLength(10)
45648
+ StartedAt?: Date;
45649
+
45650
+ @Field({nullable: true, description: `Timestamp when the task was completed`})
45651
+ @MaxLength(10)
45652
+ CompletedAt?: Date;
45653
+
45654
+ @Field()
45655
+ @MaxLength(10)
45656
+ _mj__CreatedAt: Date;
45657
+
45658
+ @Field()
45659
+ @MaxLength(10)
45660
+ _mj__UpdatedAt: Date;
45661
+
45662
+ @Field({nullable: true})
45663
+ @MaxLength(510)
45664
+ Parent?: string;
45665
+
45666
+ @Field()
45667
+ @MaxLength(510)
45668
+ Type: string;
45669
+
45670
+ @Field()
45671
+ @MaxLength(510)
45672
+ Environment: string;
45673
+
45674
+ @Field({nullable: true})
45675
+ @MaxLength(510)
45676
+ Project?: string;
45677
+
45678
+ @Field({nullable: true})
45679
+ @MaxLength(200)
45680
+ User?: string;
45681
+
45682
+ @Field({nullable: true})
45683
+ @MaxLength(510)
45684
+ Agent?: string;
45685
+
45686
+ @Field(() => [TaskDependency_])
45687
+ MJ_TaskDependencies_DependsOnTaskIDArray: TaskDependency_[]; // Link to MJ_TaskDependencies
45688
+
45689
+ @Field(() => [TaskDependency_])
45690
+ MJ_TaskDependencies_TaskIDArray: TaskDependency_[]; // Link to MJ_TaskDependencies
45691
+
45692
+ @Field(() => [Task_])
45693
+ MJ_Tasks_ParentIDArray: Task_[]; // Link to MJ_Tasks
45694
+
45695
+ }
45696
+
45697
+ //****************************************************************************
45698
+ // INPUT TYPE for MJ: Tasks
45699
+ //****************************************************************************
45700
+ @InputType()
45701
+ export class CreateTaskInput {
45702
+ @Field({ nullable: true })
45703
+ ID?: string;
45704
+
45705
+ @Field({ nullable: true })
45706
+ ParentID: string | null;
45707
+
45708
+ @Field({ nullable: true })
45709
+ Name?: string;
45710
+
45711
+ @Field({ nullable: true })
45712
+ Description: string | null;
45713
+
45714
+ @Field({ nullable: true })
45715
+ TypeID?: string;
45716
+
45717
+ @Field({ nullable: true })
45718
+ EnvironmentID?: string;
45719
+
45720
+ @Field({ nullable: true })
45721
+ ProjectID: string | null;
45722
+
45723
+ @Field({ nullable: true })
45724
+ ConversationDetailID: string | null;
45725
+
45726
+ @Field({ nullable: true })
45727
+ UserID: string | null;
45728
+
45729
+ @Field({ nullable: true })
45730
+ AgentID: string | null;
45731
+
45732
+ @Field({ nullable: true })
45733
+ Status?: string;
45734
+
45735
+ @Field(() => Int, { nullable: true })
45736
+ PercentComplete?: number | null;
45737
+
45738
+ @Field({ nullable: true })
45739
+ DueAt: Date | null;
45740
+
45741
+ @Field({ nullable: true })
45742
+ StartedAt: Date | null;
45743
+
45744
+ @Field({ nullable: true })
45745
+ CompletedAt: Date | null;
45746
+ }
45747
+
45748
+
45749
+ //****************************************************************************
45750
+ // INPUT TYPE for MJ: Tasks
45751
+ //****************************************************************************
45752
+ @InputType()
45753
+ export class UpdateTaskInput {
45754
+ @Field()
45755
+ ID: string;
45756
+
45757
+ @Field({ nullable: true })
45758
+ ParentID?: string | null;
45759
+
45760
+ @Field({ nullable: true })
45761
+ Name?: string;
45762
+
45763
+ @Field({ nullable: true })
45764
+ Description?: string | null;
45765
+
45766
+ @Field({ nullable: true })
45767
+ TypeID?: string;
45768
+
45769
+ @Field({ nullable: true })
45770
+ EnvironmentID?: string;
45771
+
45772
+ @Field({ nullable: true })
45773
+ ProjectID?: string | null;
45774
+
45775
+ @Field({ nullable: true })
45776
+ ConversationDetailID?: string | null;
45777
+
45778
+ @Field({ nullable: true })
45779
+ UserID?: string | null;
45780
+
45781
+ @Field({ nullable: true })
45782
+ AgentID?: string | null;
45783
+
45784
+ @Field({ nullable: true })
45785
+ Status?: string;
45786
+
45787
+ @Field(() => Int, { nullable: true })
45788
+ PercentComplete?: number | null;
45789
+
45790
+ @Field({ nullable: true })
45791
+ DueAt?: Date | null;
45792
+
45793
+ @Field({ nullable: true })
45794
+ StartedAt?: Date | null;
45795
+
45796
+ @Field({ nullable: true })
45797
+ CompletedAt?: Date | null;
45798
+
45799
+ @Field(() => [KeyValuePairInput], { nullable: true })
45800
+ OldValues___?: KeyValuePairInput[];
45801
+ }
45802
+
45803
+ //****************************************************************************
45804
+ // RESOLVER for MJ: Tasks
45805
+ //****************************************************************************
45806
+ @ObjectType()
45807
+ export class RunTaskViewResult {
45808
+ @Field(() => [Task_])
45809
+ Results: Task_[];
45810
+
45811
+ @Field(() => String, {nullable: true})
45812
+ UserViewRunID?: string;
45813
+
45814
+ @Field(() => Int, {nullable: true})
45815
+ RowCount: number;
45816
+
45817
+ @Field(() => Int, {nullable: true})
45818
+ TotalRowCount: number;
45819
+
45820
+ @Field(() => Int, {nullable: true})
45821
+ ExecutionTime: number;
45822
+
45823
+ @Field({nullable: true})
45824
+ ErrorMessage?: string;
45825
+
45826
+ @Field(() => Boolean, {nullable: false})
45827
+ Success: boolean;
45828
+ }
45829
+
45830
+ @Resolver(Task_)
45831
+ export class TaskResolver extends ResolverBase {
45832
+ @Query(() => RunTaskViewResult)
45833
+ async RunTaskViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
45834
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
45835
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
45836
+ }
45837
+
45838
+ @Query(() => RunTaskViewResult)
45839
+ async RunTaskViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
45840
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
45841
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
45842
+ }
45843
+
45844
+ @Query(() => RunTaskViewResult)
45845
+ async RunTaskDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
45846
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
45847
+ input.EntityName = 'MJ: Tasks';
45848
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
45849
+ }
45850
+ @Query(() => Task_, { nullable: true })
45851
+ async Task(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Task_ | null> {
45852
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
45853
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
45854
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
45855
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
45856
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
45857
+ const result = this.MapFieldNamesToCodeNames('MJ: Tasks', rows && rows.length > 0 ? rows[0] : {})
45858
+ return result;
45859
+ }
45860
+
45861
+ @FieldResolver(() => [TaskDependency_])
45862
+ async MJ_TaskDependencies_DependsOnTaskIDArray(@Root() task_: Task_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
45863
+ this.CheckUserReadPermissions('MJ: Task Dependencies', userPayload);
45864
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
45865
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
45866
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTaskDependencies] WHERE [DependsOnTaskID]='${task_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Task Dependencies', userPayload, EntityPermissionType.Read, 'AND');
45867
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
45868
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Task Dependencies', rows);
45869
+ return result;
45870
+ }
45871
+
45872
+ @FieldResolver(() => [TaskDependency_])
45873
+ async MJ_TaskDependencies_TaskIDArray(@Root() task_: Task_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
45874
+ this.CheckUserReadPermissions('MJ: Task Dependencies', userPayload);
45875
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
45876
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
45877
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTaskDependencies] WHERE [TaskID]='${task_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Task Dependencies', userPayload, EntityPermissionType.Read, 'AND');
45878
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
45879
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Task Dependencies', rows);
45880
+ return result;
45881
+ }
45882
+
45883
+ @FieldResolver(() => [Task_])
45884
+ async MJ_Tasks_ParentIDArray(@Root() task_: Task_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
45885
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
45886
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
45887
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
45888
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [ParentID]='${task_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
45889
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
45890
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
45891
+ return result;
45892
+ }
45893
+
45894
+ @Mutation(() => Task_)
45895
+ async CreateTask(
45896
+ @Arg('input', () => CreateTaskInput) input: CreateTaskInput,
45897
+ @Ctx() { providers, userPayload }: AppContext,
45898
+ @PubSub() pubSub: PubSubEngine
45899
+ ) {
45900
+ const provider = GetReadWriteProvider(providers);
45901
+ return this.CreateRecord('MJ: Tasks', input, provider, userPayload, pubSub)
45902
+ }
45903
+
45904
+ @Mutation(() => Task_)
45905
+ async UpdateTask(
45906
+ @Arg('input', () => UpdateTaskInput) input: UpdateTaskInput,
45907
+ @Ctx() { providers, userPayload }: AppContext,
45908
+ @PubSub() pubSub: PubSubEngine
45909
+ ) {
45910
+ const provider = GetReadWriteProvider(providers);
45911
+ return this.UpdateRecord('MJ: Tasks', input, provider, userPayload, pubSub);
45912
+ }
45913
+
45914
+ @Mutation(() => Task_)
45915
+ async DeleteTask(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
45916
+ const provider = GetReadWriteProvider(providers);
45917
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
45918
+ return this.DeleteRecord('MJ: Tasks', key, options, provider, userPayload, pubSub);
45919
+ }
45920
+
45921
+ }
45922
+
45923
+ //****************************************************************************
45924
+ // ENTITY CLASS for MJ: Projects
45925
+ //****************************************************************************
45926
+ @ObjectType({ description: `Container for grouping related conversations around a common topic, client, or initiative. Supports nesting for sub-projects.` })
45927
+ export class Project_ {
45928
+ @Field()
45929
+ @MaxLength(16)
45930
+ ID: string;
45931
+
45932
+ @Field()
45933
+ @MaxLength(16)
45934
+ EnvironmentID: string;
45935
+
45936
+ @Field({nullable: true})
45937
+ @MaxLength(16)
45938
+ ParentID?: string;
45939
+
45940
+ @Field({description: `Display name for the project`})
45941
+ @MaxLength(510)
45942
+ Name: string;
45943
+
45944
+ @Field({nullable: true, description: `Detailed description of the project goals and scope`})
45945
+ Description?: string;
45946
+
45947
+ @Field({nullable: true, description: `Hex color code for project badges in UI (#RRGGBB format)`})
45948
+ @MaxLength(14)
45949
+ Color?: string;
45950
+
45951
+ @Field({nullable: true, description: `Font Awesome icon class for UI display`})
45952
+ @MaxLength(100)
45953
+ Icon?: string;
45954
+
45955
+ @Field(() => Boolean, {description: `Indicates if this project is archived and should be hidden from active lists`})
45956
+ IsArchived: boolean;
45957
+
45958
+ @Field()
45959
+ @MaxLength(10)
45960
+ _mj__CreatedAt: Date;
45961
+
45962
+ @Field()
45963
+ @MaxLength(10)
45964
+ _mj__UpdatedAt: Date;
45965
+
45966
+ @Field()
45967
+ @MaxLength(510)
45968
+ Environment: string;
45969
+
45970
+ @Field({nullable: true})
45971
+ @MaxLength(510)
45972
+ Parent?: string;
45973
+
45974
+ @Field(() => [Project_])
45975
+ MJ_Projects_ParentIDArray: Project_[]; // Link to MJ_Projects
45976
+
45977
+ @Field(() => [Conversation_])
45978
+ Conversations_ProjectIDArray: Conversation_[]; // Link to Conversations
45979
+
45980
+ @Field(() => [Task_])
45981
+ MJ_Tasks_ProjectIDArray: Task_[]; // Link to MJ_Tasks
45982
+
45983
+ }
45984
+
45985
+ //****************************************************************************
45986
+ // INPUT TYPE for MJ: Projects
45987
+ //****************************************************************************
45988
+ @InputType()
45989
+ export class CreateProjectInput {
45990
+ @Field({ nullable: true })
45991
+ ID?: string;
45992
+
45993
+ @Field({ nullable: true })
45994
+ EnvironmentID?: string;
45995
+
45996
+ @Field({ nullable: true })
45997
+ ParentID: string | null;
45998
+
45999
+ @Field({ nullable: true })
46000
+ Name?: string;
46001
+
46002
+ @Field({ nullable: true })
46003
+ Description: string | null;
46004
+
46005
+ @Field({ nullable: true })
46006
+ Color: string | null;
46007
+
46008
+ @Field({ nullable: true })
46009
+ Icon: string | null;
46010
+
46011
+ @Field(() => Boolean, { nullable: true })
46012
+ IsArchived?: boolean;
46013
+ }
46014
+
46015
+
46016
+ //****************************************************************************
46017
+ // INPUT TYPE for MJ: Projects
46018
+ //****************************************************************************
46019
+ @InputType()
46020
+ export class UpdateProjectInput {
46021
+ @Field()
46022
+ ID: string;
46023
+
46024
+ @Field({ nullable: true })
46025
+ EnvironmentID?: string;
46026
+
46027
+ @Field({ nullable: true })
46028
+ ParentID?: string | null;
46029
+
46030
+ @Field({ nullable: true })
46031
+ Name?: string;
46032
+
46033
+ @Field({ nullable: true })
46034
+ Description?: string | null;
46035
+
46036
+ @Field({ nullable: true })
46037
+ Color?: string | null;
46038
+
46039
+ @Field({ nullable: true })
46040
+ Icon?: string | null;
46041
+
46042
+ @Field(() => Boolean, { nullable: true })
46043
+ IsArchived?: boolean;
46044
+
46045
+ @Field(() => [KeyValuePairInput], { nullable: true })
46046
+ OldValues___?: KeyValuePairInput[];
46047
+ }
46048
+
46049
+ //****************************************************************************
46050
+ // RESOLVER for MJ: Projects
46051
+ //****************************************************************************
46052
+ @ObjectType()
46053
+ export class RunProjectViewResult {
46054
+ @Field(() => [Project_])
46055
+ Results: Project_[];
46056
+
46057
+ @Field(() => String, {nullable: true})
46058
+ UserViewRunID?: string;
46059
+
46060
+ @Field(() => Int, {nullable: true})
46061
+ RowCount: number;
46062
+
46063
+ @Field(() => Int, {nullable: true})
46064
+ TotalRowCount: number;
46065
+
46066
+ @Field(() => Int, {nullable: true})
46067
+ ExecutionTime: number;
46068
+
46069
+ @Field({nullable: true})
46070
+ ErrorMessage?: string;
46071
+
46072
+ @Field(() => Boolean, {nullable: false})
46073
+ Success: boolean;
46074
+ }
46075
+
46076
+ @Resolver(Project_)
46077
+ export class ProjectResolver extends ResolverBase {
46078
+ @Query(() => RunProjectViewResult)
46079
+ async RunProjectViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46080
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46081
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
46082
+ }
46083
+
46084
+ @Query(() => RunProjectViewResult)
46085
+ async RunProjectViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46086
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46087
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
46088
+ }
46089
+
46090
+ @Query(() => RunProjectViewResult)
46091
+ async RunProjectDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46092
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46093
+ input.EntityName = 'MJ: Projects';
46094
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
46095
+ }
46096
+ @Query(() => Project_, { nullable: true })
46097
+ async Project(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Project_ | null> {
46098
+ this.CheckUserReadPermissions('MJ: Projects', userPayload);
46099
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46100
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46101
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwProjects] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Projects', userPayload, EntityPermissionType.Read, 'AND');
46102
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46103
+ const result = this.MapFieldNamesToCodeNames('MJ: Projects', rows && rows.length > 0 ? rows[0] : {})
46104
+ return result;
46105
+ }
46106
+
46107
+ @FieldResolver(() => [Project_])
46108
+ async MJ_Projects_ParentIDArray(@Root() project_: Project_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
46109
+ this.CheckUserReadPermissions('MJ: Projects', userPayload);
46110
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46111
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46112
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwProjects] WHERE [ParentID]='${project_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Projects', userPayload, EntityPermissionType.Read, 'AND');
46113
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46114
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Projects', rows);
46115
+ return result;
46116
+ }
46117
+
46118
+ @FieldResolver(() => [Conversation_])
46119
+ async Conversations_ProjectIDArray(@Root() project_: Project_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
46120
+ this.CheckUserReadPermissions('Conversations', userPayload);
46121
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46122
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46123
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwConversations] WHERE [ProjectID]='${project_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Conversations', userPayload, EntityPermissionType.Read, 'AND');
46124
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46125
+ const result = this.ArrayMapFieldNamesToCodeNames('Conversations', rows);
46126
+ return result;
46127
+ }
46128
+
46129
+ @FieldResolver(() => [Task_])
46130
+ async MJ_Tasks_ProjectIDArray(@Root() project_: Project_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
46131
+ this.CheckUserReadPermissions('MJ: Tasks', userPayload);
46132
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46133
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46134
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTasks] WHERE [ProjectID]='${project_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tasks', userPayload, EntityPermissionType.Read, 'AND');
46135
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46136
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Tasks', rows);
46137
+ return result;
46138
+ }
46139
+
46140
+ @Mutation(() => Project_)
46141
+ async CreateProject(
46142
+ @Arg('input', () => CreateProjectInput) input: CreateProjectInput,
46143
+ @Ctx() { providers, userPayload }: AppContext,
46144
+ @PubSub() pubSub: PubSubEngine
46145
+ ) {
46146
+ const provider = GetReadWriteProvider(providers);
46147
+ return this.CreateRecord('MJ: Projects', input, provider, userPayload, pubSub)
46148
+ }
46149
+
46150
+ @Mutation(() => Project_)
46151
+ async UpdateProject(
46152
+ @Arg('input', () => UpdateProjectInput) input: UpdateProjectInput,
46153
+ @Ctx() { providers, userPayload }: AppContext,
46154
+ @PubSub() pubSub: PubSubEngine
46155
+ ) {
46156
+ const provider = GetReadWriteProvider(providers);
46157
+ return this.UpdateRecord('MJ: Projects', input, provider, userPayload, pubSub);
46158
+ }
46159
+
46160
+ @Mutation(() => Project_)
46161
+ async DeleteProject(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46162
+ const provider = GetReadWriteProvider(providers);
46163
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
46164
+ return this.DeleteRecord('MJ: Projects', key, options, provider, userPayload, pubSub);
46165
+ }
46166
+
46167
+ }
46168
+
43679
46169
  //****************************************************************************
43680
46170
  // ENTITY CLASS for MJ: Conversation Artifact Permissions
43681
46171
  //****************************************************************************
@@ -44009,6 +46499,198 @@ export class AIModelPriceUnitTypeResolver extends ResolverBase {
44009
46499
 
44010
46500
  }
44011
46501
 
46502
+ //****************************************************************************
46503
+ // ENTITY CLASS for MJ: Artifact Versions
46504
+ //****************************************************************************
46505
+ @ObjectType({ description: `Version history for artifacts, tracking all changes over time` })
46506
+ export class ArtifactVersion_ {
46507
+ @Field()
46508
+ @MaxLength(16)
46509
+ ID: string;
46510
+
46511
+ @Field()
46512
+ @MaxLength(16)
46513
+ ArtifactID: string;
46514
+
46515
+ @Field(() => Int, {description: `Sequential version number for this artifact`})
46516
+ VersionNumber: number;
46517
+
46518
+ @Field({nullable: true, description: `The content of the artifact at this version`})
46519
+ Content?: string;
46520
+
46521
+ @Field({nullable: true, description: `JSON configuration for this version`})
46522
+ Configuration?: string;
46523
+
46524
+ @Field({nullable: true, description: `User comments specific to this version`})
46525
+ Comments?: string;
46526
+
46527
+ @Field()
46528
+ @MaxLength(16)
46529
+ UserID: string;
46530
+
46531
+ @Field()
46532
+ @MaxLength(10)
46533
+ _mj__CreatedAt: Date;
46534
+
46535
+ @Field()
46536
+ @MaxLength(10)
46537
+ _mj__UpdatedAt: Date;
46538
+
46539
+ @Field()
46540
+ @MaxLength(510)
46541
+ Artifact: string;
46542
+
46543
+ @Field()
46544
+ @MaxLength(200)
46545
+ User: string;
46546
+
46547
+ }
46548
+
46549
+ //****************************************************************************
46550
+ // INPUT TYPE for MJ: Artifact Versions
46551
+ //****************************************************************************
46552
+ @InputType()
46553
+ export class CreateArtifactVersionInput {
46554
+ @Field({ nullable: true })
46555
+ ID?: string;
46556
+
46557
+ @Field({ nullable: true })
46558
+ ArtifactID?: string;
46559
+
46560
+ @Field(() => Int, { nullable: true })
46561
+ VersionNumber?: number;
46562
+
46563
+ @Field({ nullable: true })
46564
+ Content: string | null;
46565
+
46566
+ @Field({ nullable: true })
46567
+ Configuration: string | null;
46568
+
46569
+ @Field({ nullable: true })
46570
+ Comments: string | null;
46571
+
46572
+ @Field({ nullable: true })
46573
+ UserID?: string;
46574
+ }
46575
+
46576
+
46577
+ //****************************************************************************
46578
+ // INPUT TYPE for MJ: Artifact Versions
46579
+ //****************************************************************************
46580
+ @InputType()
46581
+ export class UpdateArtifactVersionInput {
46582
+ @Field()
46583
+ ID: string;
46584
+
46585
+ @Field({ nullable: true })
46586
+ ArtifactID?: string;
46587
+
46588
+ @Field(() => Int, { nullable: true })
46589
+ VersionNumber?: number;
46590
+
46591
+ @Field({ nullable: true })
46592
+ Content?: string | null;
46593
+
46594
+ @Field({ nullable: true })
46595
+ Configuration?: string | null;
46596
+
46597
+ @Field({ nullable: true })
46598
+ Comments?: string | null;
46599
+
46600
+ @Field({ nullable: true })
46601
+ UserID?: string;
46602
+
46603
+ @Field(() => [KeyValuePairInput], { nullable: true })
46604
+ OldValues___?: KeyValuePairInput[];
46605
+ }
46606
+
46607
+ //****************************************************************************
46608
+ // RESOLVER for MJ: Artifact Versions
46609
+ //****************************************************************************
46610
+ @ObjectType()
46611
+ export class RunArtifactVersionViewResult {
46612
+ @Field(() => [ArtifactVersion_])
46613
+ Results: ArtifactVersion_[];
46614
+
46615
+ @Field(() => String, {nullable: true})
46616
+ UserViewRunID?: string;
46617
+
46618
+ @Field(() => Int, {nullable: true})
46619
+ RowCount: number;
46620
+
46621
+ @Field(() => Int, {nullable: true})
46622
+ TotalRowCount: number;
46623
+
46624
+ @Field(() => Int, {nullable: true})
46625
+ ExecutionTime: number;
46626
+
46627
+ @Field({nullable: true})
46628
+ ErrorMessage?: string;
46629
+
46630
+ @Field(() => Boolean, {nullable: false})
46631
+ Success: boolean;
46632
+ }
46633
+
46634
+ @Resolver(ArtifactVersion_)
46635
+ export class ArtifactVersionResolver extends ResolverBase {
46636
+ @Query(() => RunArtifactVersionViewResult)
46637
+ async RunArtifactVersionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46638
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46639
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
46640
+ }
46641
+
46642
+ @Query(() => RunArtifactVersionViewResult)
46643
+ async RunArtifactVersionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46644
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46645
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
46646
+ }
46647
+
46648
+ @Query(() => RunArtifactVersionViewResult)
46649
+ async RunArtifactVersionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46650
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46651
+ input.EntityName = 'MJ: Artifact Versions';
46652
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
46653
+ }
46654
+ @Query(() => ArtifactVersion_, { nullable: true })
46655
+ async ArtifactVersion(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ArtifactVersion_ | null> {
46656
+ this.CheckUserReadPermissions('MJ: Artifact Versions', userPayload);
46657
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46658
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
46659
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactVersions] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Versions', userPayload, EntityPermissionType.Read, 'AND');
46660
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
46661
+ const result = this.MapFieldNamesToCodeNames('MJ: Artifact Versions', rows && rows.length > 0 ? rows[0] : {})
46662
+ return result;
46663
+ }
46664
+
46665
+ @Mutation(() => ArtifactVersion_)
46666
+ async CreateArtifactVersion(
46667
+ @Arg('input', () => CreateArtifactVersionInput) input: CreateArtifactVersionInput,
46668
+ @Ctx() { providers, userPayload }: AppContext,
46669
+ @PubSub() pubSub: PubSubEngine
46670
+ ) {
46671
+ const provider = GetReadWriteProvider(providers);
46672
+ return this.CreateRecord('MJ: Artifact Versions', input, provider, userPayload, pubSub)
46673
+ }
46674
+
46675
+ @Mutation(() => ArtifactVersion_)
46676
+ async UpdateArtifactVersion(
46677
+ @Arg('input', () => UpdateArtifactVersionInput) input: UpdateArtifactVersionInput,
46678
+ @Ctx() { providers, userPayload }: AppContext,
46679
+ @PubSub() pubSub: PubSubEngine
46680
+ ) {
46681
+ const provider = GetReadWriteProvider(providers);
46682
+ return this.UpdateRecord('MJ: Artifact Versions', input, provider, userPayload, pubSub);
46683
+ }
46684
+
46685
+ @Mutation(() => ArtifactVersion_)
46686
+ async DeleteArtifactVersion(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
46687
+ const provider = GetReadWriteProvider(providers);
46688
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
46689
+ return this.DeleteRecord('MJ: Artifact Versions', key, options, provider, userPayload, pubSub);
46690
+ }
46691
+
46692
+ }
46693
+
44012
46694
  //****************************************************************************
44013
46695
  // ENTITY CLASS for MJ: AI Agent Step Paths
44014
46696
  //****************************************************************************