@memberjunction/server 2.107.0 → 2.109.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ import { mj_core_schema } from '../config.js';
19
19
 
20
20
 
21
21
 
22
- import { ScheduledActionEntity, ScheduledActionParamEntity, ExplorerNavigationItemEntity, GeneratedCodeCategoryEntity, AIAgentModelEntity, ComponentRegistryEntity, AIAgentNoteTypeEntity, ComponentDependencyEntity, AIAgentRunEntity, AIVendorEntity, TaskTypeEntity, AIConfigurationEntity, AIAgentEntity, AIAgentStepEntity, AIModelCostEntity, AIPromptModelEntity, AIAgentTypeEntity, AIAgentNoteEntity, EnvironmentEntity, AIAgentActionEntity, TaskDependencyEntity, CollectionArtifactEntity, AIModelPriceTypeEntity, CollectionEntity, RecordLinkEntity, AIPromptEntity, AIResultCacheEntity, AIPromptCategoryEntity, AIPromptTypeEntity, CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity, DuplicateRunDetailMatchEntity, EntityDocumentSettingEntity, EntitySettingEntity, DuplicateRunEntity, DuplicateRunDetailEntity, ApplicationSettingEntity, ActionCategoryEntity, EntityActionEntity, EntityActionInvocationEntity, ActionAuthorizationEntity, EntityActionInvocationTypeEntity, ActionEntity, EntityActionFilterEntity, ActionFilterEntity, ActionContextTypeEntity, ActionResultCodeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionParamEntity, ActionLibraryEntity, LibraryEntity, ListCategoryEntity, CommunicationProviderEntity, CommunicationRunEntity, CommunicationProviderMessageTypeEntity, CommunicationLogEntity, CommunicationBaseMessageTypeEntity, TemplateEntity, TemplateCategoryEntity, TemplateContentEntity, TemplateParamEntity, TemplateContentTypeEntity, RecommendationEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationItemEntity, EntityCommunicationMessageTypeEntity, EntityCommunicationFieldEntity, RecordChangeReplayRunEntity, LibraryItemEntity, EntityRelationshipDisplayComponentEntity, EntityActionParamEntity, ResourcePermissionEntity, ResourceLinkEntity, AIAgentArtifactTypeEntity, ConversationArtifactVersionEntity, AIAgentRequestEntity, AIModelVendorEntity, AIVendorTypeDefinitionEntity, ReportUserStateEntity, QueryEntityEntity, ScheduledJobRunEntity, DashboardUserStateEntity, ComponentEntity, AccessControlRuleEntity, PublicLinkEntity, ArtifactTypeEntity, AIVendorTypeEntity, ArtifactEntity, ConversationArtifactEntity, AIAgentPromptEntity, ComponentLibraryEntity, ScheduledJobTypeEntity, DashboardUserPreferenceEntity, QueryParameterEntity, AIAgentPermissionEntity, AIAgentRelationshipEntity, ComponentLibraryLinkEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, ScheduledJobEntity, AIPromptRunEntity, AIAgentRunStepEntity, ConversationDetailArtifactEntity, TaskEntity, ProjectEntity, ConversationArtifactPermissionEntity, AIModelPriceUnitTypeEntity, ArtifactVersionEntity, AIAgentStepPathEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity, ArtifactVersionAttributeEntity } from '@memberjunction/core-entities';
22
+ import { ScheduledActionEntity, ScheduledActionParamEntity, ExplorerNavigationItemEntity, GeneratedCodeCategoryEntity, AIAgentModelEntity, ComponentRegistryEntity, AIAgentNoteTypeEntity, ComponentDependencyEntity, AIAgentRunEntity, AIVendorEntity, TaskTypeEntity, AIConfigurationEntity, AIAgentEntity, AIAgentStepEntity, AIModelCostEntity, AIPromptModelEntity, AIAgentTypeEntity, AIAgentNoteEntity, EnvironmentEntity, ArtifactPermissionEntity, AIAgentActionEntity, TaskDependencyEntity, CollectionArtifactEntity, AIModelPriceTypeEntity, CollectionEntity, RecordLinkEntity, AIPromptEntity, AIResultCacheEntity, AIPromptCategoryEntity, AIPromptTypeEntity, CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity, DuplicateRunDetailMatchEntity, EntityDocumentSettingEntity, EntitySettingEntity, DuplicateRunEntity, DuplicateRunDetailEntity, ApplicationSettingEntity, ActionCategoryEntity, EntityActionEntity, EntityActionInvocationEntity, ActionAuthorizationEntity, EntityActionInvocationTypeEntity, ActionEntity, EntityActionFilterEntity, ActionFilterEntity, ActionContextTypeEntity, ActionResultCodeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionParamEntity, ActionLibraryEntity, LibraryEntity, ListCategoryEntity, CommunicationProviderEntity, CommunicationRunEntity, CommunicationProviderMessageTypeEntity, CommunicationLogEntity, CommunicationBaseMessageTypeEntity, TemplateEntity, TemplateCategoryEntity, TemplateContentEntity, TemplateParamEntity, TemplateContentTypeEntity, RecommendationEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationItemEntity, EntityCommunicationMessageTypeEntity, EntityCommunicationFieldEntity, RecordChangeReplayRunEntity, LibraryItemEntity, EntityRelationshipDisplayComponentEntity, EntityActionParamEntity, ResourcePermissionEntity, ResourceLinkEntity, AIAgentArtifactTypeEntity, ConversationArtifactVersionEntity, AIAgentRequestEntity, AIModelVendorEntity, AIVendorTypeDefinitionEntity, ReportUserStateEntity, QueryEntityEntity, ScheduledJobRunEntity, DashboardUserStateEntity, ComponentEntity, AccessControlRuleEntity, PublicLinkEntity, ArtifactTypeEntity, AIVendorTypeEntity, ArtifactEntity, ConversationArtifactEntity, CollectionPermissionEntity, AIAgentPromptEntity, ComponentLibraryEntity, ScheduledJobTypeEntity, DashboardUserPreferenceEntity, QueryParameterEntity, AIAgentPermissionEntity, AIAgentRelationshipEntity, ComponentLibraryLinkEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, ScheduledJobEntity, AIPromptRunEntity, AIAgentRunStepEntity, ConversationDetailArtifactEntity, TaskEntity, ProjectEntity, ConversationArtifactPermissionEntity, AIModelPriceUnitTypeEntity, ArtifactVersionEntity, AIAgentStepPathEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity, ArtifactVersionAttributeEntity, AIAgentDataSourceEntity } from '@memberjunction/core-entities';
23
23
 
24
24
 
25
25
  //****************************************************************************
@@ -2963,6 +2963,10 @@ if this limit is exceeded.`})
2963
2963
  @MaxLength(16)
2964
2964
  OwnerUserID: string;
2965
2965
 
2966
+ @Field({description: `Controls how the agent can be invoked: Any (default - can be top-level or sub-agent), Top-Level (only callable as primary agent), Sub-Agent (only callable as sub-agent). Used to filter available agents in tools like Sage.`})
2967
+ @MaxLength(40)
2968
+ InvocationMode: string;
2969
+
2966
2970
  @Field({nullable: true})
2967
2971
  @MaxLength(510)
2968
2972
  Parent?: string;
@@ -3011,6 +3015,9 @@ if this limit is exceeded.`})
3011
3015
  @Field(() => [MJAIAgentPermission_])
3012
3016
  MJ_AIAgentPermissions_AgentIDArray: MJAIAgentPermission_[]; // Link to MJ_AIAgentPermissions
3013
3017
 
3018
+ @Field(() => [MJAIAgentDataSource_])
3019
+ MJ_AIAgentDataSources_AgentIDArray: MJAIAgentDataSource_[]; // Link to MJ_AIAgentDataSources
3020
+
3014
3021
  @Field(() => [MJAIAgentNote_])
3015
3022
  AIAgentNotes_AgentIDArray: MJAIAgentNote_[]; // Link to AIAgentNotes
3016
3023
 
@@ -3158,6 +3165,9 @@ export class CreateMJAIAgentInput {
3158
3165
 
3159
3166
  @Field({ nullable: true })
3160
3167
  OwnerUserID?: string;
3168
+
3169
+ @Field({ nullable: true })
3170
+ InvocationMode?: string;
3161
3171
  }
3162
3172
 
3163
3173
 
@@ -3277,6 +3287,9 @@ export class UpdateMJAIAgentInput {
3277
3287
  @Field({ nullable: true })
3278
3288
  OwnerUserID?: string;
3279
3289
 
3290
+ @Field({ nullable: true })
3291
+ InvocationMode?: string;
3292
+
3280
3293
  @Field(() => [KeyValuePairInput], { nullable: true })
3281
3294
  OldValues___?: KeyValuePairInput[];
3282
3295
  }
@@ -3427,6 +3440,17 @@ export class MJAIAgentResolver extends ResolverBase {
3427
3440
  return result;
3428
3441
  }
3429
3442
 
3443
+ @FieldResolver(() => [MJAIAgentDataSource_])
3444
+ async MJ_AIAgentDataSources_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3445
+ this.CheckUserReadPermissions('MJ: AI Agent Data Sources', userPayload);
3446
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
3447
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3448
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentDataSources] WHERE [AgentID]='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Data Sources', userPayload, EntityPermissionType.Read, 'AND');
3449
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
3450
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Data Sources', rows);
3451
+ return result;
3452
+ }
3453
+
3430
3454
  @FieldResolver(() => [MJAIAgentNote_])
3431
3455
  async AIAgentNotes_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
3432
3456
  this.CheckUserReadPermissions('AI Agent Notes', userPayload);
@@ -5104,6 +5128,212 @@ export class MJEnvironmentResolver extends ResolverBase {
5104
5128
 
5105
5129
  }
5106
5130
 
5131
+ //****************************************************************************
5132
+ // ENTITY CLASS for MJ: Artifact Permissions
5133
+ //****************************************************************************
5134
+ @ObjectType({ description: `Manages user permissions for artifacts with granular access control (Read, Edit, Delete, Share)` })
5135
+ export class MJArtifactPermission_ {
5136
+ @Field()
5137
+ @MaxLength(16)
5138
+ ID: string;
5139
+
5140
+ @Field()
5141
+ @MaxLength(16)
5142
+ ArtifactID: string;
5143
+
5144
+ @Field()
5145
+ @MaxLength(16)
5146
+ UserID: string;
5147
+
5148
+ @Field(() => Boolean, {description: `Whether the user can view/read the artifact`})
5149
+ CanRead: boolean;
5150
+
5151
+ @Field(() => Boolean, {description: `Whether the user can modify the artifact or create new versions`})
5152
+ CanEdit: boolean;
5153
+
5154
+ @Field(() => Boolean, {description: `Whether the user can delete the artifact`})
5155
+ CanDelete: boolean;
5156
+
5157
+ @Field(() => Boolean, {description: `Whether the user can share the artifact with other users`})
5158
+ CanShare: boolean;
5159
+
5160
+ @Field({nullable: true, description: `Foreign key to the User who shared this artifact (if shared)`})
5161
+ @MaxLength(16)
5162
+ SharedByUserID?: string;
5163
+
5164
+ @Field()
5165
+ @MaxLength(10)
5166
+ _mj__CreatedAt: Date;
5167
+
5168
+ @Field()
5169
+ @MaxLength(10)
5170
+ _mj__UpdatedAt: Date;
5171
+
5172
+ @Field()
5173
+ @MaxLength(510)
5174
+ Artifact: string;
5175
+
5176
+ @Field()
5177
+ @MaxLength(200)
5178
+ User: string;
5179
+
5180
+ @Field({nullable: true})
5181
+ @MaxLength(200)
5182
+ SharedByUser?: string;
5183
+
5184
+ }
5185
+
5186
+ //****************************************************************************
5187
+ // INPUT TYPE for MJ: Artifact Permissions
5188
+ //****************************************************************************
5189
+ @InputType()
5190
+ export class CreateMJArtifactPermissionInput {
5191
+ @Field({ nullable: true })
5192
+ ID?: string;
5193
+
5194
+ @Field({ nullable: true })
5195
+ ArtifactID?: string;
5196
+
5197
+ @Field({ nullable: true })
5198
+ UserID?: string;
5199
+
5200
+ @Field(() => Boolean, { nullable: true })
5201
+ CanRead?: boolean;
5202
+
5203
+ @Field(() => Boolean, { nullable: true })
5204
+ CanEdit?: boolean;
5205
+
5206
+ @Field(() => Boolean, { nullable: true })
5207
+ CanDelete?: boolean;
5208
+
5209
+ @Field(() => Boolean, { nullable: true })
5210
+ CanShare?: boolean;
5211
+
5212
+ @Field({ nullable: true })
5213
+ SharedByUserID: string | null;
5214
+ }
5215
+
5216
+
5217
+ //****************************************************************************
5218
+ // INPUT TYPE for MJ: Artifact Permissions
5219
+ //****************************************************************************
5220
+ @InputType()
5221
+ export class UpdateMJArtifactPermissionInput {
5222
+ @Field()
5223
+ ID: string;
5224
+
5225
+ @Field({ nullable: true })
5226
+ ArtifactID?: string;
5227
+
5228
+ @Field({ nullable: true })
5229
+ UserID?: string;
5230
+
5231
+ @Field(() => Boolean, { nullable: true })
5232
+ CanRead?: boolean;
5233
+
5234
+ @Field(() => Boolean, { nullable: true })
5235
+ CanEdit?: boolean;
5236
+
5237
+ @Field(() => Boolean, { nullable: true })
5238
+ CanDelete?: boolean;
5239
+
5240
+ @Field(() => Boolean, { nullable: true })
5241
+ CanShare?: boolean;
5242
+
5243
+ @Field({ nullable: true })
5244
+ SharedByUserID?: string | null;
5245
+
5246
+ @Field(() => [KeyValuePairInput], { nullable: true })
5247
+ OldValues___?: KeyValuePairInput[];
5248
+ }
5249
+
5250
+ //****************************************************************************
5251
+ // RESOLVER for MJ: Artifact Permissions
5252
+ //****************************************************************************
5253
+ @ObjectType()
5254
+ export class RunMJArtifactPermissionViewResult {
5255
+ @Field(() => [MJArtifactPermission_])
5256
+ Results: MJArtifactPermission_[];
5257
+
5258
+ @Field(() => String, {nullable: true})
5259
+ UserViewRunID?: string;
5260
+
5261
+ @Field(() => Int, {nullable: true})
5262
+ RowCount: number;
5263
+
5264
+ @Field(() => Int, {nullable: true})
5265
+ TotalRowCount: number;
5266
+
5267
+ @Field(() => Int, {nullable: true})
5268
+ ExecutionTime: number;
5269
+
5270
+ @Field({nullable: true})
5271
+ ErrorMessage?: string;
5272
+
5273
+ @Field(() => Boolean, {nullable: false})
5274
+ Success: boolean;
5275
+ }
5276
+
5277
+ @Resolver(MJArtifactPermission_)
5278
+ export class MJArtifactPermissionResolver extends ResolverBase {
5279
+ @Query(() => RunMJArtifactPermissionViewResult)
5280
+ async RunMJArtifactPermissionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5281
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5282
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
5283
+ }
5284
+
5285
+ @Query(() => RunMJArtifactPermissionViewResult)
5286
+ async RunMJArtifactPermissionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5287
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5288
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
5289
+ }
5290
+
5291
+ @Query(() => RunMJArtifactPermissionViewResult)
5292
+ async RunMJArtifactPermissionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5293
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5294
+ input.EntityName = 'MJ: Artifact Permissions';
5295
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
5296
+ }
5297
+ @Query(() => MJArtifactPermission_, { nullable: true })
5298
+ async MJArtifactPermission(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactPermission_ | null> {
5299
+ this.CheckUserReadPermissions('MJ: Artifact Permissions', userPayload);
5300
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
5301
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
5302
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactPermissions] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Permissions', userPayload, EntityPermissionType.Read, 'AND');
5303
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
5304
+ const result = this.MapFieldNamesToCodeNames('MJ: Artifact Permissions', rows && rows.length > 0 ? rows[0] : {})
5305
+ return result;
5306
+ }
5307
+
5308
+ @Mutation(() => MJArtifactPermission_)
5309
+ async CreateMJArtifactPermission(
5310
+ @Arg('input', () => CreateMJArtifactPermissionInput) input: CreateMJArtifactPermissionInput,
5311
+ @Ctx() { providers, userPayload }: AppContext,
5312
+ @PubSub() pubSub: PubSubEngine
5313
+ ) {
5314
+ const provider = GetReadWriteProvider(providers);
5315
+ return this.CreateRecord('MJ: Artifact Permissions', input, provider, userPayload, pubSub)
5316
+ }
5317
+
5318
+ @Mutation(() => MJArtifactPermission_)
5319
+ async UpdateMJArtifactPermission(
5320
+ @Arg('input', () => UpdateMJArtifactPermissionInput) input: UpdateMJArtifactPermissionInput,
5321
+ @Ctx() { providers, userPayload }: AppContext,
5322
+ @PubSub() pubSub: PubSubEngine
5323
+ ) {
5324
+ const provider = GetReadWriteProvider(providers);
5325
+ return this.UpdateRecord('MJ: Artifact Permissions', input, provider, userPayload, pubSub);
5326
+ }
5327
+
5328
+ @Mutation(() => MJArtifactPermission_)
5329
+ async DeleteMJArtifactPermission(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5330
+ const provider = GetReadWriteProvider(providers);
5331
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
5332
+ return this.DeleteRecord('MJ: Artifact Permissions', key, options, provider, userPayload, pubSub);
5333
+ }
5334
+
5335
+ }
5336
+
5107
5337
  //****************************************************************************
5108
5338
  // ENTITY CLASS for AI Agent Actions
5109
5339
  //****************************************************************************
@@ -5139,6 +5369,24 @@ export class MJAIAgentAction_ {
5139
5369
  @Field(() => Int, {nullable: true, description: `Maximum number of times this action can be executed per agent run`})
5140
5370
  MaxExecutionsPerRun?: number;
5141
5371
 
5372
+ @Field(() => Int, {nullable: true, description: `Number of conversation turns before action results expire from conversation context. NULL = never expire (default). 0 = expire immediately after next turn.`})
5373
+ ResultExpirationTurns?: number;
5374
+
5375
+ @Field({description: `How to handle expired action results: None (no expiration, default), Remove (delete message entirely), Compact (reduce size via CompactMode while preserving key information).`})
5376
+ @MaxLength(40)
5377
+ ResultExpirationMode: string;
5378
+
5379
+ @Field({nullable: true, description: `How to compact results when ResultExpirationMode=Compact: FirstNChars (truncate to CompactLength characters, fast and free), AISummary (use LLM to intelligently summarize with CompactPromptID or Action.DefaultCompactPromptID).`})
5380
+ @MaxLength(40)
5381
+ CompactMode?: string;
5382
+
5383
+ @Field(() => Int, {nullable: true, description: `Number of characters to keep when CompactMode=FirstNChars. Required when CompactMode is FirstNChars, ignored otherwise.`})
5384
+ CompactLength?: number;
5385
+
5386
+ @Field({nullable: true, description: `Optional override for AI summarization prompt when CompactMode=AISummary. Lookup hierarchy: this field -> Action.DefaultCompactPromptID -> system default. Allows agent-specific summarization focus (e.g., technical vs. marketing perspective).`})
5387
+ @MaxLength(16)
5388
+ CompactPromptID?: string;
5389
+
5142
5390
  @Field({nullable: true})
5143
5391
  @MaxLength(510)
5144
5392
  Agent?: string;
@@ -5147,6 +5395,10 @@ export class MJAIAgentAction_ {
5147
5395
  @MaxLength(850)
5148
5396
  Action?: string;
5149
5397
 
5398
+ @Field({nullable: true})
5399
+ @MaxLength(510)
5400
+ CompactPrompt?: string;
5401
+
5150
5402
  }
5151
5403
 
5152
5404
  //****************************************************************************
@@ -5171,6 +5423,21 @@ export class CreateMJAIAgentActionInput {
5171
5423
 
5172
5424
  @Field(() => Int, { nullable: true })
5173
5425
  MaxExecutionsPerRun: number | null;
5426
+
5427
+ @Field(() => Int, { nullable: true })
5428
+ ResultExpirationTurns: number | null;
5429
+
5430
+ @Field({ nullable: true })
5431
+ ResultExpirationMode?: string;
5432
+
5433
+ @Field({ nullable: true })
5434
+ CompactMode: string | null;
5435
+
5436
+ @Field(() => Int, { nullable: true })
5437
+ CompactLength: number | null;
5438
+
5439
+ @Field({ nullable: true })
5440
+ CompactPromptID: string | null;
5174
5441
  }
5175
5442
 
5176
5443
 
@@ -5197,6 +5464,21 @@ export class UpdateMJAIAgentActionInput {
5197
5464
  @Field(() => Int, { nullable: true })
5198
5465
  MaxExecutionsPerRun?: number | null;
5199
5466
 
5467
+ @Field(() => Int, { nullable: true })
5468
+ ResultExpirationTurns?: number | null;
5469
+
5470
+ @Field({ nullable: true })
5471
+ ResultExpirationMode?: string;
5472
+
5473
+ @Field({ nullable: true })
5474
+ CompactMode?: string | null;
5475
+
5476
+ @Field(() => Int, { nullable: true })
5477
+ CompactLength?: number | null;
5478
+
5479
+ @Field({ nullable: true })
5480
+ CompactPromptID?: string | null;
5481
+
5200
5482
  @Field(() => [KeyValuePairInput], { nullable: true })
5201
5483
  OldValues___?: KeyValuePairInput[];
5202
5484
  }
@@ -5823,6 +6105,10 @@ export class MJCollection_ {
5823
6105
  @MaxLength(10)
5824
6106
  _mj__UpdatedAt: Date;
5825
6107
 
6108
+ @Field({nullable: true, description: `The user who owns this collection and has full permissions`})
6109
+ @MaxLength(16)
6110
+ OwnerID?: string;
6111
+
5826
6112
  @Field()
5827
6113
  @MaxLength(510)
5828
6114
  Environment: string;
@@ -5831,6 +6117,10 @@ export class MJCollection_ {
5831
6117
  @MaxLength(510)
5832
6118
  Parent?: string;
5833
6119
 
6120
+ @Field({nullable: true})
6121
+ @MaxLength(200)
6122
+ Owner?: string;
6123
+
5834
6124
  @Field({nullable: true})
5835
6125
  @MaxLength(16)
5836
6126
  RootParentID?: string;
@@ -5838,6 +6128,9 @@ export class MJCollection_ {
5838
6128
  @Field(() => [MJCollectionArtifact_])
5839
6129
  MJ_CollectionArtifacts_CollectionIDArray: MJCollectionArtifact_[]; // Link to MJ_CollectionArtifacts
5840
6130
 
6131
+ @Field(() => [MJCollectionPermission_])
6132
+ MJ_CollectionPermissions_CollectionIDArray: MJCollectionPermission_[]; // Link to MJ_CollectionPermissions
6133
+
5841
6134
  @Field(() => [MJCollection_])
5842
6135
  MJ_Collections_ParentIDArray: MJCollection_[]; // Link to MJ_Collections
5843
6136
 
@@ -5871,6 +6164,9 @@ export class CreateMJCollectionInput {
5871
6164
 
5872
6165
  @Field(() => Int, { nullable: true })
5873
6166
  Sequence: number | null;
6167
+
6168
+ @Field({ nullable: true })
6169
+ OwnerID: string | null;
5874
6170
  }
5875
6171
 
5876
6172
 
@@ -5903,6 +6199,9 @@ export class UpdateMJCollectionInput {
5903
6199
  @Field(() => Int, { nullable: true })
5904
6200
  Sequence?: number | null;
5905
6201
 
6202
+ @Field({ nullable: true })
6203
+ OwnerID?: string | null;
6204
+
5906
6205
  @Field(() => [KeyValuePairInput], { nullable: true })
5907
6206
  OldValues___?: KeyValuePairInput[];
5908
6207
  }
@@ -5976,6 +6275,17 @@ export class MJCollectionResolver extends ResolverBase {
5976
6275
  return result;
5977
6276
  }
5978
6277
 
6278
+ @FieldResolver(() => [MJCollectionPermission_])
6279
+ async MJ_CollectionPermissions_CollectionIDArray(@Root() mjcollection_: MJCollection_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6280
+ this.CheckUserReadPermissions('MJ: Collection Permissions', userPayload);
6281
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
6282
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
6283
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollectionPermissions] WHERE [CollectionID]='${mjcollection_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collection Permissions', userPayload, EntityPermissionType.Read, 'AND');
6284
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
6285
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collection Permissions', rows);
6286
+ return result;
6287
+ }
6288
+
5979
6289
  @FieldResolver(() => [MJCollection_])
5980
6290
  async MJ_Collections_ParentIDArray(@Root() mjcollection_: MJCollection_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
5981
6291
  this.CheckUserReadPermissions('MJ: Collections', userPayload);
@@ -6436,6 +6746,9 @@ export class MJAIPrompt_ {
6436
6746
  @Field(() => [MJAIAgentType_])
6437
6747
  MJ_AIAgentTypes_SystemPromptIDArray: MJAIAgentType_[]; // Link to MJ_AIAgentTypes
6438
6748
 
6749
+ @Field(() => [MJAIAgentAction_])
6750
+ AIAgentActions_CompactPromptIDArray: MJAIAgentAction_[]; // Link to AIAgentActions
6751
+
6439
6752
  @Field(() => [MJAIConfiguration_])
6440
6753
  MJ_AIConfigurations_DefaultPromptForContextSummarizationIDArray: MJAIConfiguration_[]; // Link to MJ_AIConfigurations
6441
6754
 
@@ -6457,6 +6770,9 @@ export class MJAIPrompt_ {
6457
6770
  @Field(() => [MJAIAgent_])
6458
6771
  AIAgents_ContextCompressionPromptIDArray: MJAIAgent_[]; // Link to AIAgents
6459
6772
 
6773
+ @Field(() => [MJAction_])
6774
+ Actions_DefaultCompactPromptIDArray: MJAction_[]; // Link to Actions
6775
+
6460
6776
  }
6461
6777
 
6462
6778
  //****************************************************************************
@@ -6860,6 +7176,17 @@ export class MJAIPromptResolver extends ResolverBase {
6860
7176
  return result;
6861
7177
  }
6862
7178
 
7179
+ @FieldResolver(() => [MJAIAgentAction_])
7180
+ async AIAgentActions_CompactPromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
7181
+ this.CheckUserReadPermissions('AI Agent Actions', userPayload);
7182
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
7183
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
7184
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentActions] WHERE [CompactPromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Actions', userPayload, EntityPermissionType.Read, 'AND');
7185
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
7186
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agent Actions', rows);
7187
+ return result;
7188
+ }
7189
+
6863
7190
  @FieldResolver(() => [MJAIConfiguration_])
6864
7191
  async MJ_AIConfigurations_DefaultPromptForContextSummarizationIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
6865
7192
  this.CheckUserReadPermissions('MJ: AI Configurations', userPayload);
@@ -6937,6 +7264,17 @@ export class MJAIPromptResolver extends ResolverBase {
6937
7264
  return result;
6938
7265
  }
6939
7266
 
7267
+ @FieldResolver(() => [MJAction_])
7268
+ async Actions_DefaultCompactPromptIDArray(@Root() mjaiprompt_: MJAIPrompt_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
7269
+ this.CheckUserReadPermissions('Actions', userPayload);
7270
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
7271
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
7272
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwActions] WHERE [DefaultCompactPromptID]='${mjaiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'Actions', userPayload, EntityPermissionType.Read, 'AND');
7273
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
7274
+ const result = this.ArrayMapFieldNamesToCodeNames('Actions', rows);
7275
+ return result;
7276
+ }
7277
+
6940
7278
  @Mutation(() => MJAIPrompt_)
6941
7279
  async CreateMJAIPrompt(
6942
7280
  @Arg('input', () => CreateMJAIPromptInput) input: CreateMJAIPromptInput,
@@ -10878,12 +11216,12 @@ export class MJEntity_ {
10878
11216
  @Field(() => [MJQueryEntity_])
10879
11217
  QueryEntities_EntityIDArray: MJQueryEntity_[]; // Link to QueryEntities
10880
11218
 
10881
- @Field(() => [MJAccessControlRule_])
10882
- MJ_AccessControlRules_EntityIDArray: MJAccessControlRule_[]; // Link to MJ_AccessControlRules
10883
-
10884
11219
  @Field(() => [MJRecordLink_])
10885
11220
  MJ_RecordLinks_SourceEntityIDArray: MJRecordLink_[]; // Link to MJ_RecordLinks
10886
11221
 
11222
+ @Field(() => [MJAccessControlRule_])
11223
+ MJ_AccessControlRules_EntityIDArray: MJAccessControlRule_[]; // Link to MJ_AccessControlRules
11224
+
10887
11225
  @Field(() => [MJGeneratedCode_])
10888
11226
  GeneratedCodes_LinkedEntityIDArray: MJGeneratedCode_[]; // Link to GeneratedCodes
10889
11227
 
@@ -11691,25 +12029,25 @@ export class MJEntityResolverBase extends ResolverBase {
11691
12029
  return result;
11692
12030
  }
11693
12031
 
11694
- @FieldResolver(() => [MJAccessControlRule_])
11695
- async MJ_AccessControlRules_EntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11696
- this.CheckUserReadPermissions('MJ: Access Control Rules', userPayload);
12032
+ @FieldResolver(() => [MJRecordLink_])
12033
+ async MJ_RecordLinks_SourceEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12034
+ this.CheckUserReadPermissions('MJ: Record Links', userPayload);
11697
12035
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11698
12036
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
11699
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAccessControlRules] WHERE [EntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Access Control Rules', userPayload, EntityPermissionType.Read, 'AND');
12037
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecordLinks] WHERE [SourceEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Record Links', userPayload, EntityPermissionType.Read, 'AND');
11700
12038
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
11701
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Access Control Rules', rows);
12039
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Record Links', rows);
11702
12040
  return result;
11703
12041
  }
11704
12042
 
11705
- @FieldResolver(() => [MJRecordLink_])
11706
- async MJ_RecordLinks_SourceEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
11707
- this.CheckUserReadPermissions('MJ: Record Links', userPayload);
12043
+ @FieldResolver(() => [MJAccessControlRule_])
12044
+ async MJ_AccessControlRules_EntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12045
+ this.CheckUserReadPermissions('MJ: Access Control Rules', userPayload);
11708
12046
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
11709
12047
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
11710
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecordLinks] WHERE [SourceEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Record Links', userPayload, EntityPermissionType.Read, 'AND');
12048
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAccessControlRules] WHERE [EntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Access Control Rules', userPayload, EntityPermissionType.Read, 'AND');
11711
12049
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
11712
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Record Links', rows);
12050
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Access Control Rules', rows);
11713
12051
  return result;
11714
12052
  }
11715
12053
 
@@ -11968,11 +12306,14 @@ export class MJUser_ {
11968
12306
  @Field(() => [MJPublicLink_])
11969
12307
  MJ_PublicLinks_UserIDArray: MJPublicLink_[]; // Link to MJ_PublicLinks
11970
12308
 
12309
+ @Field(() => [MJScheduledJobRun_])
12310
+ MJ_ScheduledJobRuns_ExecutedByUserIDArray: MJScheduledJobRun_[]; // Link to MJ_ScheduledJobRuns
12311
+
11971
12312
  @Field(() => [MJScheduledJob_])
11972
12313
  MJ_ScheduledJobs_NotifyUserIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
11973
12314
 
11974
- @Field(() => [MJScheduledJobRun_])
11975
- MJ_ScheduledJobRuns_ExecutedByUserIDArray: MJScheduledJobRun_[]; // Link to MJ_ScheduledJobRuns
12315
+ @Field(() => [MJArtifactPermission_])
12316
+ MJ_ArtifactPermissions_UserIDArray: MJArtifactPermission_[]; // Link to MJ_ArtifactPermissions
11976
12317
 
11977
12318
  @Field(() => [MJResourcePermission_])
11978
12319
  ResourcePermissions_UserIDArray: MJResourcePermission_[]; // Link to ResourcePermissions
@@ -11992,12 +12333,24 @@ export class MJUser_ {
11992
12333
  @Field(() => [MJScheduledJob_])
11993
12334
  MJ_ScheduledJobs_OwnerUserIDArray: MJScheduledJob_[]; // Link to MJ_ScheduledJobs
11994
12335
 
12336
+ @Field(() => [MJCollectionPermission_])
12337
+ MJ_CollectionPermissions_SharedByUserIDArray: MJCollectionPermission_[]; // Link to MJ_CollectionPermissions
12338
+
12339
+ @Field(() => [MJArtifactPermission_])
12340
+ MJ_ArtifactPermissions_SharedByUserIDArray: MJArtifactPermission_[]; // Link to MJ_ArtifactPermissions
12341
+
11995
12342
  @Field(() => [MJAIAgentRun_])
11996
12343
  MJ_AIAgentRuns_UserIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
11997
12344
 
11998
12345
  @Field(() => [MJAIAgentPermission_])
11999
12346
  MJ_AIAgentPermissions_UserIDArray: MJAIAgentPermission_[]; // Link to MJ_AIAgentPermissions
12000
12347
 
12348
+ @Field(() => [MJCollection_])
12349
+ MJ_Collections_OwnerIDArray: MJCollection_[]; // Link to MJ_Collections
12350
+
12351
+ @Field(() => [MJCollectionPermission_])
12352
+ MJ_CollectionPermissions_UserIDArray: MJCollectionPermission_[]; // Link to MJ_CollectionPermissions
12353
+
12001
12354
  @Field(() => [MJTask_])
12002
12355
  MJ_Tasks_UserIDArray: MJTask_[]; // Link to MJ_Tasks
12003
12356
 
@@ -12603,6 +12956,17 @@ export class MJUserResolverBase extends ResolverBase {
12603
12956
  return result;
12604
12957
  }
12605
12958
 
12959
+ @FieldResolver(() => [MJScheduledJobRun_])
12960
+ async MJ_ScheduledJobRuns_ExecutedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12961
+ this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
12962
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12963
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12964
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ExecutedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
12965
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12966
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows);
12967
+ return result;
12968
+ }
12969
+
12606
12970
  @FieldResolver(() => [MJScheduledJob_])
12607
12971
  async MJ_ScheduledJobs_NotifyUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12608
12972
  this.CheckUserReadPermissions('MJ: Scheduled Jobs', userPayload);
@@ -12614,14 +12978,14 @@ export class MJUserResolverBase extends ResolverBase {
12614
12978
  return result;
12615
12979
  }
12616
12980
 
12617
- @FieldResolver(() => [MJScheduledJobRun_])
12618
- async MJ_ScheduledJobRuns_ExecutedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12619
- this.CheckUserReadPermissions('MJ: Scheduled Job Runs', userPayload);
12981
+ @FieldResolver(() => [MJArtifactPermission_])
12982
+ async MJ_ArtifactPermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12983
+ this.CheckUserReadPermissions('MJ: Artifact Permissions', userPayload);
12620
12984
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12621
12985
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12622
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwScheduledJobRuns] WHERE [ExecutedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Scheduled Job Runs', userPayload, EntityPermissionType.Read, 'AND');
12986
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactPermissions] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Permissions', userPayload, EntityPermissionType.Read, 'AND');
12623
12987
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
12624
- const result = this.ArrayMapFieldNamesToCodeNames('MJ: Scheduled Job Runs', rows);
12988
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Artifact Permissions', rows);
12625
12989
  return result;
12626
12990
  }
12627
12991
 
@@ -12691,6 +13055,28 @@ export class MJUserResolverBase extends ResolverBase {
12691
13055
  return result;
12692
13056
  }
12693
13057
 
13058
+ @FieldResolver(() => [MJCollectionPermission_])
13059
+ async MJ_CollectionPermissions_SharedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13060
+ this.CheckUserReadPermissions('MJ: Collection Permissions', userPayload);
13061
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13062
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13063
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollectionPermissions] WHERE [SharedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collection Permissions', userPayload, EntityPermissionType.Read, 'AND');
13064
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13065
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collection Permissions', rows);
13066
+ return result;
13067
+ }
13068
+
13069
+ @FieldResolver(() => [MJArtifactPermission_])
13070
+ async MJ_ArtifactPermissions_SharedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13071
+ this.CheckUserReadPermissions('MJ: Artifact Permissions', userPayload);
13072
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13073
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13074
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactPermissions] WHERE [SharedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Permissions', userPayload, EntityPermissionType.Read, 'AND');
13075
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13076
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Artifact Permissions', rows);
13077
+ return result;
13078
+ }
13079
+
12694
13080
  @FieldResolver(() => [MJAIAgentRun_])
12695
13081
  async MJ_AIAgentRuns_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12696
13082
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
@@ -12713,6 +13099,28 @@ export class MJUserResolverBase extends ResolverBase {
12713
13099
  return result;
12714
13100
  }
12715
13101
 
13102
+ @FieldResolver(() => [MJCollection_])
13103
+ async MJ_Collections_OwnerIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13104
+ this.CheckUserReadPermissions('MJ: Collections', userPayload);
13105
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13106
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13107
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollections] WHERE [OwnerID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collections', userPayload, EntityPermissionType.Read, 'AND');
13108
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13109
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collections', rows);
13110
+ return result;
13111
+ }
13112
+
13113
+ @FieldResolver(() => [MJCollectionPermission_])
13114
+ async MJ_CollectionPermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
13115
+ this.CheckUserReadPermissions('MJ: Collection Permissions', userPayload);
13116
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
13117
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13118
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollectionPermissions] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collection Permissions', userPayload, EntityPermissionType.Read, 'AND');
13119
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
13120
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Collection Permissions', rows);
13121
+ return result;
13122
+ }
13123
+
12716
13124
  @FieldResolver(() => [MJTask_])
12717
13125
  async MJ_Tasks_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12718
13126
  this.CheckUserReadPermissions('MJ: Tasks', userPayload);
@@ -23501,6 +23909,9 @@ export class MJConversationDetail_ {
23501
23909
  @MaxLength(40)
23502
23910
  Status: string;
23503
23911
 
23912
+ @Field({nullable: true, description: `JSON array of suggested responses that can be displayed to the user for quick replies. Each response object contains: text (display text), allowInput (boolean), iconClass (optional Font Awesome class), and data (optional payload).`})
23913
+ SuggestedResponses?: string;
23914
+
23504
23915
  @Field({nullable: true})
23505
23916
  @MaxLength(510)
23506
23917
  Conversation?: string;
@@ -23599,6 +24010,9 @@ export class CreateMJConversationDetailInput {
23599
24010
 
23600
24011
  @Field({ nullable: true })
23601
24012
  Status?: string;
24013
+
24014
+ @Field({ nullable: true })
24015
+ SuggestedResponses: string | null;
23602
24016
  }
23603
24017
 
23604
24018
 
@@ -23664,6 +24078,9 @@ export class UpdateMJConversationDetailInput {
23664
24078
  @Field({ nullable: true })
23665
24079
  Status?: string;
23666
24080
 
24081
+ @Field({ nullable: true })
24082
+ SuggestedResponses?: string | null;
24083
+
23667
24084
  @Field(() => [KeyValuePairInput], { nullable: true })
23668
24085
  OldValues___?: KeyValuePairInput[];
23669
24086
  }
@@ -31658,6 +32075,10 @@ export class MJAction_ {
31658
32075
  @MaxLength(200)
31659
32076
  IconClass?: string;
31660
32077
 
32078
+ @Field({nullable: true, description: `Default prompt for compacting/summarizing this action's results when used by agents with CompactMode=AISummary. Action designers define how their specific results should be summarized. Can be overridden per agent in AIAgentAction.CompactPromptID.`})
32079
+ @MaxLength(16)
32080
+ DefaultCompactPromptID?: string;
32081
+
31661
32082
  @Field({nullable: true})
31662
32083
  @MaxLength(510)
31663
32084
  Category?: string;
@@ -31670,6 +32091,10 @@ export class MJAction_ {
31670
32091
  @MaxLength(850)
31671
32092
  Parent?: string;
31672
32093
 
32094
+ @Field({nullable: true})
32095
+ @MaxLength(510)
32096
+ DefaultCompactPrompt?: string;
32097
+
31673
32098
  @Field({nullable: true})
31674
32099
  @MaxLength(16)
31675
32100
  RootParentID?: string;
@@ -31773,6 +32198,9 @@ export class CreateMJActionInput {
31773
32198
 
31774
32199
  @Field({ nullable: true })
31775
32200
  IconClass: string | null;
32201
+
32202
+ @Field({ nullable: true })
32203
+ DefaultCompactPromptID: string | null;
31776
32204
  }
31777
32205
 
31778
32206
 
@@ -31841,6 +32269,9 @@ export class UpdateMJActionInput {
31841
32269
  @Field({ nullable: true })
31842
32270
  IconClass?: string | null;
31843
32271
 
32272
+ @Field({ nullable: true })
32273
+ DefaultCompactPromptID?: string | null;
32274
+
31844
32275
  @Field(() => [KeyValuePairInput], { nullable: true })
31845
32276
  OldValues___?: KeyValuePairInput[];
31846
32277
  }
@@ -41390,6 +41821,9 @@ export class MJArtifact_ {
41390
41821
  @Field(() => [MJCollectionArtifact_])
41391
41822
  MJ_CollectionArtifacts_ArtifactIDArray: MJCollectionArtifact_[]; // Link to MJ_CollectionArtifacts
41392
41823
 
41824
+ @Field(() => [MJArtifactPermission_])
41825
+ MJ_ArtifactPermissions_ArtifactIDArray: MJArtifactPermission_[]; // Link to MJ_ArtifactPermissions
41826
+
41393
41827
  }
41394
41828
 
41395
41829
  //****************************************************************************
@@ -41530,6 +41964,17 @@ export class MJArtifactResolver extends ResolverBase {
41530
41964
  return result;
41531
41965
  }
41532
41966
 
41967
+ @FieldResolver(() => [MJArtifactPermission_])
41968
+ async MJ_ArtifactPermissions_ArtifactIDArray(@Root() mjartifact_: MJArtifact_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
41969
+ this.CheckUserReadPermissions('MJ: Artifact Permissions', userPayload);
41970
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
41971
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
41972
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactPermissions] WHERE [ArtifactID]='${mjartifact_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Permissions', userPayload, EntityPermissionType.Read, 'AND');
41973
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
41974
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Artifact Permissions', rows);
41975
+ return result;
41976
+ }
41977
+
41533
41978
  @Mutation(() => MJArtifact_)
41534
41979
  async CreateMJArtifact(
41535
41980
  @Arg('input', () => CreateMJArtifactInput) input: CreateMJArtifactInput,
@@ -41795,6 +42240,212 @@ export class MJConversationArtifactResolver extends ResolverBase {
41795
42240
 
41796
42241
  }
41797
42242
 
42243
+ //****************************************************************************
42244
+ // ENTITY CLASS for MJ: Collection Permissions
42245
+ //****************************************************************************
42246
+ @ObjectType({ description: `Manages sharing permissions for collections, allowing granular access control` })
42247
+ export class MJCollectionPermission_ {
42248
+ @Field()
42249
+ @MaxLength(16)
42250
+ ID: string;
42251
+
42252
+ @Field()
42253
+ @MaxLength(16)
42254
+ CollectionID: string;
42255
+
42256
+ @Field()
42257
+ @MaxLength(16)
42258
+ UserID: string;
42259
+
42260
+ @Field(() => Boolean, {description: `Always 1 - users must have read permission to access a shared collection`})
42261
+ CanRead: boolean;
42262
+
42263
+ @Field(() => Boolean, {description: `Can share this collection with others (but cannot grant more permissions than they have)`})
42264
+ CanShare: boolean;
42265
+
42266
+ @Field(() => Boolean, {description: `Can add/remove artifacts to/from this collection`})
42267
+ CanEdit: boolean;
42268
+
42269
+ @Field(() => Boolean, {description: `Can delete the collection, child collections, and artifacts`})
42270
+ CanDelete: boolean;
42271
+
42272
+ @Field({nullable: true, description: `The user who shared this collection (NULL if shared by owner)`})
42273
+ @MaxLength(16)
42274
+ SharedByUserID?: string;
42275
+
42276
+ @Field()
42277
+ @MaxLength(10)
42278
+ _mj__CreatedAt: Date;
42279
+
42280
+ @Field()
42281
+ @MaxLength(10)
42282
+ _mj__UpdatedAt: Date;
42283
+
42284
+ @Field()
42285
+ @MaxLength(510)
42286
+ Collection: string;
42287
+
42288
+ @Field()
42289
+ @MaxLength(200)
42290
+ User: string;
42291
+
42292
+ @Field({nullable: true})
42293
+ @MaxLength(200)
42294
+ SharedByUser?: string;
42295
+
42296
+ }
42297
+
42298
+ //****************************************************************************
42299
+ // INPUT TYPE for MJ: Collection Permissions
42300
+ //****************************************************************************
42301
+ @InputType()
42302
+ export class CreateMJCollectionPermissionInput {
42303
+ @Field({ nullable: true })
42304
+ ID?: string;
42305
+
42306
+ @Field({ nullable: true })
42307
+ CollectionID?: string;
42308
+
42309
+ @Field({ nullable: true })
42310
+ UserID?: string;
42311
+
42312
+ @Field(() => Boolean, { nullable: true })
42313
+ CanRead?: boolean;
42314
+
42315
+ @Field(() => Boolean, { nullable: true })
42316
+ CanShare?: boolean;
42317
+
42318
+ @Field(() => Boolean, { nullable: true })
42319
+ CanEdit?: boolean;
42320
+
42321
+ @Field(() => Boolean, { nullable: true })
42322
+ CanDelete?: boolean;
42323
+
42324
+ @Field({ nullable: true })
42325
+ SharedByUserID: string | null;
42326
+ }
42327
+
42328
+
42329
+ //****************************************************************************
42330
+ // INPUT TYPE for MJ: Collection Permissions
42331
+ //****************************************************************************
42332
+ @InputType()
42333
+ export class UpdateMJCollectionPermissionInput {
42334
+ @Field()
42335
+ ID: string;
42336
+
42337
+ @Field({ nullable: true })
42338
+ CollectionID?: string;
42339
+
42340
+ @Field({ nullable: true })
42341
+ UserID?: string;
42342
+
42343
+ @Field(() => Boolean, { nullable: true })
42344
+ CanRead?: boolean;
42345
+
42346
+ @Field(() => Boolean, { nullable: true })
42347
+ CanShare?: boolean;
42348
+
42349
+ @Field(() => Boolean, { nullable: true })
42350
+ CanEdit?: boolean;
42351
+
42352
+ @Field(() => Boolean, { nullable: true })
42353
+ CanDelete?: boolean;
42354
+
42355
+ @Field({ nullable: true })
42356
+ SharedByUserID?: string | null;
42357
+
42358
+ @Field(() => [KeyValuePairInput], { nullable: true })
42359
+ OldValues___?: KeyValuePairInput[];
42360
+ }
42361
+
42362
+ //****************************************************************************
42363
+ // RESOLVER for MJ: Collection Permissions
42364
+ //****************************************************************************
42365
+ @ObjectType()
42366
+ export class RunMJCollectionPermissionViewResult {
42367
+ @Field(() => [MJCollectionPermission_])
42368
+ Results: MJCollectionPermission_[];
42369
+
42370
+ @Field(() => String, {nullable: true})
42371
+ UserViewRunID?: string;
42372
+
42373
+ @Field(() => Int, {nullable: true})
42374
+ RowCount: number;
42375
+
42376
+ @Field(() => Int, {nullable: true})
42377
+ TotalRowCount: number;
42378
+
42379
+ @Field(() => Int, {nullable: true})
42380
+ ExecutionTime: number;
42381
+
42382
+ @Field({nullable: true})
42383
+ ErrorMessage?: string;
42384
+
42385
+ @Field(() => Boolean, {nullable: false})
42386
+ Success: boolean;
42387
+ }
42388
+
42389
+ @Resolver(MJCollectionPermission_)
42390
+ export class MJCollectionPermissionResolver extends ResolverBase {
42391
+ @Query(() => RunMJCollectionPermissionViewResult)
42392
+ async RunMJCollectionPermissionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42393
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42394
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
42395
+ }
42396
+
42397
+ @Query(() => RunMJCollectionPermissionViewResult)
42398
+ async RunMJCollectionPermissionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42399
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42400
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
42401
+ }
42402
+
42403
+ @Query(() => RunMJCollectionPermissionViewResult)
42404
+ async RunMJCollectionPermissionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42405
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42406
+ input.EntityName = 'MJ: Collection Permissions';
42407
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
42408
+ }
42409
+ @Query(() => MJCollectionPermission_, { nullable: true })
42410
+ async MJCollectionPermission(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJCollectionPermission_ | null> {
42411
+ this.CheckUserReadPermissions('MJ: Collection Permissions', userPayload);
42412
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42413
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
42414
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCollectionPermissions] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Collection Permissions', userPayload, EntityPermissionType.Read, 'AND');
42415
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
42416
+ const result = this.MapFieldNamesToCodeNames('MJ: Collection Permissions', rows && rows.length > 0 ? rows[0] : {})
42417
+ return result;
42418
+ }
42419
+
42420
+ @Mutation(() => MJCollectionPermission_)
42421
+ async CreateMJCollectionPermission(
42422
+ @Arg('input', () => CreateMJCollectionPermissionInput) input: CreateMJCollectionPermissionInput,
42423
+ @Ctx() { providers, userPayload }: AppContext,
42424
+ @PubSub() pubSub: PubSubEngine
42425
+ ) {
42426
+ const provider = GetReadWriteProvider(providers);
42427
+ return this.CreateRecord('MJ: Collection Permissions', input, provider, userPayload, pubSub)
42428
+ }
42429
+
42430
+ @Mutation(() => MJCollectionPermission_)
42431
+ async UpdateMJCollectionPermission(
42432
+ @Arg('input', () => UpdateMJCollectionPermissionInput) input: UpdateMJCollectionPermissionInput,
42433
+ @Ctx() { providers, userPayload }: AppContext,
42434
+ @PubSub() pubSub: PubSubEngine
42435
+ ) {
42436
+ const provider = GetReadWriteProvider(providers);
42437
+ return this.UpdateRecord('MJ: Collection Permissions', input, provider, userPayload, pubSub);
42438
+ }
42439
+
42440
+ @Mutation(() => MJCollectionPermission_)
42441
+ async DeleteMJCollectionPermission(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42442
+ const provider = GetReadWriteProvider(providers);
42443
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
42444
+ return this.DeleteRecord('MJ: Collection Permissions', key, options, provider, userPayload, pubSub);
42445
+ }
42446
+
42447
+ }
42448
+
41798
42449
  //****************************************************************************
41799
42450
  // ENTITY CLASS for MJ: AI Agent Prompts
41800
42451
  //****************************************************************************
@@ -43133,6 +43784,12 @@ export class MJAIAgentRelationship_ {
43133
43784
  @Field({nullable: true, description: `JSON configuration mapping sub-agent result payload paths to parent agent payload paths. Enables controlled merging of sub-agent results. Format: {"subAgentPath": "parentPath", "*": "captureAllPath"}. If null, sub-agent results are not automatically merged into parent payload.`})
43134
43785
  SubAgentOutputMapping?: string;
43135
43786
 
43787
+ @Field({nullable: true, description: `JSON mapping of parent payload paths to sub-agent initial payload paths. Enables structural data transfer from parent to related sub-agent. Format: {"parentPath": "subAgentPath", "parent.nested": "subAgent.field"}. Example: {"searchQuery": "query", "maxResults": "limit"}. If null, sub-agent starts with empty payload (default behavior).`})
43788
+ SubAgentInputMapping?: string;
43789
+
43790
+ @Field({nullable: true, description: `JSON array of parent payload paths to send as LLM context to related sub-agent. Sub-agent receives this data in a formatted context message before its task message. Format: ["path1", "path2.nested", "path3.*", "*"]. Use "*" to send entire parent payload. Example: ["userPreferences", "priorFindings.summary", "sources[*]"]. If null, no parent context is sent (default behavior).`})
43791
+ SubAgentContextPaths?: string;
43792
+
43136
43793
  @Field({nullable: true})
43137
43794
  @MaxLength(510)
43138
43795
  Agent?: string;
@@ -43162,6 +43819,12 @@ export class CreateMJAIAgentRelationshipInput {
43162
43819
 
43163
43820
  @Field({ nullable: true })
43164
43821
  SubAgentOutputMapping: string | null;
43822
+
43823
+ @Field({ nullable: true })
43824
+ SubAgentInputMapping: string | null;
43825
+
43826
+ @Field({ nullable: true })
43827
+ SubAgentContextPaths: string | null;
43165
43828
  }
43166
43829
 
43167
43830
 
@@ -43185,6 +43848,12 @@ export class UpdateMJAIAgentRelationshipInput {
43185
43848
  @Field({ nullable: true })
43186
43849
  SubAgentOutputMapping?: string | null;
43187
43850
 
43851
+ @Field({ nullable: true })
43852
+ SubAgentInputMapping?: string | null;
43853
+
43854
+ @Field({ nullable: true })
43855
+ SubAgentContextPaths?: string | null;
43856
+
43188
43857
  @Field(() => [KeyValuePairInput], { nullable: true })
43189
43858
  OldValues___?: KeyValuePairInput[];
43190
43859
  }
@@ -49654,4 +50323,319 @@ export class MJArtifactVersionAttributeResolver extends ResolverBase {
49654
50323
  return this.DeleteRecord('MJ: Artifact Version Attributes', key, options, provider, userPayload, pubSub);
49655
50324
  }
49656
50325
 
50326
+ }
50327
+
50328
+ //****************************************************************************
50329
+ // ENTITY CLASS for MJ: AI Agent Data Sources
50330
+ //****************************************************************************
50331
+ @ObjectType({ description: `Defines data sources that should be preloaded into the data parameter before agent execution. Supports both RunView and RunQuery sources with configurable caching.` })
50332
+ export class MJAIAgentDataSource_ {
50333
+ @Field()
50334
+ @MaxLength(16)
50335
+ ID: string;
50336
+
50337
+ @Field()
50338
+ @MaxLength(16)
50339
+ AgentID: string;
50340
+
50341
+ @Field({description: `Variable name for the data in the data parameter (e.g., "ALL_ENTITIES"). Must be unique within an agent.`})
50342
+ @MaxLength(510)
50343
+ Name: string;
50344
+
50345
+ @Field({nullable: true, description: `Description of what this data source provides`})
50346
+ Description?: string;
50347
+
50348
+ @Field({description: `Type of data source: RunView or RunQuery. Determines which parameters are used.`})
50349
+ @MaxLength(40)
50350
+ SourceType: string;
50351
+
50352
+ @Field({nullable: true, description: `Entity name for RunView data sources (e.g., "Entities", "AI Models")`})
50353
+ @MaxLength(510)
50354
+ EntityName?: string;
50355
+
50356
+ @Field({nullable: true, description: `SQL WHERE clause filter for RunView data sources`})
50357
+ ExtraFilter?: string;
50358
+
50359
+ @Field({nullable: true, description: `SQL ORDER BY clause for RunView data sources`})
50360
+ @MaxLength(1000)
50361
+ OrderBy?: string;
50362
+
50363
+ @Field({nullable: true, description: `JSON array of field names to return for RunView data sources (e.g., ["ID", "Name", "Description"])`})
50364
+ FieldsToRetrieve?: string;
50365
+
50366
+ @Field({nullable: true, description: `Result type for RunView: simple (default) or entity_object`})
50367
+ @MaxLength(40)
50368
+ ResultType?: string;
50369
+
50370
+ @Field({nullable: true, description: `Query name for RunQuery data sources`})
50371
+ @MaxLength(510)
50372
+ QueryName?: string;
50373
+
50374
+ @Field({nullable: true, description: `Category path for RunQuery data sources (e.g., "/MJ/AI/Agents/")`})
50375
+ @MaxLength(1000)
50376
+ CategoryPath?: string;
50377
+
50378
+ @Field({nullable: true, description: `JSON object of parameters for RunQuery data sources (e.g., {"organizationId": "123"})`})
50379
+ Parameters?: string;
50380
+
50381
+ @Field(() => Int, {nullable: true, description: `Maximum number of rows to return. Applies to both RunView and RunQuery.`})
50382
+ MaxRows?: number;
50383
+
50384
+ @Field(() => Int, {description: `Execution order when multiple data sources are defined for an agent (lower numbers execute first)`})
50385
+ ExecutionOrder: number;
50386
+
50387
+ @Field({description: `Status of the data source: Active or Disabled`})
50388
+ @MaxLength(40)
50389
+ Status: string;
50390
+
50391
+ @Field({description: `Cache policy: None (no caching), PerRun (cache for duration of agent run), PerAgent (cache across runs with timeout)`})
50392
+ @MaxLength(40)
50393
+ CachePolicy: string;
50394
+
50395
+ @Field(() => Int, {nullable: true, description: `Time-to-live in seconds for PerAgent cache policy. Ignored for other cache policies.`})
50396
+ CacheTimeoutSeconds?: number;
50397
+
50398
+ @Field({description: `Destination for the preloaded data: Data (for Nunjucks templates in prompts), Context (for actions only), or Payload (for agent state)`})
50399
+ @MaxLength(40)
50400
+ DestinationType: string;
50401
+
50402
+ @Field({nullable: true, description: `Path within the destination where data should be injected. Supports nested paths using dot notation (e.g., "config.api.endpoints", "analysis.orders.recent"). If null, uses Name as root-level key.`})
50403
+ @MaxLength(1000)
50404
+ DestinationPath?: string;
50405
+
50406
+ @Field()
50407
+ @MaxLength(10)
50408
+ _mj__CreatedAt: Date;
50409
+
50410
+ @Field()
50411
+ @MaxLength(10)
50412
+ _mj__UpdatedAt: Date;
50413
+
50414
+ @Field({nullable: true})
50415
+ @MaxLength(510)
50416
+ Agent?: string;
50417
+
50418
+ }
50419
+
50420
+ //****************************************************************************
50421
+ // INPUT TYPE for MJ: AI Agent Data Sources
50422
+ //****************************************************************************
50423
+ @InputType()
50424
+ export class CreateMJAIAgentDataSourceInput {
50425
+ @Field({ nullable: true })
50426
+ ID?: string;
50427
+
50428
+ @Field({ nullable: true })
50429
+ AgentID?: string;
50430
+
50431
+ @Field({ nullable: true })
50432
+ Name?: string;
50433
+
50434
+ @Field({ nullable: true })
50435
+ Description: string | null;
50436
+
50437
+ @Field({ nullable: true })
50438
+ SourceType?: string;
50439
+
50440
+ @Field({ nullable: true })
50441
+ EntityName: string | null;
50442
+
50443
+ @Field({ nullable: true })
50444
+ ExtraFilter: string | null;
50445
+
50446
+ @Field({ nullable: true })
50447
+ OrderBy: string | null;
50448
+
50449
+ @Field({ nullable: true })
50450
+ FieldsToRetrieve: string | null;
50451
+
50452
+ @Field({ nullable: true })
50453
+ ResultType?: string | null;
50454
+
50455
+ @Field({ nullable: true })
50456
+ QueryName: string | null;
50457
+
50458
+ @Field({ nullable: true })
50459
+ CategoryPath: string | null;
50460
+
50461
+ @Field({ nullable: true })
50462
+ Parameters: string | null;
50463
+
50464
+ @Field(() => Int, { nullable: true })
50465
+ MaxRows: number | null;
50466
+
50467
+ @Field(() => Int, { nullable: true })
50468
+ ExecutionOrder?: number;
50469
+
50470
+ @Field({ nullable: true })
50471
+ Status?: string;
50472
+
50473
+ @Field({ nullable: true })
50474
+ CachePolicy?: string;
50475
+
50476
+ @Field(() => Int, { nullable: true })
50477
+ CacheTimeoutSeconds: number | null;
50478
+
50479
+ @Field({ nullable: true })
50480
+ DestinationType?: string;
50481
+
50482
+ @Field({ nullable: true })
50483
+ DestinationPath: string | null;
50484
+ }
50485
+
50486
+
50487
+ //****************************************************************************
50488
+ // INPUT TYPE for MJ: AI Agent Data Sources
50489
+ //****************************************************************************
50490
+ @InputType()
50491
+ export class UpdateMJAIAgentDataSourceInput {
50492
+ @Field()
50493
+ ID: string;
50494
+
50495
+ @Field({ nullable: true })
50496
+ AgentID?: string;
50497
+
50498
+ @Field({ nullable: true })
50499
+ Name?: string;
50500
+
50501
+ @Field({ nullable: true })
50502
+ Description?: string | null;
50503
+
50504
+ @Field({ nullable: true })
50505
+ SourceType?: string;
50506
+
50507
+ @Field({ nullable: true })
50508
+ EntityName?: string | null;
50509
+
50510
+ @Field({ nullable: true })
50511
+ ExtraFilter?: string | null;
50512
+
50513
+ @Field({ nullable: true })
50514
+ OrderBy?: string | null;
50515
+
50516
+ @Field({ nullable: true })
50517
+ FieldsToRetrieve?: string | null;
50518
+
50519
+ @Field({ nullable: true })
50520
+ ResultType?: string | null;
50521
+
50522
+ @Field({ nullable: true })
50523
+ QueryName?: string | null;
50524
+
50525
+ @Field({ nullable: true })
50526
+ CategoryPath?: string | null;
50527
+
50528
+ @Field({ nullable: true })
50529
+ Parameters?: string | null;
50530
+
50531
+ @Field(() => Int, { nullable: true })
50532
+ MaxRows?: number | null;
50533
+
50534
+ @Field(() => Int, { nullable: true })
50535
+ ExecutionOrder?: number;
50536
+
50537
+ @Field({ nullable: true })
50538
+ Status?: string;
50539
+
50540
+ @Field({ nullable: true })
50541
+ CachePolicy?: string;
50542
+
50543
+ @Field(() => Int, { nullable: true })
50544
+ CacheTimeoutSeconds?: number | null;
50545
+
50546
+ @Field({ nullable: true })
50547
+ DestinationType?: string;
50548
+
50549
+ @Field({ nullable: true })
50550
+ DestinationPath?: string | null;
50551
+
50552
+ @Field(() => [KeyValuePairInput], { nullable: true })
50553
+ OldValues___?: KeyValuePairInput[];
50554
+ }
50555
+
50556
+ //****************************************************************************
50557
+ // RESOLVER for MJ: AI Agent Data Sources
50558
+ //****************************************************************************
50559
+ @ObjectType()
50560
+ export class RunMJAIAgentDataSourceViewResult {
50561
+ @Field(() => [MJAIAgentDataSource_])
50562
+ Results: MJAIAgentDataSource_[];
50563
+
50564
+ @Field(() => String, {nullable: true})
50565
+ UserViewRunID?: string;
50566
+
50567
+ @Field(() => Int, {nullable: true})
50568
+ RowCount: number;
50569
+
50570
+ @Field(() => Int, {nullable: true})
50571
+ TotalRowCount: number;
50572
+
50573
+ @Field(() => Int, {nullable: true})
50574
+ ExecutionTime: number;
50575
+
50576
+ @Field({nullable: true})
50577
+ ErrorMessage?: string;
50578
+
50579
+ @Field(() => Boolean, {nullable: false})
50580
+ Success: boolean;
50581
+ }
50582
+
50583
+ @Resolver(MJAIAgentDataSource_)
50584
+ export class MJAIAgentDataSourceResolver extends ResolverBase {
50585
+ @Query(() => RunMJAIAgentDataSourceViewResult)
50586
+ async RunMJAIAgentDataSourceViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
50587
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
50588
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
50589
+ }
50590
+
50591
+ @Query(() => RunMJAIAgentDataSourceViewResult)
50592
+ async RunMJAIAgentDataSourceViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
50593
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
50594
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
50595
+ }
50596
+
50597
+ @Query(() => RunMJAIAgentDataSourceViewResult)
50598
+ async RunMJAIAgentDataSourceDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
50599
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
50600
+ input.EntityName = 'MJ: AI Agent Data Sources';
50601
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
50602
+ }
50603
+ @Query(() => MJAIAgentDataSource_, { nullable: true })
50604
+ async MJAIAgentDataSource(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentDataSource_ | null> {
50605
+ this.CheckUserReadPermissions('MJ: AI Agent Data Sources', userPayload);
50606
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
50607
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
50608
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentDataSources] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Data Sources', userPayload, EntityPermissionType.Read, 'AND');
50609
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
50610
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Agent Data Sources', rows && rows.length > 0 ? rows[0] : {})
50611
+ return result;
50612
+ }
50613
+
50614
+ @Mutation(() => MJAIAgentDataSource_)
50615
+ async CreateMJAIAgentDataSource(
50616
+ @Arg('input', () => CreateMJAIAgentDataSourceInput) input: CreateMJAIAgentDataSourceInput,
50617
+ @Ctx() { providers, userPayload }: AppContext,
50618
+ @PubSub() pubSub: PubSubEngine
50619
+ ) {
50620
+ const provider = GetReadWriteProvider(providers);
50621
+ return this.CreateRecord('MJ: AI Agent Data Sources', input, provider, userPayload, pubSub)
50622
+ }
50623
+
50624
+ @Mutation(() => MJAIAgentDataSource_)
50625
+ async UpdateMJAIAgentDataSource(
50626
+ @Arg('input', () => UpdateMJAIAgentDataSourceInput) input: UpdateMJAIAgentDataSourceInput,
50627
+ @Ctx() { providers, userPayload }: AppContext,
50628
+ @PubSub() pubSub: PubSubEngine
50629
+ ) {
50630
+ const provider = GetReadWriteProvider(providers);
50631
+ return this.UpdateRecord('MJ: AI Agent Data Sources', input, provider, userPayload, pubSub);
50632
+ }
50633
+
50634
+ @Mutation(() => MJAIAgentDataSource_)
50635
+ async DeleteMJAIAgentDataSource(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
50636
+ const provider = GetReadWriteProvider(providers);
50637
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
50638
+ return this.DeleteRecord('MJ: AI Agent Data Sources', key, options, provider, userPayload, pubSub);
50639
+ }
50640
+
49657
50641
  }