@memberjunction/server 2.41.0 → 2.42.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, AIAgentNoteTypeEntity, AIAgentEntity, AIAgentNoteEntity, AIAgentActionEntity, 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, ReportUserStateEntity, QueryEntityEntity, ArtifactTypeEntity, ConversationArtifactEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, ConversationArtifactPermissionEntity, AIAgentLearningCycleEntity, ReportVersionEntity } from '@memberjunction/core-entities';
22
+ import { ScheduledActionEntity, ScheduledActionParamEntity, ExplorerNavigationItemEntity, GeneratedCodeCategoryEntity, AIAgentModelEntity, AIAgentNoteTypeEntity, AIVendorEntity, AIConfigurationEntity, AIAgentEntity, AIPromptModelEntity, AIAgentNoteEntity, AIAgentActionEntity, 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, ArtifactTypeEntity, AIVendorTypeEntity, ConversationArtifactEntity, AIAgentPromptEntity, DashboardUserPreferenceEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, AIPromptRunEntity, ConversationArtifactPermissionEntity, AIAgentLearningCycleEntity, ReportVersionEntity, AIConfigurationParamEntity } from '@memberjunction/core-entities';
23
23
 
24
24
 
25
25
  //****************************************************************************
@@ -1181,6 +1181,457 @@ export class AIAgentNoteTypeResolver extends ResolverBase {
1181
1181
 
1182
1182
  }
1183
1183
 
1184
+ //****************************************************************************
1185
+ // ENTITY CLASS for MJ: AI Vendors
1186
+ //****************************************************************************
1187
+ @ObjectType()
1188
+ export class AIVendor_ {
1189
+ @Field()
1190
+ @MaxLength(16)
1191
+ ID: string;
1192
+
1193
+ @Field({description: `The unique name of the vendor.`})
1194
+ @MaxLength(100)
1195
+ Name: string;
1196
+
1197
+ @Field({nullable: true, description: `Detailed description of the vendor and their AI offerings.`})
1198
+ Description?: string;
1199
+
1200
+ @Field()
1201
+ @MaxLength(10)
1202
+ _mj__CreatedAt: Date;
1203
+
1204
+ @Field()
1205
+ @MaxLength(10)
1206
+ _mj__UpdatedAt: Date;
1207
+
1208
+ @Field(() => [AIPromptModel_])
1209
+ MJ_AIPromptModels_VendorIDArray: AIPromptModel_[]; // Link to MJ_AIPromptModels
1210
+
1211
+ @Field(() => [AIResultCache_])
1212
+ AIResultCache_VendorIDArray: AIResultCache_[]; // Link to AIResultCache
1213
+
1214
+ @Field(() => [AIModelVendor_])
1215
+ MJ_AIModelVendors_VendorIDArray: AIModelVendor_[]; // Link to MJ_AIModelVendors
1216
+
1217
+ @Field(() => [AIPromptRun_])
1218
+ MJ_AIPromptRuns_VendorIDArray: AIPromptRun_[]; // Link to MJ_AIPromptRuns
1219
+
1220
+ @Field(() => [AIVendorType_])
1221
+ MJ_AIVendorTypes_VendorIDArray: AIVendorType_[]; // Link to MJ_AIVendorTypes
1222
+
1223
+ }
1224
+
1225
+ //****************************************************************************
1226
+ // INPUT TYPE for MJ: AI Vendors
1227
+ //****************************************************************************
1228
+ @InputType()
1229
+ export class CreateAIVendorInput {
1230
+ @Field({ nullable: true })
1231
+ Name?: string;
1232
+
1233
+ @Field({ nullable: true })
1234
+ Description: string | null;
1235
+ }
1236
+
1237
+
1238
+ //****************************************************************************
1239
+ // INPUT TYPE for MJ: AI Vendors
1240
+ //****************************************************************************
1241
+ @InputType()
1242
+ export class UpdateAIVendorInput {
1243
+ @Field()
1244
+ ID: string;
1245
+
1246
+ @Field({ nullable: true })
1247
+ Name?: string;
1248
+
1249
+ @Field({ nullable: true })
1250
+ Description?: string | null;
1251
+
1252
+ @Field(() => [KeyValuePairInput], { nullable: true })
1253
+ OldValues___?: KeyValuePairInput[];
1254
+ }
1255
+
1256
+ //****************************************************************************
1257
+ // RESOLVER for MJ: AI Vendors
1258
+ //****************************************************************************
1259
+ @ObjectType()
1260
+ export class RunAIVendorViewResult {
1261
+ @Field(() => [AIVendor_])
1262
+ Results: AIVendor_[];
1263
+
1264
+ @Field(() => String, {nullable: true})
1265
+ UserViewRunID?: string;
1266
+
1267
+ @Field(() => Int, {nullable: true})
1268
+ RowCount: number;
1269
+
1270
+ @Field(() => Int, {nullable: true})
1271
+ TotalRowCount: number;
1272
+
1273
+ @Field(() => Int, {nullable: true})
1274
+ ExecutionTime: number;
1275
+
1276
+ @Field({nullable: true})
1277
+ ErrorMessage?: string;
1278
+
1279
+ @Field(() => Boolean, {nullable: false})
1280
+ Success: boolean;
1281
+ }
1282
+
1283
+ @Resolver(AIVendor_)
1284
+ export class AIVendorResolver extends ResolverBase {
1285
+ @Query(() => RunAIVendorViewResult)
1286
+ async RunAIVendorViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1287
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1288
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
1289
+ }
1290
+
1291
+ @Query(() => RunAIVendorViewResult)
1292
+ async RunAIVendorViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1293
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1294
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
1295
+ }
1296
+
1297
+ @Query(() => RunAIVendorViewResult)
1298
+ async RunAIVendorDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1299
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1300
+ input.EntityName = 'MJ: AI Vendors';
1301
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
1302
+ }
1303
+ @Query(() => AIVendor_, { nullable: true })
1304
+ async AIVendor(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIVendor_ | null> {
1305
+ this.CheckUserReadPermissions('MJ: AI Vendors', userPayload);
1306
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1307
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIVendors] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Vendors', userPayload, EntityPermissionType.Read, 'AND');
1308
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Vendors', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
1309
+ return result;
1310
+ }
1311
+
1312
+ @FieldResolver(() => [AIPromptModel_])
1313
+ async MJ_AIPromptModels_VendorIDArray(@Root() aivendor_: AIVendor_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1314
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
1315
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1316
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [VendorID]='${aivendor_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
1317
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', await dataSource.query(sSQL));
1318
+ return result;
1319
+ }
1320
+
1321
+ @FieldResolver(() => [AIResultCache_])
1322
+ async AIResultCache_VendorIDArray(@Root() aivendor_: AIVendor_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1323
+ this.CheckUserReadPermissions('AI Result Cache', userPayload);
1324
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1325
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIResultCaches] WHERE [VendorID]='${aivendor_.ID}' ` + this.getRowLevelSecurityWhereClause('AI Result Cache', userPayload, EntityPermissionType.Read, 'AND');
1326
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Result Cache', await dataSource.query(sSQL));
1327
+ return result;
1328
+ }
1329
+
1330
+ @FieldResolver(() => [AIModelVendor_])
1331
+ async MJ_AIModelVendors_VendorIDArray(@Root() aivendor_: AIVendor_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1332
+ this.CheckUserReadPermissions('MJ: AI Model Vendors', userPayload);
1333
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1334
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIModelVendors] WHERE [VendorID]='${aivendor_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Model Vendors', userPayload, EntityPermissionType.Read, 'AND');
1335
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Model Vendors', await dataSource.query(sSQL));
1336
+ return result;
1337
+ }
1338
+
1339
+ @FieldResolver(() => [AIPromptRun_])
1340
+ async MJ_AIPromptRuns_VendorIDArray(@Root() aivendor_: AIVendor_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1341
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
1342
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1343
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [VendorID]='${aivendor_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
1344
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', await dataSource.query(sSQL));
1345
+ return result;
1346
+ }
1347
+
1348
+ @FieldResolver(() => [AIVendorType_])
1349
+ async MJ_AIVendorTypes_VendorIDArray(@Root() aivendor_: AIVendor_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1350
+ this.CheckUserReadPermissions('MJ: AI Vendor Types', userPayload);
1351
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1352
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIVendorTypes] WHERE [VendorID]='${aivendor_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Vendor Types', userPayload, EntityPermissionType.Read, 'AND');
1353
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Vendor Types', await dataSource.query(sSQL));
1354
+ return result;
1355
+ }
1356
+
1357
+ @Mutation(() => AIVendor_)
1358
+ async CreateAIVendor(
1359
+ @Arg('input', () => CreateAIVendorInput) input: CreateAIVendorInput,
1360
+ @Ctx() { dataSources, userPayload }: AppContext,
1361
+ @PubSub() pubSub: PubSubEngine
1362
+ ) {
1363
+ const dataSource = GetReadWriteDataSource(dataSources);
1364
+ return this.CreateRecord('MJ: AI Vendors', input, dataSource, userPayload, pubSub)
1365
+ }
1366
+
1367
+ @Mutation(() => AIVendor_)
1368
+ async UpdateAIVendor(
1369
+ @Arg('input', () => UpdateAIVendorInput) input: UpdateAIVendorInput,
1370
+ @Ctx() { dataSources, userPayload }: AppContext,
1371
+ @PubSub() pubSub: PubSubEngine
1372
+ ) {
1373
+ const dataSource = GetReadWriteDataSource(dataSources);
1374
+ return this.UpdateRecord('MJ: AI Vendors', input, dataSource, userPayload, pubSub);
1375
+ }
1376
+
1377
+ @Mutation(() => AIVendor_)
1378
+ async DeleteAIVendor(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1379
+ const dataSource = GetReadWriteDataSource(dataSources);
1380
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
1381
+ return this.DeleteRecord('MJ: AI Vendors', key, options, dataSource, userPayload, pubSub);
1382
+ }
1383
+
1384
+ }
1385
+
1386
+ //****************************************************************************
1387
+ // ENTITY CLASS for MJ: AI Configurations
1388
+ //****************************************************************************
1389
+ @ObjectType()
1390
+ export class AIConfiguration_ {
1391
+ @Field()
1392
+ @MaxLength(16)
1393
+ ID: string;
1394
+
1395
+ @Field({description: `The name of the configuration.`})
1396
+ @MaxLength(200)
1397
+ Name: string;
1398
+
1399
+ @Field({nullable: true, description: `Detailed description of the configuration.`})
1400
+ Description?: string;
1401
+
1402
+ @Field(() => Boolean, {description: `Indicates whether this is the default configuration to use when none is specified.`})
1403
+ IsDefault: boolean;
1404
+
1405
+ @Field({description: `The current status of the configuration. Values include Active, Inactive, Deprecated, and Preview.`})
1406
+ @MaxLength(40)
1407
+ Status: string;
1408
+
1409
+ @Field({nullable: true, description: `Default prompt to use for context compression when not specified at the agent level.`})
1410
+ @MaxLength(16)
1411
+ DefaultPromptForContextCompressionID?: string;
1412
+
1413
+ @Field({nullable: true, description: `Default prompt to use for context summarization when not specified at the agent level.`})
1414
+ @MaxLength(16)
1415
+ DefaultPromptForContextSummarizationID?: string;
1416
+
1417
+ @Field()
1418
+ @MaxLength(10)
1419
+ _mj__CreatedAt: Date;
1420
+
1421
+ @Field()
1422
+ @MaxLength(10)
1423
+ _mj__UpdatedAt: Date;
1424
+
1425
+ @Field({nullable: true})
1426
+ @MaxLength(510)
1427
+ DefaultPromptForContextCompression?: string;
1428
+
1429
+ @Field({nullable: true})
1430
+ @MaxLength(510)
1431
+ DefaultPromptForContextSummarization?: string;
1432
+
1433
+ @Field(() => [AIConfigurationParam_])
1434
+ MJ_AIConfigurationParams_ConfigurationIDArray: AIConfigurationParam_[]; // Link to MJ_AIConfigurationParams
1435
+
1436
+ @Field(() => [AIAgentPrompt_])
1437
+ MJ_AIAgentPrompts_ConfigurationIDArray: AIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
1438
+
1439
+ @Field(() => [AIPromptModel_])
1440
+ MJ_AIPromptModels_ConfigurationIDArray: AIPromptModel_[]; // Link to MJ_AIPromptModels
1441
+
1442
+ @Field(() => [AIResultCache_])
1443
+ AIResultCache_ConfigurationIDArray: AIResultCache_[]; // Link to AIResultCache
1444
+
1445
+ @Field(() => [AIPromptRun_])
1446
+ MJ_AIPromptRuns_ConfigurationIDArray: AIPromptRun_[]; // Link to MJ_AIPromptRuns
1447
+
1448
+ }
1449
+
1450
+ //****************************************************************************
1451
+ // INPUT TYPE for MJ: AI Configurations
1452
+ //****************************************************************************
1453
+ @InputType()
1454
+ export class CreateAIConfigurationInput {
1455
+ @Field({ nullable: true })
1456
+ Name?: string;
1457
+
1458
+ @Field({ nullable: true })
1459
+ Description: string | null;
1460
+
1461
+ @Field(() => Boolean, { nullable: true })
1462
+ IsDefault?: boolean;
1463
+
1464
+ @Field({ nullable: true })
1465
+ Status?: string;
1466
+
1467
+ @Field({ nullable: true })
1468
+ DefaultPromptForContextCompressionID: string | null;
1469
+
1470
+ @Field({ nullable: true })
1471
+ DefaultPromptForContextSummarizationID: string | null;
1472
+ }
1473
+
1474
+
1475
+ //****************************************************************************
1476
+ // INPUT TYPE for MJ: AI Configurations
1477
+ //****************************************************************************
1478
+ @InputType()
1479
+ export class UpdateAIConfigurationInput {
1480
+ @Field()
1481
+ ID: string;
1482
+
1483
+ @Field({ nullable: true })
1484
+ Name?: string;
1485
+
1486
+ @Field({ nullable: true })
1487
+ Description?: string | null;
1488
+
1489
+ @Field(() => Boolean, { nullable: true })
1490
+ IsDefault?: boolean;
1491
+
1492
+ @Field({ nullable: true })
1493
+ Status?: string;
1494
+
1495
+ @Field({ nullable: true })
1496
+ DefaultPromptForContextCompressionID?: string | null;
1497
+
1498
+ @Field({ nullable: true })
1499
+ DefaultPromptForContextSummarizationID?: string | null;
1500
+
1501
+ @Field(() => [KeyValuePairInput], { nullable: true })
1502
+ OldValues___?: KeyValuePairInput[];
1503
+ }
1504
+
1505
+ //****************************************************************************
1506
+ // RESOLVER for MJ: AI Configurations
1507
+ //****************************************************************************
1508
+ @ObjectType()
1509
+ export class RunAIConfigurationViewResult {
1510
+ @Field(() => [AIConfiguration_])
1511
+ Results: AIConfiguration_[];
1512
+
1513
+ @Field(() => String, {nullable: true})
1514
+ UserViewRunID?: string;
1515
+
1516
+ @Field(() => Int, {nullable: true})
1517
+ RowCount: number;
1518
+
1519
+ @Field(() => Int, {nullable: true})
1520
+ TotalRowCount: number;
1521
+
1522
+ @Field(() => Int, {nullable: true})
1523
+ ExecutionTime: number;
1524
+
1525
+ @Field({nullable: true})
1526
+ ErrorMessage?: string;
1527
+
1528
+ @Field(() => Boolean, {nullable: false})
1529
+ Success: boolean;
1530
+ }
1531
+
1532
+ @Resolver(AIConfiguration_)
1533
+ export class AIConfigurationResolver extends ResolverBase {
1534
+ @Query(() => RunAIConfigurationViewResult)
1535
+ async RunAIConfigurationViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1536
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1537
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
1538
+ }
1539
+
1540
+ @Query(() => RunAIConfigurationViewResult)
1541
+ async RunAIConfigurationViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1542
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1543
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
1544
+ }
1545
+
1546
+ @Query(() => RunAIConfigurationViewResult)
1547
+ async RunAIConfigurationDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1548
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1549
+ input.EntityName = 'MJ: AI Configurations';
1550
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
1551
+ }
1552
+ @Query(() => AIConfiguration_, { nullable: true })
1553
+ async AIConfiguration(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIConfiguration_ | null> {
1554
+ this.CheckUserReadPermissions('MJ: AI Configurations', userPayload);
1555
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1556
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIConfigurations] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Configurations', userPayload, EntityPermissionType.Read, 'AND');
1557
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Configurations', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
1558
+ return result;
1559
+ }
1560
+
1561
+ @FieldResolver(() => [AIConfigurationParam_])
1562
+ async MJ_AIConfigurationParams_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1563
+ this.CheckUserReadPermissions('MJ: AI Configuration Params', userPayload);
1564
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1565
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIConfigurationParams] WHERE [ConfigurationID]='${aiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Configuration Params', userPayload, EntityPermissionType.Read, 'AND');
1566
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Configuration Params', await dataSource.query(sSQL));
1567
+ return result;
1568
+ }
1569
+
1570
+ @FieldResolver(() => [AIAgentPrompt_])
1571
+ async MJ_AIAgentPrompts_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1572
+ this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
1573
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1574
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [ConfigurationID]='${aiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
1575
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', await dataSource.query(sSQL));
1576
+ return result;
1577
+ }
1578
+
1579
+ @FieldResolver(() => [AIPromptModel_])
1580
+ async MJ_AIPromptModels_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1581
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
1582
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1583
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [ConfigurationID]='${aiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
1584
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', await dataSource.query(sSQL));
1585
+ return result;
1586
+ }
1587
+
1588
+ @FieldResolver(() => [AIResultCache_])
1589
+ async AIResultCache_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1590
+ this.CheckUserReadPermissions('AI Result Cache', userPayload);
1591
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1592
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIResultCaches] WHERE [ConfigurationID]='${aiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause('AI Result Cache', userPayload, EntityPermissionType.Read, 'AND');
1593
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Result Cache', await dataSource.query(sSQL));
1594
+ return result;
1595
+ }
1596
+
1597
+ @FieldResolver(() => [AIPromptRun_])
1598
+ async MJ_AIPromptRuns_ConfigurationIDArray(@Root() aiconfiguration_: AIConfiguration_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1599
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
1600
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1601
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ConfigurationID]='${aiconfiguration_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
1602
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', await dataSource.query(sSQL));
1603
+ return result;
1604
+ }
1605
+
1606
+ @Mutation(() => AIConfiguration_)
1607
+ async CreateAIConfiguration(
1608
+ @Arg('input', () => CreateAIConfigurationInput) input: CreateAIConfigurationInput,
1609
+ @Ctx() { dataSources, userPayload }: AppContext,
1610
+ @PubSub() pubSub: PubSubEngine
1611
+ ) {
1612
+ const dataSource = GetReadWriteDataSource(dataSources);
1613
+ return this.CreateRecord('MJ: AI Configurations', input, dataSource, userPayload, pubSub)
1614
+ }
1615
+
1616
+ @Mutation(() => AIConfiguration_)
1617
+ async UpdateAIConfiguration(
1618
+ @Arg('input', () => UpdateAIConfigurationInput) input: UpdateAIConfigurationInput,
1619
+ @Ctx() { dataSources, userPayload }: AppContext,
1620
+ @PubSub() pubSub: PubSubEngine
1621
+ ) {
1622
+ const dataSource = GetReadWriteDataSource(dataSources);
1623
+ return this.UpdateRecord('MJ: AI Configurations', input, dataSource, userPayload, pubSub);
1624
+ }
1625
+
1626
+ @Mutation(() => AIConfiguration_)
1627
+ async DeleteAIConfiguration(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1628
+ const dataSource = GetReadWriteDataSource(dataSources);
1629
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
1630
+ return this.DeleteRecord('MJ: AI Configurations', key, options, dataSource, userPayload, pubSub);
1631
+ }
1632
+
1633
+ }
1634
+
1184
1635
  //****************************************************************************
1185
1636
  // ENTITY CLASS for AI Agents
1186
1637
  //****************************************************************************
@@ -1209,6 +1660,41 @@ export class AIAgent_ {
1209
1660
  @MaxLength(10)
1210
1661
  _mj__UpdatedAt: Date;
1211
1662
 
1663
+ @Field({nullable: true, description: `References the parent agent in the hierarchical structure. If NULL, this is a root (top-level) agent.`})
1664
+ @MaxLength(16)
1665
+ ParentID?: string;
1666
+
1667
+ @Field(() => Boolean, {description: `When true, this agent can be exposed as an action for use by other agents. Only valid for root agents.`})
1668
+ ExposeAsAction: boolean;
1669
+
1670
+ @Field(() => Int, {description: `The order in which this agent should be executed among its siblings under the same parent.`})
1671
+ ExecutionOrder: number;
1672
+
1673
+ @Field({description: `Controls how this agent's child agents are executed. Sequential runs children in order, Parallel runs them simultaneously.`})
1674
+ @MaxLength(40)
1675
+ ExecutionMode: string;
1676
+
1677
+ @Field(() => Boolean, {description: `When true, enables automatic compression of conversation context when the message threshold is reached.`})
1678
+ EnableContextCompression: boolean;
1679
+
1680
+ @Field(() => Int, {nullable: true, description: `Number of messages that triggers context compression when EnableContextCompression is true.`})
1681
+ ContextCompressionMessageThreshold?: number;
1682
+
1683
+ @Field({nullable: true})
1684
+ @MaxLength(16)
1685
+ ContextCompressionPromptID?: string;
1686
+
1687
+ @Field(() => Int, {nullable: true, description: `Number of recent messages to keep uncompressed when context compression is applied.`})
1688
+ ContextCompressionMessageRetentionCount?: number;
1689
+
1690
+ @Field({nullable: true})
1691
+ @MaxLength(510)
1692
+ Parent?: string;
1693
+
1694
+ @Field({nullable: true})
1695
+ @MaxLength(510)
1696
+ ContextCompressionPrompt?: string;
1697
+
1212
1698
  @Field(() => [AIAgentRequest_])
1213
1699
  AIAgentRequests_AgentIDArray: AIAgentRequest_[]; // Link to AIAgentRequests
1214
1700
 
@@ -1221,9 +1707,21 @@ export class AIAgent_ {
1221
1707
  @Field(() => [AIAgentAction_])
1222
1708
  AIAgentActions_AgentIDArray: AIAgentAction_[]; // Link to AIAgentActions
1223
1709
 
1710
+ @Field(() => [AIAgentPrompt_])
1711
+ MJ_AIAgentPrompts_AgentIDArray: AIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
1712
+
1224
1713
  @Field(() => [AIAgentNote_])
1225
1714
  AIAgentNotes_AgentIDArray: AIAgentNote_[]; // Link to AIAgentNotes
1226
1715
 
1716
+ @Field(() => [AIResultCache_])
1717
+ AIResultCache_AgentIDArray: AIResultCache_[]; // Link to AIResultCache
1718
+
1719
+ @Field(() => [AIPromptRun_])
1720
+ MJ_AIPromptRuns_AgentIDArray: AIPromptRun_[]; // Link to MJ_AIPromptRuns
1721
+
1722
+ @Field(() => [AIAgent_])
1723
+ AIAgents_ParentIDArray: AIAgent_[]; // Link to AIAgents
1724
+
1227
1725
  }
1228
1726
 
1229
1727
  //****************************************************************************
@@ -1239,6 +1737,30 @@ export class CreateAIAgentInput {
1239
1737
 
1240
1738
  @Field({ nullable: true })
1241
1739
  LogoURL: string | null;
1740
+
1741
+ @Field({ nullable: true })
1742
+ ParentID: string | null;
1743
+
1744
+ @Field(() => Boolean, { nullable: true })
1745
+ ExposeAsAction?: boolean;
1746
+
1747
+ @Field(() => Int, { nullable: true })
1748
+ ExecutionOrder?: number;
1749
+
1750
+ @Field({ nullable: true })
1751
+ ExecutionMode?: string;
1752
+
1753
+ @Field(() => Boolean, { nullable: true })
1754
+ EnableContextCompression?: boolean;
1755
+
1756
+ @Field(() => Int, { nullable: true })
1757
+ ContextCompressionMessageThreshold: number | null;
1758
+
1759
+ @Field({ nullable: true })
1760
+ ContextCompressionPromptID: string | null;
1761
+
1762
+ @Field(() => Int, { nullable: true })
1763
+ ContextCompressionMessageRetentionCount: number | null;
1242
1764
  }
1243
1765
 
1244
1766
 
@@ -1259,6 +1781,30 @@ export class UpdateAIAgentInput {
1259
1781
  @Field({ nullable: true })
1260
1782
  LogoURL?: string | null;
1261
1783
 
1784
+ @Field({ nullable: true })
1785
+ ParentID?: string | null;
1786
+
1787
+ @Field(() => Boolean, { nullable: true })
1788
+ ExposeAsAction?: boolean;
1789
+
1790
+ @Field(() => Int, { nullable: true })
1791
+ ExecutionOrder?: number;
1792
+
1793
+ @Field({ nullable: true })
1794
+ ExecutionMode?: string;
1795
+
1796
+ @Field(() => Boolean, { nullable: true })
1797
+ EnableContextCompression?: boolean;
1798
+
1799
+ @Field(() => Int, { nullable: true })
1800
+ ContextCompressionMessageThreshold?: number | null;
1801
+
1802
+ @Field({ nullable: true })
1803
+ ContextCompressionPromptID?: string | null;
1804
+
1805
+ @Field(() => Int, { nullable: true })
1806
+ ContextCompressionMessageRetentionCount?: number | null;
1807
+
1262
1808
  @Field(() => [KeyValuePairInput], { nullable: true })
1263
1809
  OldValues___?: KeyValuePairInput[];
1264
1810
  }
@@ -1355,6 +1901,15 @@ export class AIAgentResolver extends ResolverBase {
1355
1901
  return result;
1356
1902
  }
1357
1903
 
1904
+ @FieldResolver(() => [AIAgentPrompt_])
1905
+ async MJ_AIAgentPrompts_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1906
+ this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
1907
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1908
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [AgentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
1909
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', await dataSource.query(sSQL));
1910
+ return result;
1911
+ }
1912
+
1358
1913
  @FieldResolver(() => [AIAgentNote_])
1359
1914
  async AIAgentNotes_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1360
1915
  this.CheckUserReadPermissions('AI Agent Notes', userPayload);
@@ -1364,6 +1919,33 @@ export class AIAgentResolver extends ResolverBase {
1364
1919
  return result;
1365
1920
  }
1366
1921
 
1922
+ @FieldResolver(() => [AIResultCache_])
1923
+ async AIResultCache_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1924
+ this.CheckUserReadPermissions('AI Result Cache', userPayload);
1925
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1926
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIResultCaches] WHERE [AgentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause('AI Result Cache', userPayload, EntityPermissionType.Read, 'AND');
1927
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Result Cache', await dataSource.query(sSQL));
1928
+ return result;
1929
+ }
1930
+
1931
+ @FieldResolver(() => [AIPromptRun_])
1932
+ async MJ_AIPromptRuns_AgentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1933
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
1934
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1935
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [AgentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
1936
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', await dataSource.query(sSQL));
1937
+ return result;
1938
+ }
1939
+
1940
+ @FieldResolver(() => [AIAgent_])
1941
+ async AIAgents_ParentIDArray(@Root() aiagent_: AIAgent_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1942
+ this.CheckUserReadPermissions('AI Agents', userPayload);
1943
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
1944
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgents] WHERE [ParentID]='${aiagent_.ID}' ` + this.getRowLevelSecurityWhereClause('AI Agents', userPayload, EntityPermissionType.Read, 'AND');
1945
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agents', await dataSource.query(sSQL));
1946
+ return result;
1947
+ }
1948
+
1367
1949
  @Mutation(() => AIAgent_)
1368
1950
  async CreateAIAgent(
1369
1951
  @Arg('input', () => CreateAIAgentInput) input: CreateAIAgentInput,
@@ -1393,6 +1975,251 @@ export class AIAgentResolver extends ResolverBase {
1393
1975
 
1394
1976
  }
1395
1977
 
1978
+ //****************************************************************************
1979
+ // ENTITY CLASS for MJ: AI Prompt Models
1980
+ //****************************************************************************
1981
+ @ObjectType()
1982
+ export class AIPromptModel_ {
1983
+ @Field()
1984
+ @MaxLength(16)
1985
+ ID: string;
1986
+
1987
+ @Field({description: `References the AI prompt this model association applies to.`})
1988
+ @MaxLength(16)
1989
+ PromptID: string;
1990
+
1991
+ @Field({description: `References the AI model to use for this prompt.`})
1992
+ @MaxLength(16)
1993
+ ModelID: string;
1994
+
1995
+ @Field({nullable: true, description: `Optional reference to a specific vendor for the model. If NULL, uses the highest priority vendor for the model.`})
1996
+ @MaxLength(16)
1997
+ VendorID?: string;
1998
+
1999
+ @Field({nullable: true, description: `Optional reference to a specific configuration. If NULL, this model is available in all configurations.`})
2000
+ @MaxLength(16)
2001
+ ConfigurationID?: string;
2002
+
2003
+ @Field(() => Int, {description: `Priority of this model for the prompt. Higher values indicate higher priority.`})
2004
+ Priority: number;
2005
+
2006
+ @Field(() => Int, {description: `Execution group for parallel processing. Models with the same group are executed in parallel.`})
2007
+ ExecutionGroup: number;
2008
+
2009
+ @Field({nullable: true, description: `JSON-formatted parameters specific to this model (temperature, max tokens, etc.).`})
2010
+ ModelParameters?: string;
2011
+
2012
+ @Field({description: `The current status of this model configuration. Values include Active, Inactive, Deprecated, and Preview.`})
2013
+ @MaxLength(40)
2014
+ Status: string;
2015
+
2016
+ @Field({description: `Controls how this model participates in parallelization: None, StaticCount, or ConfigParam.`})
2017
+ @MaxLength(40)
2018
+ ParallelizationMode: string;
2019
+
2020
+ @Field(() => Int, {description: `Number of parallel executions to perform with this model when ParallelizationMode is StaticCount.`})
2021
+ ParallelCount: number;
2022
+
2023
+ @Field({nullable: true, description: `Name of a configuration parameter that contains the parallel count when ParallelizationMode is ConfigParam.`})
2024
+ @MaxLength(200)
2025
+ ParallelConfigParam?: string;
2026
+
2027
+ @Field()
2028
+ @MaxLength(10)
2029
+ _mj__CreatedAt: Date;
2030
+
2031
+ @Field()
2032
+ @MaxLength(10)
2033
+ _mj__UpdatedAt: Date;
2034
+
2035
+ @Field()
2036
+ @MaxLength(510)
2037
+ Prompt: string;
2038
+
2039
+ @Field()
2040
+ @MaxLength(100)
2041
+ Model: string;
2042
+
2043
+ @Field({nullable: true})
2044
+ @MaxLength(100)
2045
+ Vendor?: string;
2046
+
2047
+ @Field({nullable: true})
2048
+ @MaxLength(200)
2049
+ Configuration?: string;
2050
+
2051
+ }
2052
+
2053
+ //****************************************************************************
2054
+ // INPUT TYPE for MJ: AI Prompt Models
2055
+ //****************************************************************************
2056
+ @InputType()
2057
+ export class CreateAIPromptModelInput {
2058
+ @Field({ nullable: true })
2059
+ PromptID?: string;
2060
+
2061
+ @Field({ nullable: true })
2062
+ ModelID?: string;
2063
+
2064
+ @Field({ nullable: true })
2065
+ VendorID: string | null;
2066
+
2067
+ @Field({ nullable: true })
2068
+ ConfigurationID: string | null;
2069
+
2070
+ @Field(() => Int, { nullable: true })
2071
+ Priority?: number;
2072
+
2073
+ @Field(() => Int, { nullable: true })
2074
+ ExecutionGroup?: number;
2075
+
2076
+ @Field({ nullable: true })
2077
+ ModelParameters: string | null;
2078
+
2079
+ @Field({ nullable: true })
2080
+ Status?: string;
2081
+
2082
+ @Field({ nullable: true })
2083
+ ParallelizationMode?: string;
2084
+
2085
+ @Field(() => Int, { nullable: true })
2086
+ ParallelCount?: number;
2087
+
2088
+ @Field({ nullable: true })
2089
+ ParallelConfigParam: string | null;
2090
+ }
2091
+
2092
+
2093
+ //****************************************************************************
2094
+ // INPUT TYPE for MJ: AI Prompt Models
2095
+ //****************************************************************************
2096
+ @InputType()
2097
+ export class UpdateAIPromptModelInput {
2098
+ @Field()
2099
+ ID: string;
2100
+
2101
+ @Field({ nullable: true })
2102
+ PromptID?: string;
2103
+
2104
+ @Field({ nullable: true })
2105
+ ModelID?: string;
2106
+
2107
+ @Field({ nullable: true })
2108
+ VendorID?: string | null;
2109
+
2110
+ @Field({ nullable: true })
2111
+ ConfigurationID?: string | null;
2112
+
2113
+ @Field(() => Int, { nullable: true })
2114
+ Priority?: number;
2115
+
2116
+ @Field(() => Int, { nullable: true })
2117
+ ExecutionGroup?: number;
2118
+
2119
+ @Field({ nullable: true })
2120
+ ModelParameters?: string | null;
2121
+
2122
+ @Field({ nullable: true })
2123
+ Status?: string;
2124
+
2125
+ @Field({ nullable: true })
2126
+ ParallelizationMode?: string;
2127
+
2128
+ @Field(() => Int, { nullable: true })
2129
+ ParallelCount?: number;
2130
+
2131
+ @Field({ nullable: true })
2132
+ ParallelConfigParam?: string | null;
2133
+
2134
+ @Field(() => [KeyValuePairInput], { nullable: true })
2135
+ OldValues___?: KeyValuePairInput[];
2136
+ }
2137
+
2138
+ //****************************************************************************
2139
+ // RESOLVER for MJ: AI Prompt Models
2140
+ //****************************************************************************
2141
+ @ObjectType()
2142
+ export class RunAIPromptModelViewResult {
2143
+ @Field(() => [AIPromptModel_])
2144
+ Results: AIPromptModel_[];
2145
+
2146
+ @Field(() => String, {nullable: true})
2147
+ UserViewRunID?: string;
2148
+
2149
+ @Field(() => Int, {nullable: true})
2150
+ RowCount: number;
2151
+
2152
+ @Field(() => Int, {nullable: true})
2153
+ TotalRowCount: number;
2154
+
2155
+ @Field(() => Int, {nullable: true})
2156
+ ExecutionTime: number;
2157
+
2158
+ @Field({nullable: true})
2159
+ ErrorMessage?: string;
2160
+
2161
+ @Field(() => Boolean, {nullable: false})
2162
+ Success: boolean;
2163
+ }
2164
+
2165
+ @Resolver(AIPromptModel_)
2166
+ export class AIPromptModelResolver extends ResolverBase {
2167
+ @Query(() => RunAIPromptModelViewResult)
2168
+ async RunAIPromptModelViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
2169
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2170
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
2171
+ }
2172
+
2173
+ @Query(() => RunAIPromptModelViewResult)
2174
+ async RunAIPromptModelViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
2175
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2176
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
2177
+ }
2178
+
2179
+ @Query(() => RunAIPromptModelViewResult)
2180
+ async RunAIPromptModelDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
2181
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2182
+ input.EntityName = 'MJ: AI Prompt Models';
2183
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
2184
+ }
2185
+ @Query(() => AIPromptModel_, { nullable: true })
2186
+ async AIPromptModel(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIPromptModel_ | null> {
2187
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
2188
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
2189
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
2190
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Prompt Models', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
2191
+ return result;
2192
+ }
2193
+
2194
+ @Mutation(() => AIPromptModel_)
2195
+ async CreateAIPromptModel(
2196
+ @Arg('input', () => CreateAIPromptModelInput) input: CreateAIPromptModelInput,
2197
+ @Ctx() { dataSources, userPayload }: AppContext,
2198
+ @PubSub() pubSub: PubSubEngine
2199
+ ) {
2200
+ const dataSource = GetReadWriteDataSource(dataSources);
2201
+ return this.CreateRecord('MJ: AI Prompt Models', input, dataSource, userPayload, pubSub)
2202
+ }
2203
+
2204
+ @Mutation(() => AIPromptModel_)
2205
+ async UpdateAIPromptModel(
2206
+ @Arg('input', () => UpdateAIPromptModelInput) input: UpdateAIPromptModelInput,
2207
+ @Ctx() { dataSources, userPayload }: AppContext,
2208
+ @PubSub() pubSub: PubSubEngine
2209
+ ) {
2210
+ const dataSource = GetReadWriteDataSource(dataSources);
2211
+ return this.UpdateRecord('MJ: AI Prompt Models', input, dataSource, userPayload, pubSub);
2212
+ }
2213
+
2214
+ @Mutation(() => AIPromptModel_)
2215
+ async DeleteAIPromptModel(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
2216
+ const dataSource = GetReadWriteDataSource(dataSources);
2217
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
2218
+ return this.DeleteRecord('MJ: AI Prompt Models', key, options, dataSource, userPayload, pubSub);
2219
+ }
2220
+
2221
+ }
2222
+
1396
2223
  //****************************************************************************
1397
2224
  // ENTITY CLASS for AI Agent Notes
1398
2225
  //****************************************************************************
@@ -1770,12 +2597,6 @@ export class AIPrompt_ {
1770
2597
  @MaxLength(100)
1771
2598
  Status: string;
1772
2599
 
1773
- @Field(() => Boolean, {description: `Indicates whether the results of the prompt should be cached.`})
1774
- CacheResults: boolean;
1775
-
1776
- @Field(() => Float, {description: `Number of hours the cache is valid for; can be fractional or 0 if the cache never expires.`})
1777
- CacheExpiration: number;
1778
-
1779
2600
  @Field()
1780
2601
  @MaxLength(10)
1781
2602
  _mj__CreatedAt: Date;
@@ -1791,6 +2612,82 @@ export class AIPrompt_ {
1791
2612
  @Field({nullable: true, description: `A JSON-formatted string containing model-specific response format instructions. This will be parsed and provided as a JSON object to the model.`})
1792
2613
  ModelSpecificResponseFormat?: string;
1793
2614
 
2615
+ @Field({nullable: true, description: `References the type of AI model this prompt is designed for (LLM, Image, Audio, etc.).`})
2616
+ @MaxLength(16)
2617
+ AIModelTypeID?: string;
2618
+
2619
+ @Field(() => Int, {nullable: true, description: `The minimum power rank required for models to be considered for this prompt.`})
2620
+ MinPowerRank?: number;
2621
+
2622
+ @Field({description: `Determines how models are selected for this prompt (Default, Specific, ByPower).`})
2623
+ @MaxLength(40)
2624
+ SelectionStrategy: string;
2625
+
2626
+ @Field({description: `When using ByPower selection strategy, determines whether to prefer highest, lowest, or balanced power models.`})
2627
+ @MaxLength(40)
2628
+ PowerPreference: string;
2629
+
2630
+ @Field({description: `Controls parallelization: None (no parallelization), StaticCount (use AIPrompt.ParallelCount for total runs), ConfigParam (use config param specified in ParallelConfigParam for total runs), or ModelSpecific (check each AIPromptModel's individual settings).`})
2631
+ @MaxLength(40)
2632
+ ParallelizationMode: string;
2633
+
2634
+ @Field(() => Int, {nullable: true, description: `When ParallelizationMode is StaticCount, specifies the number of parallel executions.`})
2635
+ ParallelCount?: number;
2636
+
2637
+ @Field({nullable: true, description: `When ParallelizationMode is ConfigParam, specifies the name of the configuration parameter that contains the parallel count.`})
2638
+ @MaxLength(200)
2639
+ ParallelConfigParam?: string;
2640
+
2641
+ @Field({description: `The expected data type of the prompt output: string, number, boolean, date, or object.`})
2642
+ @MaxLength(100)
2643
+ OutputType: string;
2644
+
2645
+ @Field({nullable: true, description: `JSON example output when OutputType is "object", used for validating structured outputs.`})
2646
+ OutputExample?: string;
2647
+
2648
+ @Field({description: `Determines how validation failures are handled: Strict (fail), Warn (log warning), or None (ignore).`})
2649
+ @MaxLength(100)
2650
+ ValidationBehavior: string;
2651
+
2652
+ @Field(() => Int, {description: `Maximum number of retry attempts for API failures.`})
2653
+ MaxRetries: number;
2654
+
2655
+ @Field(() => Int, {description: `Delay between retry attempts in milliseconds.`})
2656
+ RetryDelayMS: number;
2657
+
2658
+ @Field({description: `Strategy for calculating retry delays: Fixed (same delay each time), Exponential (doubling delay), or Linear (linearly increasing delay).`})
2659
+ @MaxLength(40)
2660
+ RetryStrategy: string;
2661
+
2662
+ @Field({nullable: true, description: `References another prompt that selects the best result from multiple parallel executions.`})
2663
+ @MaxLength(16)
2664
+ ResultSelectorPromptID?: string;
2665
+
2666
+ @Field(() => Boolean, {description: `When true, results from this prompt will be cached for potential reuse.`})
2667
+ EnableCaching: boolean;
2668
+
2669
+ @Field(() => Int, {nullable: true, description: `Time-to-live in seconds for cached results. NULL means results never expire.`})
2670
+ CacheTTLSeconds?: number;
2671
+
2672
+ @Field({description: `Method for matching cached results: Exact (string matching) or Vector (embedding similarity).`})
2673
+ @MaxLength(40)
2674
+ CacheMatchType: string;
2675
+
2676
+ @Field(() => Float, {nullable: true, description: `Threshold (0-1) for vector similarity matching. Higher values require closer matches.`})
2677
+ CacheSimilarityThreshold?: number;
2678
+
2679
+ @Field(() => Boolean, {description: `When true, the AI model must match for a cache hit. When false, results from any model can be used.`})
2680
+ CacheMustMatchModel: boolean;
2681
+
2682
+ @Field(() => Boolean, {description: `When true, the vendor must match for a cache hit. When false, results from any vendor can be used.`})
2683
+ CacheMustMatchVendor: boolean;
2684
+
2685
+ @Field(() => Boolean, {description: `When true, the agent context must match for a cache hit. When false, agent-specific and non-agent results can be used interchangeably.`})
2686
+ CacheMustMatchAgent: boolean;
2687
+
2688
+ @Field(() => Boolean, {description: `When true, the configuration must match for a cache hit. When false, results from any configuration can be used.`})
2689
+ CacheMustMatchConfig: boolean;
2690
+
1794
2691
  @Field()
1795
2692
  @MaxLength(510)
1796
2693
  Template: string;
@@ -1803,9 +2700,38 @@ export class AIPrompt_ {
1803
2700
  @MaxLength(510)
1804
2701
  Type: string;
1805
2702
 
2703
+ @Field({nullable: true})
2704
+ @MaxLength(100)
2705
+ AIModelType?: string;
2706
+
2707
+ @Field({nullable: true})
2708
+ @MaxLength(510)
2709
+ ResultSelectorPrompt?: string;
2710
+
1806
2711
  @Field(() => [AIResultCache_])
1807
2712
  AIResultCache_AIPromptIDArray: AIResultCache_[]; // Link to AIResultCache
1808
2713
 
2714
+ @Field(() => [AIConfiguration_])
2715
+ MJ_AIConfigurations_DefaultPromptForContextCompressionIDArray: AIConfiguration_[]; // Link to MJ_AIConfigurations
2716
+
2717
+ @Field(() => [AIConfiguration_])
2718
+ MJ_AIConfigurations_DefaultPromptForContextSummarizationIDArray: AIConfiguration_[]; // Link to MJ_AIConfigurations
2719
+
2720
+ @Field(() => [AIPrompt_])
2721
+ AIPrompts_ResultSelectorPromptIDArray: AIPrompt_[]; // Link to AIPrompts
2722
+
2723
+ @Field(() => [AIPromptModel_])
2724
+ MJ_AIPromptModels_PromptIDArray: AIPromptModel_[]; // Link to MJ_AIPromptModels
2725
+
2726
+ @Field(() => [AIAgentPrompt_])
2727
+ MJ_AIAgentPrompts_PromptIDArray: AIAgentPrompt_[]; // Link to MJ_AIAgentPrompts
2728
+
2729
+ @Field(() => [AIPromptRun_])
2730
+ MJ_AIPromptRuns_PromptIDArray: AIPromptRun_[]; // Link to MJ_AIPromptRuns
2731
+
2732
+ @Field(() => [AIAgent_])
2733
+ AIAgents_ContextCompressionPromptIDArray: AIAgent_[]; // Link to AIAgents
2734
+
1809
2735
  }
1810
2736
 
1811
2737
  //****************************************************************************
@@ -1831,17 +2757,77 @@ export class CreateAIPromptInput {
1831
2757
  @Field({ nullable: true })
1832
2758
  Status?: string;
1833
2759
 
1834
- @Field(() => Boolean, { nullable: true })
1835
- CacheResults?: boolean;
1836
-
1837
- @Field(() => Float, { nullable: true })
1838
- CacheExpiration?: number;
1839
-
1840
2760
  @Field({ nullable: true })
1841
2761
  ResponseFormat?: string;
1842
2762
 
1843
2763
  @Field({ nullable: true })
1844
2764
  ModelSpecificResponseFormat: string | null;
2765
+
2766
+ @Field({ nullable: true })
2767
+ AIModelTypeID: string | null;
2768
+
2769
+ @Field(() => Int, { nullable: true })
2770
+ MinPowerRank?: number | null;
2771
+
2772
+ @Field({ nullable: true })
2773
+ SelectionStrategy?: string;
2774
+
2775
+ @Field({ nullable: true })
2776
+ PowerPreference?: string;
2777
+
2778
+ @Field({ nullable: true })
2779
+ ParallelizationMode?: string;
2780
+
2781
+ @Field(() => Int, { nullable: true })
2782
+ ParallelCount: number | null;
2783
+
2784
+ @Field({ nullable: true })
2785
+ ParallelConfigParam: string | null;
2786
+
2787
+ @Field({ nullable: true })
2788
+ OutputType?: string;
2789
+
2790
+ @Field({ nullable: true })
2791
+ OutputExample: string | null;
2792
+
2793
+ @Field({ nullable: true })
2794
+ ValidationBehavior?: string;
2795
+
2796
+ @Field(() => Int, { nullable: true })
2797
+ MaxRetries?: number;
2798
+
2799
+ @Field(() => Int, { nullable: true })
2800
+ RetryDelayMS?: number;
2801
+
2802
+ @Field({ nullable: true })
2803
+ RetryStrategy?: string;
2804
+
2805
+ @Field({ nullable: true })
2806
+ ResultSelectorPromptID: string | null;
2807
+
2808
+ @Field(() => Boolean, { nullable: true })
2809
+ EnableCaching?: boolean;
2810
+
2811
+ @Field(() => Int, { nullable: true })
2812
+ CacheTTLSeconds: number | null;
2813
+
2814
+ @Field({ nullable: true })
2815
+ CacheMatchType?: string;
2816
+
2817
+ @Field(() => Float, { nullable: true })
2818
+ CacheSimilarityThreshold: number | null;
2819
+
2820
+ @Field(() => Boolean, { nullable: true })
2821
+ CacheMustMatchModel?: boolean;
2822
+
2823
+ @Field(() => Boolean, { nullable: true })
2824
+ CacheMustMatchVendor?: boolean;
2825
+
2826
+ @Field(() => Boolean, { nullable: true })
2827
+ CacheMustMatchAgent?: boolean;
2828
+
2829
+ @Field(() => Boolean, { nullable: true })
2830
+ CacheMustMatchConfig?: boolean;
1845
2831
  }
1846
2832
 
1847
2833
 
@@ -1871,18 +2857,78 @@ export class UpdateAIPromptInput {
1871
2857
  @Field({ nullable: true })
1872
2858
  Status?: string;
1873
2859
 
1874
- @Field(() => Boolean, { nullable: true })
1875
- CacheResults?: boolean;
1876
-
1877
- @Field(() => Float, { nullable: true })
1878
- CacheExpiration?: number;
1879
-
1880
2860
  @Field({ nullable: true })
1881
2861
  ResponseFormat?: string;
1882
2862
 
1883
2863
  @Field({ nullable: true })
1884
2864
  ModelSpecificResponseFormat?: string | null;
1885
2865
 
2866
+ @Field({ nullable: true })
2867
+ AIModelTypeID?: string | null;
2868
+
2869
+ @Field(() => Int, { nullable: true })
2870
+ MinPowerRank?: number | null;
2871
+
2872
+ @Field({ nullable: true })
2873
+ SelectionStrategy?: string;
2874
+
2875
+ @Field({ nullable: true })
2876
+ PowerPreference?: string;
2877
+
2878
+ @Field({ nullable: true })
2879
+ ParallelizationMode?: string;
2880
+
2881
+ @Field(() => Int, { nullable: true })
2882
+ ParallelCount?: number | null;
2883
+
2884
+ @Field({ nullable: true })
2885
+ ParallelConfigParam?: string | null;
2886
+
2887
+ @Field({ nullable: true })
2888
+ OutputType?: string;
2889
+
2890
+ @Field({ nullable: true })
2891
+ OutputExample?: string | null;
2892
+
2893
+ @Field({ nullable: true })
2894
+ ValidationBehavior?: string;
2895
+
2896
+ @Field(() => Int, { nullable: true })
2897
+ MaxRetries?: number;
2898
+
2899
+ @Field(() => Int, { nullable: true })
2900
+ RetryDelayMS?: number;
2901
+
2902
+ @Field({ nullable: true })
2903
+ RetryStrategy?: string;
2904
+
2905
+ @Field({ nullable: true })
2906
+ ResultSelectorPromptID?: string | null;
2907
+
2908
+ @Field(() => Boolean, { nullable: true })
2909
+ EnableCaching?: boolean;
2910
+
2911
+ @Field(() => Int, { nullable: true })
2912
+ CacheTTLSeconds?: number | null;
2913
+
2914
+ @Field({ nullable: true })
2915
+ CacheMatchType?: string;
2916
+
2917
+ @Field(() => Float, { nullable: true })
2918
+ CacheSimilarityThreshold?: number | null;
2919
+
2920
+ @Field(() => Boolean, { nullable: true })
2921
+ CacheMustMatchModel?: boolean;
2922
+
2923
+ @Field(() => Boolean, { nullable: true })
2924
+ CacheMustMatchVendor?: boolean;
2925
+
2926
+ @Field(() => Boolean, { nullable: true })
2927
+ CacheMustMatchAgent?: boolean;
2928
+
2929
+ @Field(() => Boolean, { nullable: true })
2930
+ CacheMustMatchConfig?: boolean;
2931
+
1886
2932
  @Field(() => [KeyValuePairInput], { nullable: true })
1887
2933
  OldValues___?: KeyValuePairInput[];
1888
2934
  }
@@ -1952,6 +2998,69 @@ export class AIPromptResolver extends ResolverBase {
1952
2998
  return result;
1953
2999
  }
1954
3000
 
3001
+ @FieldResolver(() => [AIConfiguration_])
3002
+ async MJ_AIConfigurations_DefaultPromptForContextCompressionIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3003
+ this.CheckUserReadPermissions('MJ: AI Configurations', userPayload);
3004
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3005
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIConfigurations] WHERE [DefaultPromptForContextCompressionID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Configurations', userPayload, EntityPermissionType.Read, 'AND');
3006
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Configurations', await dataSource.query(sSQL));
3007
+ return result;
3008
+ }
3009
+
3010
+ @FieldResolver(() => [AIConfiguration_])
3011
+ async MJ_AIConfigurations_DefaultPromptForContextSummarizationIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3012
+ this.CheckUserReadPermissions('MJ: AI Configurations', userPayload);
3013
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3014
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIConfigurations] WHERE [DefaultPromptForContextSummarizationID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Configurations', userPayload, EntityPermissionType.Read, 'AND');
3015
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Configurations', await dataSource.query(sSQL));
3016
+ return result;
3017
+ }
3018
+
3019
+ @FieldResolver(() => [AIPrompt_])
3020
+ async AIPrompts_ResultSelectorPromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3021
+ this.CheckUserReadPermissions('AI Prompts', userPayload);
3022
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3023
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPrompts] WHERE [ResultSelectorPromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause('AI Prompts', userPayload, EntityPermissionType.Read, 'AND');
3024
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Prompts', await dataSource.query(sSQL));
3025
+ return result;
3026
+ }
3027
+
3028
+ @FieldResolver(() => [AIPromptModel_])
3029
+ async MJ_AIPromptModels_PromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3030
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
3031
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3032
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [PromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
3033
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', await dataSource.query(sSQL));
3034
+ return result;
3035
+ }
3036
+
3037
+ @FieldResolver(() => [AIAgentPrompt_])
3038
+ async MJ_AIAgentPrompts_PromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3039
+ this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
3040
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3041
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [PromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
3042
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Prompts', await dataSource.query(sSQL));
3043
+ return result;
3044
+ }
3045
+
3046
+ @FieldResolver(() => [AIPromptRun_])
3047
+ async MJ_AIPromptRuns_PromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3048
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
3049
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3050
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [PromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
3051
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', await dataSource.query(sSQL));
3052
+ return result;
3053
+ }
3054
+
3055
+ @FieldResolver(() => [AIAgent_])
3056
+ async AIAgents_ContextCompressionPromptIDArray(@Root() aiprompt_: AIPrompt_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3057
+ this.CheckUserReadPermissions('AI Agents', userPayload);
3058
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
3059
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgents] WHERE [ContextCompressionPromptID]='${aiprompt_.ID}' ` + this.getRowLevelSecurityWhereClause('AI Agents', userPayload, EntityPermissionType.Read, 'AND');
3060
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Agents', await dataSource.query(sSQL));
3061
+ return result;
3062
+ }
3063
+
1955
3064
  @Mutation(() => AIPrompt_)
1956
3065
  async CreateAIPrompt(
1957
3066
  @Arg('input', () => CreateAIPromptInput) input: CreateAIPromptInput,
@@ -2024,6 +3133,25 @@ export class AIResultCache_ {
2024
3133
  @MaxLength(10)
2025
3134
  _mj__UpdatedAt: Date;
2026
3135
 
3136
+ @Field({nullable: true, description: `The vendor that provided this result.`})
3137
+ @MaxLength(16)
3138
+ VendorID?: string;
3139
+
3140
+ @Field({nullable: true, description: `The agent that initiated the request, if any.`})
3141
+ @MaxLength(16)
3142
+ AgentID?: string;
3143
+
3144
+ @Field({nullable: true, description: `The configuration used for this execution.`})
3145
+ @MaxLength(16)
3146
+ ConfigurationID?: string;
3147
+
3148
+ @Field(() => Int, {nullable: true, description: `Vector representation of the prompt for similarity matching.`})
3149
+ PromptEmbedding?: number;
3150
+
3151
+ @Field({nullable: true, description: `Reference to the AIPromptRun that created this cache entry.`})
3152
+ @MaxLength(16)
3153
+ PromptRunID?: string;
3154
+
2027
3155
  @Field()
2028
3156
  @MaxLength(510)
2029
3157
  AIPrompt: string;
@@ -2032,6 +3160,18 @@ export class AIResultCache_ {
2032
3160
  @MaxLength(100)
2033
3161
  AIModel: string;
2034
3162
 
3163
+ @Field({nullable: true})
3164
+ @MaxLength(100)
3165
+ Vendor?: string;
3166
+
3167
+ @Field({nullable: true})
3168
+ @MaxLength(510)
3169
+ Agent?: string;
3170
+
3171
+ @Field({nullable: true})
3172
+ @MaxLength(200)
3173
+ Configuration?: string;
3174
+
2035
3175
  }
2036
3176
 
2037
3177
  //****************************************************************************
@@ -2059,6 +3199,21 @@ export class CreateAIResultCacheInput {
2059
3199
 
2060
3200
  @Field({ nullable: true })
2061
3201
  ExpiredOn: Date | null;
3202
+
3203
+ @Field({ nullable: true })
3204
+ VendorID: string | null;
3205
+
3206
+ @Field({ nullable: true })
3207
+ AgentID: string | null;
3208
+
3209
+ @Field({ nullable: true })
3210
+ ConfigurationID: string | null;
3211
+
3212
+ @Field(() => Int, { nullable: true })
3213
+ PromptEmbedding: number | null;
3214
+
3215
+ @Field({ nullable: true })
3216
+ PromptRunID: string | null;
2062
3217
  }
2063
3218
 
2064
3219
 
@@ -2091,6 +3246,21 @@ export class UpdateAIResultCacheInput {
2091
3246
  @Field({ nullable: true })
2092
3247
  ExpiredOn?: Date | null;
2093
3248
 
3249
+ @Field({ nullable: true })
3250
+ VendorID?: string | null;
3251
+
3252
+ @Field({ nullable: true })
3253
+ AgentID?: string | null;
3254
+
3255
+ @Field({ nullable: true })
3256
+ ConfigurationID?: string | null;
3257
+
3258
+ @Field(() => Int, { nullable: true })
3259
+ PromptEmbedding?: number | null;
3260
+
3261
+ @Field({ nullable: true })
3262
+ PromptRunID?: string | null;
3263
+
2094
3264
  @Field(() => [KeyValuePairInput], { nullable: true })
2095
3265
  OldValues___?: KeyValuePairInput[];
2096
3266
  }
@@ -5235,6 +6405,20 @@ export class Entity_ {
5235
6405
  @Field({nullable: true, description: `An optional ORDER BY clause for row packing when RowsToPackWithSchema is set to Sample. Allows custom ordering for selected entity data when using top n and bottom n.`})
5236
6406
  RowsToPackSampleOrder?: string;
5237
6407
 
6408
+ @Field(() => Int, {nullable: true, description: `Frequency in hours for automatically performing row counts on this entity. If NULL, automatic row counting is disabled. If greater than 0, schedules recurring SELECT COUNT(*) queries at the specified interval.`})
6409
+ AutoRowCountFrequency?: number;
6410
+
6411
+ @Field(() => Int, {nullable: true, description: `Cached row count for this entity, populated by automatic row count processes when AutoRowCountFrequency is configured.`})
6412
+ RowCount?: number;
6413
+
6414
+ @Field({nullable: true, description: `Timestamp indicating when the last automatic row count was performed for this entity.`})
6415
+ @MaxLength(10)
6416
+ RowCountRunAt?: Date;
6417
+
6418
+ @Field({description: `Status of the entity. Active: fully functional; Deprecated: functional but generates console warnings when used; Disabled: not available for use even though metadata and physical table remain.`})
6419
+ @MaxLength(50)
6420
+ Status: string;
6421
+
5238
6422
  @Field({nullable: true})
5239
6423
  CodeName?: string;
5240
6424
 
@@ -5514,6 +6698,18 @@ export class CreateEntityInput {
5514
6698
 
5515
6699
  @Field({ nullable: true })
5516
6700
  RowsToPackSampleOrder: string | null;
6701
+
6702
+ @Field(() => Int, { nullable: true })
6703
+ AutoRowCountFrequency: number | null;
6704
+
6705
+ @Field(() => Int, { nullable: true })
6706
+ RowCount: number | null;
6707
+
6708
+ @Field({ nullable: true })
6709
+ RowCountRunAt: Date | null;
6710
+
6711
+ @Field({ nullable: true })
6712
+ Status?: string;
5517
6713
  }
5518
6714
 
5519
6715
 
@@ -5666,6 +6862,18 @@ export class UpdateEntityInput {
5666
6862
  @Field({ nullable: true })
5667
6863
  RowsToPackSampleOrder?: string | null;
5668
6864
 
6865
+ @Field(() => Int, { nullable: true })
6866
+ AutoRowCountFrequency?: number | null;
6867
+
6868
+ @Field(() => Int, { nullable: true })
6869
+ RowCount?: number | null;
6870
+
6871
+ @Field({ nullable: true })
6872
+ RowCountRunAt?: Date | null;
6873
+
6874
+ @Field({ nullable: true })
6875
+ Status?: string;
6876
+
5669
6877
  @Field(() => [KeyValuePairInput], { nullable: true })
5670
6878
  OldValues___?: KeyValuePairInput[];
5671
6879
  }
@@ -6271,24 +7479,30 @@ export class User_ {
6271
7479
  @Field(() => [UserFavorite_])
6272
7480
  UserFavorites_UserIDArray: UserFavorite_[]; // Link to UserFavorites
6273
7481
 
7482
+ @Field(() => [ResourceLink_])
7483
+ ResourceLinks_UserIDArray: ResourceLink_[]; // Link to ResourceLinks
7484
+
6274
7485
  @Field(() => [ListCategory_])
6275
7486
  ListCategories_UserIDArray: ListCategory_[]; // Link to ListCategories
6276
7487
 
6277
7488
  @Field(() => [ScheduledAction_])
6278
7489
  ScheduledActions_CreatedByUserIDArray: ScheduledAction_[]; // Link to ScheduledActions
6279
7490
 
6280
- @Field(() => [ResourceLink_])
6281
- ResourceLinks_UserIDArray: ResourceLink_[]; // Link to ResourceLinks
6282
-
6283
7491
  @Field(() => [AIAgentRequest_])
6284
7492
  AIAgentRequests_ResponseByUserIDArray: AIAgentRequest_[]; // Link to AIAgentRequests
6285
7493
 
7494
+ @Field(() => [DashboardUserPreference_])
7495
+ MJ_DashboardUserPreferences_UserIDArray: DashboardUserPreference_[]; // Link to MJ_DashboardUserPreferences
7496
+
6286
7497
  @Field(() => [ReportUserState_])
6287
7498
  MJ_ReportUserStates_UserIDArray: ReportUserState_[]; // Link to MJ_ReportUserStates
6288
7499
 
6289
7500
  @Field(() => [AIAgentNote_])
6290
7501
  AIAgentNotes_UserIDArray: AIAgentNote_[]; // Link to AIAgentNotes
6291
7502
 
7503
+ @Field(() => [DashboardUserState_])
7504
+ MJ_DashboardUserStates_UserIDArray: DashboardUserState_[]; // Link to MJ_DashboardUserStates
7505
+
6292
7506
  @Field(() => [ResourcePermission_])
6293
7507
  ResourcePermissions_UserIDArray: ResourcePermission_[]; // Link to ResourcePermissions
6294
7508
 
@@ -6720,6 +7934,15 @@ export class UserResolverBase extends ResolverBase {
6720
7934
  return result;
6721
7935
  }
6722
7936
 
7937
+ @FieldResolver(() => [ResourceLink_])
7938
+ async ResourceLinks_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
7939
+ this.CheckUserReadPermissions('Resource Links', userPayload);
7940
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
7941
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwResourceLinks] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause('Resource Links', userPayload, EntityPermissionType.Read, 'AND');
7942
+ const result = this.ArrayMapFieldNamesToCodeNames('Resource Links', await dataSource.query(sSQL));
7943
+ return result;
7944
+ }
7945
+
6723
7946
  @FieldResolver(() => [ListCategory_])
6724
7947
  async ListCategories_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
6725
7948
  this.CheckUserReadPermissions('List Categories', userPayload);
@@ -6738,15 +7961,6 @@ export class UserResolverBase extends ResolverBase {
6738
7961
  return result;
6739
7962
  }
6740
7963
 
6741
- @FieldResolver(() => [ResourceLink_])
6742
- async ResourceLinks_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
6743
- this.CheckUserReadPermissions('Resource Links', userPayload);
6744
- const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
6745
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwResourceLinks] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause('Resource Links', userPayload, EntityPermissionType.Read, 'AND');
6746
- const result = this.ArrayMapFieldNamesToCodeNames('Resource Links', await dataSource.query(sSQL));
6747
- return result;
6748
- }
6749
-
6750
7964
  @FieldResolver(() => [AIAgentRequest_])
6751
7965
  async AIAgentRequests_ResponseByUserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
6752
7966
  this.CheckUserReadPermissions('AI Agent Requests', userPayload);
@@ -6756,6 +7970,15 @@ export class UserResolverBase extends ResolverBase {
6756
7970
  return result;
6757
7971
  }
6758
7972
 
7973
+ @FieldResolver(() => [DashboardUserPreference_])
7974
+ async MJ_DashboardUserPreferences_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
7975
+ this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
7976
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
7977
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
7978
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', await dataSource.query(sSQL));
7979
+ return result;
7980
+ }
7981
+
6759
7982
  @FieldResolver(() => [ReportUserState_])
6760
7983
  async MJ_ReportUserStates_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
6761
7984
  this.CheckUserReadPermissions('MJ: Report User States', userPayload);
@@ -6774,6 +7997,15 @@ export class UserResolverBase extends ResolverBase {
6774
7997
  return result;
6775
7998
  }
6776
7999
 
8000
+ @FieldResolver(() => [DashboardUserState_])
8001
+ async MJ_DashboardUserStates_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8002
+ this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
8003
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
8004
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
8005
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', await dataSource.query(sSQL));
8006
+ return result;
8007
+ }
8008
+
6777
8009
  @FieldResolver(() => [ResourcePermission_])
6778
8010
  async ResourcePermissions_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
6779
8011
  this.CheckUserReadPermissions('Resource Permissions', userPayload);
@@ -7423,6 +8655,9 @@ export class UserView_ {
7423
8655
  @MaxLength(10)
7424
8656
  _mj__UpdatedAt: Date;
7425
8657
 
8658
+ @Field({nullable: true, description: `Thumbnail image for the user view that can be displayed in gallery views. Can contain either a URL to an image file or a Base64-encoded image string.`})
8659
+ Thumbnail?: string;
8660
+
7426
8661
  @Field()
7427
8662
  @MaxLength(200)
7428
8663
  UserName: string;
@@ -7513,6 +8748,9 @@ export class CreateUserViewInput {
7513
8748
 
7514
8749
  @Field({ nullable: true })
7515
8750
  SortState: string | null;
8751
+
8752
+ @Field({ nullable: true })
8753
+ Thumbnail: string | null;
7516
8754
  }
7517
8755
 
7518
8756
 
@@ -7575,6 +8813,9 @@ export class UpdateUserViewInput {
7575
8813
  @Field({ nullable: true })
7576
8814
  SortState?: string | null;
7577
8815
 
8816
+ @Field({ nullable: true })
8817
+ Thumbnail?: string | null;
8818
+
7578
8819
  @Field(() => [KeyValuePairInput], { nullable: true })
7579
8820
  OldValues___?: KeyValuePairInput[];
7580
8821
  }
@@ -8374,6 +9615,9 @@ export class Application_ {
8374
9615
  @MaxLength(10)
8375
9616
  _mj__UpdatedAt: Date;
8376
9617
 
9618
+ @Field({nullable: true, description: `Comma-delimited list of schema names where entities will be automatically added to the application when created in those schemas`})
9619
+ SchemaAutoAddNewEntities?: string;
9620
+
8377
9621
  @Field(() => [ApplicationSetting_])
8378
9622
  ApplicationSettings_ApplicationIDArray: ApplicationSetting_[]; // Link to ApplicationSettings
8379
9623
 
@@ -8383,6 +9627,12 @@ export class Application_ {
8383
9627
  @Field(() => [ApplicationEntity_])
8384
9628
  ApplicationEntities_ApplicationIDArray: ApplicationEntity_[]; // Link to ApplicationEntities
8385
9629
 
9630
+ @Field(() => [Dashboard_])
9631
+ Dashboards_ApplicationIDArray: Dashboard_[]; // Link to Dashboards
9632
+
9633
+ @Field(() => [DashboardUserPreference_])
9634
+ MJ_DashboardUserPreferences_ApplicationIDArray: DashboardUserPreference_[]; // Link to MJ_DashboardUserPreferences
9635
+
8386
9636
  }
8387
9637
 
8388
9638
  //****************************************************************************
@@ -8401,6 +9651,9 @@ export class CreateApplicationInput {
8401
9651
 
8402
9652
  @Field(() => Boolean, { nullable: true })
8403
9653
  DefaultForNewUser?: boolean;
9654
+
9655
+ @Field({ nullable: true })
9656
+ SchemaAutoAddNewEntities: string | null;
8404
9657
  }
8405
9658
 
8406
9659
 
@@ -8424,6 +9677,9 @@ export class UpdateApplicationInput {
8424
9677
  @Field(() => Boolean, { nullable: true })
8425
9678
  DefaultForNewUser?: boolean;
8426
9679
 
9680
+ @Field({ nullable: true })
9681
+ SchemaAutoAddNewEntities?: string | null;
9682
+
8427
9683
  @Field(() => [KeyValuePairInput], { nullable: true })
8428
9684
  OldValues___?: KeyValuePairInput[];
8429
9685
  }
@@ -8520,6 +9776,24 @@ export class ApplicationResolver extends ResolverBase {
8520
9776
  return result;
8521
9777
  }
8522
9778
 
9779
+ @FieldResolver(() => [Dashboard_])
9780
+ async Dashboards_ApplicationIDArray(@Root() application_: Application_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9781
+ this.CheckUserReadPermissions('Dashboards', userPayload);
9782
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
9783
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboards] WHERE [ApplicationID]='${application_.ID}' ` + this.getRowLevelSecurityWhereClause('Dashboards', userPayload, EntityPermissionType.Read, 'AND');
9784
+ const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', await dataSource.query(sSQL));
9785
+ return result;
9786
+ }
9787
+
9788
+ @FieldResolver(() => [DashboardUserPreference_])
9789
+ async MJ_DashboardUserPreferences_ApplicationIDArray(@Root() application_: Application_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9790
+ this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
9791
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
9792
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [ApplicationID]='${application_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
9793
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', await dataSource.query(sSQL));
9794
+ return result;
9795
+ }
9796
+
8523
9797
  @Mutation(() => Application_)
8524
9798
  async CreateApplication(
8525
9799
  @Arg('input', () => CreateApplicationInput) input: CreateApplicationInput,
@@ -11973,10 +13247,6 @@ export class AIModel_ {
11973
13247
  @Field({nullable: true})
11974
13248
  Description?: string;
11975
13249
 
11976
- @Field({nullable: true})
11977
- @MaxLength(100)
11978
- Vendor?: string;
11979
-
11980
13250
  @Field()
11981
13251
  @MaxLength(16)
11982
13252
  AIModelTypeID: string;
@@ -11987,18 +13257,6 @@ export class AIModel_ {
11987
13257
  @Field(() => Boolean)
11988
13258
  IsActive: boolean;
11989
13259
 
11990
- @Field({nullable: true})
11991
- @MaxLength(200)
11992
- DriverClass?: string;
11993
-
11994
- @Field({nullable: true})
11995
- @MaxLength(510)
11996
- DriverImportPath?: string;
11997
-
11998
- @Field({nullable: true, description: `The name of the model to use with API calls which might differ from the Name, if APIName is not provided, Name will be used for API calls`})
11999
- @MaxLength(200)
12000
- APIName?: string;
12001
-
12002
13260
  @Field()
12003
13261
  @MaxLength(10)
12004
13262
  _mj__CreatedAt: Date;
@@ -12016,19 +13274,35 @@ export class AIModel_ {
12016
13274
  @Field({nullable: true, description: `This column stores unstructured text notes that provide insights into what the model is particularly good at and areas where it may not perform as well. These notes can be used by a human or an AI to determine if the model is a good fit for various purposes.`})
12017
13275
  ModelSelectionInsights?: string;
12018
13276
 
12019
- @Field(() => Int, {nullable: true, description: `Stores the maximum number of tokens that fit in the context window for the model.`})
12020
- InputTokenLimit?: number;
13277
+ @Field()
13278
+ @MaxLength(100)
13279
+ AIModelType: string;
13280
+
13281
+ @Field({nullable: true})
13282
+ @MaxLength(100)
13283
+ Vendor?: string;
12021
13284
 
12022
- @Field({description: `A comma-delimited string indicating the supported response formats for the AI model. Options include Any, Text, Markdown, JSON, and ModelSpecific. Defaults to Any if not specified.`})
13285
+ @Field({nullable: true})
12023
13286
  @MaxLength(200)
12024
- SupportedResponseFormats: string;
13287
+ DriverClass?: string;
12025
13288
 
12026
- @Field(() => Boolean, {description: `Specifies if the model supports the concept of an effort level. For example, for a reasoning model, the options often include low, medium, and high.`})
12027
- SupportsEffortLevel: boolean;
13289
+ @Field({nullable: true})
13290
+ @MaxLength(510)
13291
+ DriverImportPath?: string;
12028
13292
 
12029
- @Field()
12030
- @MaxLength(100)
12031
- AIModelType: string;
13293
+ @Field({nullable: true})
13294
+ @MaxLength(200)
13295
+ APIName?: string;
13296
+
13297
+ @Field(() => Int, {nullable: true})
13298
+ InputTokenLimit?: number;
13299
+
13300
+ @Field({nullable: true})
13301
+ @MaxLength(200)
13302
+ SupportedResponseFormats?: string;
13303
+
13304
+ @Field(() => Boolean, {nullable: true})
13305
+ SupportsEffortLevel?: boolean;
12032
13306
 
12033
13307
  @Field(() => [AIAction_])
12034
13308
  AIActions_DefaultModelIDArray: AIAction_[]; // Link to AIActions
@@ -12051,12 +13325,21 @@ export class AIModel_ {
12051
13325
  @Field(() => [EntityAIAction_])
12052
13326
  EntityAIActions_AIModelIDArray: EntityAIAction_[]; // Link to EntityAIActions
12053
13327
 
13328
+ @Field(() => [AIModelVendor_])
13329
+ MJ_AIModelVendors_ModelIDArray: AIModelVendor_[]; // Link to MJ_AIModelVendors
13330
+
12054
13331
  @Field(() => [AIAgentModel_])
12055
13332
  AIAgentModels_ModelIDArray: AIAgentModel_[]; // Link to AIAgentModels
12056
13333
 
12057
13334
  @Field(() => [GeneratedCode_])
12058
13335
  GeneratedCodes_GeneratedByModelIDArray: GeneratedCode_[]; // Link to GeneratedCodes
12059
13336
 
13337
+ @Field(() => [AIPromptModel_])
13338
+ MJ_AIPromptModels_ModelIDArray: AIPromptModel_[]; // Link to MJ_AIPromptModels
13339
+
13340
+ @Field(() => [AIPromptRun_])
13341
+ MJ_AIPromptRuns_ModelIDArray: AIPromptRun_[]; // Link to MJ_AIPromptRuns
13342
+
12060
13343
  }
12061
13344
 
12062
13345
  //****************************************************************************
@@ -12070,9 +13353,6 @@ export class CreateAIModelInput {
12070
13353
  @Field({ nullable: true })
12071
13354
  Description: string | null;
12072
13355
 
12073
- @Field({ nullable: true })
12074
- Vendor: string | null;
12075
-
12076
13356
  @Field({ nullable: true })
12077
13357
  AIModelTypeID?: string;
12078
13358
 
@@ -12082,15 +13362,6 @@ export class CreateAIModelInput {
12082
13362
  @Field(() => Boolean, { nullable: true })
12083
13363
  IsActive?: boolean;
12084
13364
 
12085
- @Field({ nullable: true })
12086
- DriverClass: string | null;
12087
-
12088
- @Field({ nullable: true })
12089
- DriverImportPath: string | null;
12090
-
12091
- @Field({ nullable: true })
12092
- APIName: string | null;
12093
-
12094
13365
  @Field(() => Int, { nullable: true })
12095
13366
  SpeedRank?: number | null;
12096
13367
 
@@ -12099,15 +13370,6 @@ export class CreateAIModelInput {
12099
13370
 
12100
13371
  @Field({ nullable: true })
12101
13372
  ModelSelectionInsights: string | null;
12102
-
12103
- @Field(() => Int, { nullable: true })
12104
- InputTokenLimit: number | null;
12105
-
12106
- @Field({ nullable: true })
12107
- SupportedResponseFormats?: string;
12108
-
12109
- @Field(() => Boolean, { nullable: true })
12110
- SupportsEffortLevel?: boolean;
12111
13373
  }
12112
13374
 
12113
13375
 
@@ -12125,9 +13387,6 @@ export class UpdateAIModelInput {
12125
13387
  @Field({ nullable: true })
12126
13388
  Description?: string | null;
12127
13389
 
12128
- @Field({ nullable: true })
12129
- Vendor?: string | null;
12130
-
12131
13390
  @Field({ nullable: true })
12132
13391
  AIModelTypeID?: string;
12133
13392
 
@@ -12137,15 +13396,6 @@ export class UpdateAIModelInput {
12137
13396
  @Field(() => Boolean, { nullable: true })
12138
13397
  IsActive?: boolean;
12139
13398
 
12140
- @Field({ nullable: true })
12141
- DriverClass?: string | null;
12142
-
12143
- @Field({ nullable: true })
12144
- DriverImportPath?: string | null;
12145
-
12146
- @Field({ nullable: true })
12147
- APIName?: string | null;
12148
-
12149
13399
  @Field(() => Int, { nullable: true })
12150
13400
  SpeedRank?: number | null;
12151
13401
 
@@ -12155,15 +13405,6 @@ export class UpdateAIModelInput {
12155
13405
  @Field({ nullable: true })
12156
13406
  ModelSelectionInsights?: string | null;
12157
13407
 
12158
- @Field(() => Int, { nullable: true })
12159
- InputTokenLimit?: number | null;
12160
-
12161
- @Field({ nullable: true })
12162
- SupportedResponseFormats?: string;
12163
-
12164
- @Field(() => Boolean, { nullable: true })
12165
- SupportsEffortLevel?: boolean;
12166
-
12167
13408
  @Field(() => [KeyValuePairInput], { nullable: true })
12168
13409
  OldValues___?: KeyValuePairInput[];
12169
13410
  }
@@ -12296,6 +13537,15 @@ export class AIModelResolver extends ResolverBase {
12296
13537
  return result;
12297
13538
  }
12298
13539
 
13540
+ @FieldResolver(() => [AIModelVendor_])
13541
+ async MJ_AIModelVendors_ModelIDArray(@Root() aimodel_: AIModel_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
13542
+ this.CheckUserReadPermissions('MJ: AI Model Vendors', userPayload);
13543
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13544
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIModelVendors] WHERE [ModelID]='${aimodel_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Model Vendors', userPayload, EntityPermissionType.Read, 'AND');
13545
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Model Vendors', await dataSource.query(sSQL));
13546
+ return result;
13547
+ }
13548
+
12299
13549
  @FieldResolver(() => [AIAgentModel_])
12300
13550
  async AIAgentModels_ModelIDArray(@Root() aimodel_: AIModel_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12301
13551
  this.CheckUserReadPermissions('AI Agent Models', userPayload);
@@ -12314,6 +13564,24 @@ export class AIModelResolver extends ResolverBase {
12314
13564
  return result;
12315
13565
  }
12316
13566
 
13567
+ @FieldResolver(() => [AIPromptModel_])
13568
+ async MJ_AIPromptModels_ModelIDArray(@Root() aimodel_: AIModel_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
13569
+ this.CheckUserReadPermissions('MJ: AI Prompt Models', userPayload);
13570
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13571
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptModels] WHERE [ModelID]='${aimodel_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Models', userPayload, EntityPermissionType.Read, 'AND');
13572
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Models', await dataSource.query(sSQL));
13573
+ return result;
13574
+ }
13575
+
13576
+ @FieldResolver(() => [AIPromptRun_])
13577
+ async MJ_AIPromptRuns_ModelIDArray(@Root() aimodel_: AIModel_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
13578
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
13579
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
13580
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ModelID]='${aimodel_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
13581
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Prompt Runs', await dataSource.query(sSQL));
13582
+ return result;
13583
+ }
13584
+
12317
13585
  @Mutation(() => AIModel_)
12318
13586
  async CreateAIModel(
12319
13587
  @Arg('input', () => CreateAIModelInput) input: CreateAIModelInput,
@@ -13010,6 +14278,9 @@ export class AIModelType_ {
13010
14278
  @Field(() => [AIModel_])
13011
14279
  AIModels_AIModelTypeIDArray: AIModel_[]; // Link to AIModels
13012
14280
 
14281
+ @Field(() => [AIPrompt_])
14282
+ AIPrompts_AIModelTypeIDArray: AIPrompt_[]; // Link to AIPrompts
14283
+
13013
14284
  }
13014
14285
 
13015
14286
  //****************************************************************************
@@ -13117,6 +14388,15 @@ export class AIModelTypeResolver extends ResolverBase {
13117
14388
  return result;
13118
14389
  }
13119
14390
 
14391
+ @FieldResolver(() => [AIPrompt_])
14392
+ async AIPrompts_AIModelTypeIDArray(@Root() aimodeltype_: AIModelType_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
14393
+ this.CheckUserReadPermissions('AI Prompts', userPayload);
14394
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
14395
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPrompts] WHERE [AIModelTypeID]='${aimodeltype_.ID}' ` + this.getRowLevelSecurityWhereClause('AI Prompts', userPayload, EntityPermissionType.Read, 'AND');
14396
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Prompts', await dataSource.query(sSQL));
14397
+ return result;
14398
+ }
14399
+
13120
14400
  @Mutation(() => AIModelType_)
13121
14401
  async CreateAIModelType(
13122
14402
  @Arg('input', () => CreateAIModelTypeInput) input: CreateAIModelTypeInput,
@@ -13781,6 +15061,29 @@ export class Dashboard_ {
13781
15061
  @MaxLength(10)
13782
15062
  _mj__UpdatedAt: Date;
13783
15063
 
15064
+ @Field({description: `Specifies if the dashboard is metadata-driven (Config) or code-based (Code)`})
15065
+ @MaxLength(40)
15066
+ Type: string;
15067
+
15068
+ @Field({nullable: true, description: `Base64 encoded image or URL to an image thumbnail for the dashboard`})
15069
+ Thumbnail?: string;
15070
+
15071
+ @Field({description: `Scope of the dashboard: Global or App-specific`})
15072
+ @MaxLength(40)
15073
+ Scope: string;
15074
+
15075
+ @Field({nullable: true, description: `Associated Application ID if Scope is App, otherwise NULL`})
15076
+ @MaxLength(16)
15077
+ ApplicationID?: string;
15078
+
15079
+ @Field({nullable: true, description: `Used to identify the dashboard for code-base dashboards. Allows reuse of the same DriverClass for multiple dashboards that can be rendered differently.`})
15080
+ @MaxLength(510)
15081
+ Code?: string;
15082
+
15083
+ @Field({nullable: true, description: `Specifies the runtime class that will be used for the Dashboard when Type is set to 'Code'. This class contains the custom logic and implementation for code-based dashboards.`})
15084
+ @MaxLength(510)
15085
+ DriverClass?: string;
15086
+
13784
15087
  @Field()
13785
15088
  @MaxLength(200)
13786
15089
  User: string;
@@ -13789,6 +15092,16 @@ export class Dashboard_ {
13789
15092
  @MaxLength(200)
13790
15093
  Category?: string;
13791
15094
 
15095
+ @Field({nullable: true})
15096
+ @MaxLength(200)
15097
+ Application?: string;
15098
+
15099
+ @Field(() => [DashboardUserState_])
15100
+ MJ_DashboardUserStates_DashboardIDArray: DashboardUserState_[]; // Link to MJ_DashboardUserStates
15101
+
15102
+ @Field(() => [DashboardUserPreference_])
15103
+ MJ_DashboardUserPreferences_DashboardIDArray: DashboardUserPreference_[]; // Link to MJ_DashboardUserPreferences
15104
+
13792
15105
  }
13793
15106
 
13794
15107
  //****************************************************************************
@@ -13810,6 +15123,24 @@ export class CreateDashboardInput {
13810
15123
 
13811
15124
  @Field({ nullable: true })
13812
15125
  UIConfigDetails?: string;
15126
+
15127
+ @Field({ nullable: true })
15128
+ Type?: string;
15129
+
15130
+ @Field({ nullable: true })
15131
+ Thumbnail: string | null;
15132
+
15133
+ @Field({ nullable: true })
15134
+ Scope?: string;
15135
+
15136
+ @Field({ nullable: true })
15137
+ ApplicationID: string | null;
15138
+
15139
+ @Field({ nullable: true })
15140
+ Code: string | null;
15141
+
15142
+ @Field({ nullable: true })
15143
+ DriverClass: string | null;
13813
15144
  }
13814
15145
 
13815
15146
 
@@ -13836,6 +15167,24 @@ export class UpdateDashboardInput {
13836
15167
  @Field({ nullable: true })
13837
15168
  UIConfigDetails?: string;
13838
15169
 
15170
+ @Field({ nullable: true })
15171
+ Type?: string;
15172
+
15173
+ @Field({ nullable: true })
15174
+ Thumbnail?: string | null;
15175
+
15176
+ @Field({ nullable: true })
15177
+ Scope?: string;
15178
+
15179
+ @Field({ nullable: true })
15180
+ ApplicationID?: string | null;
15181
+
15182
+ @Field({ nullable: true })
15183
+ Code?: string | null;
15184
+
15185
+ @Field({ nullable: true })
15186
+ DriverClass?: string | null;
15187
+
13839
15188
  @Field(() => [KeyValuePairInput], { nullable: true })
13840
15189
  OldValues___?: KeyValuePairInput[];
13841
15190
  }
@@ -13896,6 +15245,24 @@ export class DashboardResolver extends ResolverBase {
13896
15245
  return result;
13897
15246
  }
13898
15247
 
15248
+ @FieldResolver(() => [DashboardUserState_])
15249
+ async MJ_DashboardUserStates_DashboardIDArray(@Root() dashboard_: Dashboard_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
15250
+ this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
15251
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
15252
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [DashboardID]='${dashboard_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
15253
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User States', await dataSource.query(sSQL));
15254
+ return result;
15255
+ }
15256
+
15257
+ @FieldResolver(() => [DashboardUserPreference_])
15258
+ async MJ_DashboardUserPreferences_DashboardIDArray(@Root() dashboard_: Dashboard_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
15259
+ this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
15260
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
15261
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [DashboardID]='${dashboard_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
15262
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard User Preferences', await dataSource.query(sSQL));
15263
+ return result;
15264
+ }
15265
+
13899
15266
  @Mutation(() => Dashboard_)
13900
15267
  async CreateDashboard(
13901
15268
  @Arg('input', () => CreateDashboardInput) input: CreateDashboardInput,
@@ -14288,6 +15655,9 @@ export class Report_ {
14288
15655
  @MaxLength(10)
14289
15656
  _mj__UpdatedAt: Date;
14290
15657
 
15658
+ @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.`})
15659
+ Thumbnail?: string;
15660
+
14291
15661
  @Field({nullable: true})
14292
15662
  @MaxLength(200)
14293
15663
  Category?: string;
@@ -14380,6 +15750,9 @@ export class CreateReportInput {
14380
15750
 
14381
15751
  @Field({ nullable: true })
14382
15752
  OutputWorkflowID: string | null;
15753
+
15754
+ @Field({ nullable: true })
15755
+ Thumbnail: string | null;
14383
15756
  }
14384
15757
 
14385
15758
 
@@ -14436,6 +15809,9 @@ export class UpdateReportInput {
14436
15809
  @Field({ nullable: true })
14437
15810
  OutputWorkflowID?: string | null;
14438
15811
 
15812
+ @Field({ nullable: true })
15813
+ Thumbnail?: string | null;
15814
+
14439
15815
  @Field(() => [KeyValuePairInput], { nullable: true })
14440
15816
  OldValues___?: KeyValuePairInput[];
14441
15817
  }
@@ -29812,6 +31188,406 @@ export class AIAgentRequestResolver extends ResolverBase {
29812
31188
 
29813
31189
  }
29814
31190
 
31191
+ //****************************************************************************
31192
+ // ENTITY CLASS for MJ: AI Model Vendors
31193
+ //****************************************************************************
31194
+ @ObjectType()
31195
+ export class AIModelVendor_ {
31196
+ @Field()
31197
+ @MaxLength(16)
31198
+ ID: string;
31199
+
31200
+ @Field()
31201
+ @MaxLength(16)
31202
+ ModelID: string;
31203
+
31204
+ @Field()
31205
+ @MaxLength(16)
31206
+ VendorID: string;
31207
+
31208
+ @Field(() => Int, {description: `Determines the priority rank of this vendor for the model. Higher values indicate higher priority.`})
31209
+ Priority: number;
31210
+
31211
+ @Field({description: `The current status of this model-vendor combination. Values include Active, Inactive, Deprecated, and Preview.`})
31212
+ @MaxLength(40)
31213
+ Status: string;
31214
+
31215
+ @Field({nullable: true, description: `The name of the driver class implementing this model-vendor combination.`})
31216
+ @MaxLength(200)
31217
+ DriverClass?: string;
31218
+
31219
+ @Field({nullable: true, description: `The import path for the driver class.`})
31220
+ @MaxLength(510)
31221
+ DriverImportPath?: string;
31222
+
31223
+ @Field({nullable: true, description: `The name of the model to use with API calls, which might differ from the model name. If not provided, the model name will be used.`})
31224
+ @MaxLength(200)
31225
+ APIName?: string;
31226
+
31227
+ @Field(() => Int, {nullable: true, description: `The maximum number of input tokens supported by this model-vendor implementation.`})
31228
+ MaxInputTokens?: number;
31229
+
31230
+ @Field(() => Int, {nullable: true, description: `The maximum number of output tokens supported by this model-vendor implementation.`})
31231
+ MaxOutputTokens?: number;
31232
+
31233
+ @Field({description: `A comma-delimited string indicating the supported response formats for this model-vendor implementation. Options include Any, Text, Markdown, JSON, and ModelSpecific.`})
31234
+ @MaxLength(200)
31235
+ SupportedResponseFormats: string;
31236
+
31237
+ @Field(() => Boolean, {description: `Specifies if this model-vendor implementation supports the concept of an effort level.`})
31238
+ SupportsEffortLevel: boolean;
31239
+
31240
+ @Field(() => Boolean, {description: `Specifies if this model-vendor implementation supports streaming responses.`})
31241
+ SupportsStreaming: boolean;
31242
+
31243
+ @Field()
31244
+ @MaxLength(10)
31245
+ _mj__CreatedAt: Date;
31246
+
31247
+ @Field()
31248
+ @MaxLength(10)
31249
+ _mj__UpdatedAt: Date;
31250
+
31251
+ @Field()
31252
+ @MaxLength(100)
31253
+ Model: string;
31254
+
31255
+ @Field()
31256
+ @MaxLength(100)
31257
+ Vendor: string;
31258
+
31259
+ }
31260
+
31261
+ //****************************************************************************
31262
+ // INPUT TYPE for MJ: AI Model Vendors
31263
+ //****************************************************************************
31264
+ @InputType()
31265
+ export class CreateAIModelVendorInput {
31266
+ @Field({ nullable: true })
31267
+ ModelID?: string;
31268
+
31269
+ @Field({ nullable: true })
31270
+ VendorID?: string;
31271
+
31272
+ @Field(() => Int, { nullable: true })
31273
+ Priority?: number;
31274
+
31275
+ @Field({ nullable: true })
31276
+ Status?: string;
31277
+
31278
+ @Field({ nullable: true })
31279
+ DriverClass: string | null;
31280
+
31281
+ @Field({ nullable: true })
31282
+ DriverImportPath: string | null;
31283
+
31284
+ @Field({ nullable: true })
31285
+ APIName: string | null;
31286
+
31287
+ @Field(() => Int, { nullable: true })
31288
+ MaxInputTokens: number | null;
31289
+
31290
+ @Field(() => Int, { nullable: true })
31291
+ MaxOutputTokens: number | null;
31292
+
31293
+ @Field({ nullable: true })
31294
+ SupportedResponseFormats?: string;
31295
+
31296
+ @Field(() => Boolean, { nullable: true })
31297
+ SupportsEffortLevel?: boolean;
31298
+
31299
+ @Field(() => Boolean, { nullable: true })
31300
+ SupportsStreaming?: boolean;
31301
+ }
31302
+
31303
+
31304
+ //****************************************************************************
31305
+ // INPUT TYPE for MJ: AI Model Vendors
31306
+ //****************************************************************************
31307
+ @InputType()
31308
+ export class UpdateAIModelVendorInput {
31309
+ @Field()
31310
+ ID: string;
31311
+
31312
+ @Field({ nullable: true })
31313
+ ModelID?: string;
31314
+
31315
+ @Field({ nullable: true })
31316
+ VendorID?: string;
31317
+
31318
+ @Field(() => Int, { nullable: true })
31319
+ Priority?: number;
31320
+
31321
+ @Field({ nullable: true })
31322
+ Status?: string;
31323
+
31324
+ @Field({ nullable: true })
31325
+ DriverClass?: string | null;
31326
+
31327
+ @Field({ nullable: true })
31328
+ DriverImportPath?: string | null;
31329
+
31330
+ @Field({ nullable: true })
31331
+ APIName?: string | null;
31332
+
31333
+ @Field(() => Int, { nullable: true })
31334
+ MaxInputTokens?: number | null;
31335
+
31336
+ @Field(() => Int, { nullable: true })
31337
+ MaxOutputTokens?: number | null;
31338
+
31339
+ @Field({ nullable: true })
31340
+ SupportedResponseFormats?: string;
31341
+
31342
+ @Field(() => Boolean, { nullable: true })
31343
+ SupportsEffortLevel?: boolean;
31344
+
31345
+ @Field(() => Boolean, { nullable: true })
31346
+ SupportsStreaming?: boolean;
31347
+
31348
+ @Field(() => [KeyValuePairInput], { nullable: true })
31349
+ OldValues___?: KeyValuePairInput[];
31350
+ }
31351
+
31352
+ //****************************************************************************
31353
+ // RESOLVER for MJ: AI Model Vendors
31354
+ //****************************************************************************
31355
+ @ObjectType()
31356
+ export class RunAIModelVendorViewResult {
31357
+ @Field(() => [AIModelVendor_])
31358
+ Results: AIModelVendor_[];
31359
+
31360
+ @Field(() => String, {nullable: true})
31361
+ UserViewRunID?: string;
31362
+
31363
+ @Field(() => Int, {nullable: true})
31364
+ RowCount: number;
31365
+
31366
+ @Field(() => Int, {nullable: true})
31367
+ TotalRowCount: number;
31368
+
31369
+ @Field(() => Int, {nullable: true})
31370
+ ExecutionTime: number;
31371
+
31372
+ @Field({nullable: true})
31373
+ ErrorMessage?: string;
31374
+
31375
+ @Field(() => Boolean, {nullable: false})
31376
+ Success: boolean;
31377
+ }
31378
+
31379
+ @Resolver(AIModelVendor_)
31380
+ export class AIModelVendorResolver extends ResolverBase {
31381
+ @Query(() => RunAIModelVendorViewResult)
31382
+ async RunAIModelVendorViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31383
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31384
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
31385
+ }
31386
+
31387
+ @Query(() => RunAIModelVendorViewResult)
31388
+ async RunAIModelVendorViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31389
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31390
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
31391
+ }
31392
+
31393
+ @Query(() => RunAIModelVendorViewResult)
31394
+ async RunAIModelVendorDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31395
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31396
+ input.EntityName = 'MJ: AI Model Vendors';
31397
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
31398
+ }
31399
+ @Query(() => AIModelVendor_, { nullable: true })
31400
+ async AIModelVendor(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIModelVendor_ | null> {
31401
+ this.CheckUserReadPermissions('MJ: AI Model Vendors', userPayload);
31402
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31403
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIModelVendors] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Model Vendors', userPayload, EntityPermissionType.Read, 'AND');
31404
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Model Vendors', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
31405
+ return result;
31406
+ }
31407
+
31408
+ @Mutation(() => AIModelVendor_)
31409
+ async CreateAIModelVendor(
31410
+ @Arg('input', () => CreateAIModelVendorInput) input: CreateAIModelVendorInput,
31411
+ @Ctx() { dataSources, userPayload }: AppContext,
31412
+ @PubSub() pubSub: PubSubEngine
31413
+ ) {
31414
+ const dataSource = GetReadWriteDataSource(dataSources);
31415
+ return this.CreateRecord('MJ: AI Model Vendors', input, dataSource, userPayload, pubSub)
31416
+ }
31417
+
31418
+ @Mutation(() => AIModelVendor_)
31419
+ async UpdateAIModelVendor(
31420
+ @Arg('input', () => UpdateAIModelVendorInput) input: UpdateAIModelVendorInput,
31421
+ @Ctx() { dataSources, userPayload }: AppContext,
31422
+ @PubSub() pubSub: PubSubEngine
31423
+ ) {
31424
+ const dataSource = GetReadWriteDataSource(dataSources);
31425
+ return this.UpdateRecord('MJ: AI Model Vendors', input, dataSource, userPayload, pubSub);
31426
+ }
31427
+
31428
+ @Mutation(() => AIModelVendor_)
31429
+ async DeleteAIModelVendor(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31430
+ const dataSource = GetReadWriteDataSource(dataSources);
31431
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
31432
+ return this.DeleteRecord('MJ: AI Model Vendors', key, options, dataSource, userPayload, pubSub);
31433
+ }
31434
+
31435
+ }
31436
+
31437
+ //****************************************************************************
31438
+ // ENTITY CLASS for MJ: AI Vendor Type Definitions
31439
+ //****************************************************************************
31440
+ @ObjectType()
31441
+ export class AIVendorTypeDefinition_ {
31442
+ @Field()
31443
+ @MaxLength(16)
31444
+ ID: string;
31445
+
31446
+ @Field({description: `The name of the vendor type.`})
31447
+ @MaxLength(100)
31448
+ Name: string;
31449
+
31450
+ @Field({nullable: true, description: `Detailed description of the vendor type.`})
31451
+ Description?: string;
31452
+
31453
+ @Field()
31454
+ @MaxLength(10)
31455
+ _mj__CreatedAt: Date;
31456
+
31457
+ @Field()
31458
+ @MaxLength(10)
31459
+ _mj__UpdatedAt: Date;
31460
+
31461
+ @Field(() => [AIVendorType_])
31462
+ MJ_AIVendorTypes_TypeIDArray: AIVendorType_[]; // Link to MJ_AIVendorTypes
31463
+
31464
+ }
31465
+
31466
+ //****************************************************************************
31467
+ // INPUT TYPE for MJ: AI Vendor Type Definitions
31468
+ //****************************************************************************
31469
+ @InputType()
31470
+ export class CreateAIVendorTypeDefinitionInput {
31471
+ @Field({ nullable: true })
31472
+ Name?: string;
31473
+
31474
+ @Field({ nullable: true })
31475
+ Description: string | null;
31476
+ }
31477
+
31478
+
31479
+ //****************************************************************************
31480
+ // INPUT TYPE for MJ: AI Vendor Type Definitions
31481
+ //****************************************************************************
31482
+ @InputType()
31483
+ export class UpdateAIVendorTypeDefinitionInput {
31484
+ @Field()
31485
+ ID: string;
31486
+
31487
+ @Field({ nullable: true })
31488
+ Name?: string;
31489
+
31490
+ @Field({ nullable: true })
31491
+ Description?: string | null;
31492
+
31493
+ @Field(() => [KeyValuePairInput], { nullable: true })
31494
+ OldValues___?: KeyValuePairInput[];
31495
+ }
31496
+
31497
+ //****************************************************************************
31498
+ // RESOLVER for MJ: AI Vendor Type Definitions
31499
+ //****************************************************************************
31500
+ @ObjectType()
31501
+ export class RunAIVendorTypeDefinitionViewResult {
31502
+ @Field(() => [AIVendorTypeDefinition_])
31503
+ Results: AIVendorTypeDefinition_[];
31504
+
31505
+ @Field(() => String, {nullable: true})
31506
+ UserViewRunID?: string;
31507
+
31508
+ @Field(() => Int, {nullable: true})
31509
+ RowCount: number;
31510
+
31511
+ @Field(() => Int, {nullable: true})
31512
+ TotalRowCount: number;
31513
+
31514
+ @Field(() => Int, {nullable: true})
31515
+ ExecutionTime: number;
31516
+
31517
+ @Field({nullable: true})
31518
+ ErrorMessage?: string;
31519
+
31520
+ @Field(() => Boolean, {nullable: false})
31521
+ Success: boolean;
31522
+ }
31523
+
31524
+ @Resolver(AIVendorTypeDefinition_)
31525
+ export class AIVendorTypeDefinitionResolver extends ResolverBase {
31526
+ @Query(() => RunAIVendorTypeDefinitionViewResult)
31527
+ async RunAIVendorTypeDefinitionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31528
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31529
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
31530
+ }
31531
+
31532
+ @Query(() => RunAIVendorTypeDefinitionViewResult)
31533
+ async RunAIVendorTypeDefinitionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31534
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31535
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
31536
+ }
31537
+
31538
+ @Query(() => RunAIVendorTypeDefinitionViewResult)
31539
+ async RunAIVendorTypeDefinitionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31540
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31541
+ input.EntityName = 'MJ: AI Vendor Type Definitions';
31542
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
31543
+ }
31544
+ @Query(() => AIVendorTypeDefinition_, { nullable: true })
31545
+ async AIVendorTypeDefinition(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIVendorTypeDefinition_ | null> {
31546
+ this.CheckUserReadPermissions('MJ: AI Vendor Type Definitions', userPayload);
31547
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31548
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIVendorTypeDefinitions] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Vendor Type Definitions', userPayload, EntityPermissionType.Read, 'AND');
31549
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Vendor Type Definitions', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
31550
+ return result;
31551
+ }
31552
+
31553
+ @FieldResolver(() => [AIVendorType_])
31554
+ async MJ_AIVendorTypes_TypeIDArray(@Root() aivendortypedefinition_: AIVendorTypeDefinition_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31555
+ this.CheckUserReadPermissions('MJ: AI Vendor Types', userPayload);
31556
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31557
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIVendorTypes] WHERE [TypeID]='${aivendortypedefinition_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Vendor Types', userPayload, EntityPermissionType.Read, 'AND');
31558
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: AI Vendor Types', await dataSource.query(sSQL));
31559
+ return result;
31560
+ }
31561
+
31562
+ @Mutation(() => AIVendorTypeDefinition_)
31563
+ async CreateAIVendorTypeDefinition(
31564
+ @Arg('input', () => CreateAIVendorTypeDefinitionInput) input: CreateAIVendorTypeDefinitionInput,
31565
+ @Ctx() { dataSources, userPayload }: AppContext,
31566
+ @PubSub() pubSub: PubSubEngine
31567
+ ) {
31568
+ const dataSource = GetReadWriteDataSource(dataSources);
31569
+ return this.CreateRecord('MJ: AI Vendor Type Definitions', input, dataSource, userPayload, pubSub)
31570
+ }
31571
+
31572
+ @Mutation(() => AIVendorTypeDefinition_)
31573
+ async UpdateAIVendorTypeDefinition(
31574
+ @Arg('input', () => UpdateAIVendorTypeDefinitionInput) input: UpdateAIVendorTypeDefinitionInput,
31575
+ @Ctx() { dataSources, userPayload }: AppContext,
31576
+ @PubSub() pubSub: PubSubEngine
31577
+ ) {
31578
+ const dataSource = GetReadWriteDataSource(dataSources);
31579
+ return this.UpdateRecord('MJ: AI Vendor Type Definitions', input, dataSource, userPayload, pubSub);
31580
+ }
31581
+
31582
+ @Mutation(() => AIVendorTypeDefinition_)
31583
+ async DeleteAIVendorTypeDefinition(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31584
+ const dataSource = GetReadWriteDataSource(dataSources);
31585
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
31586
+ return this.DeleteRecord('MJ: AI Vendor Type Definitions', key, options, dataSource, userPayload, pubSub);
31587
+ }
31588
+
31589
+ }
31590
+
29815
31591
  //****************************************************************************
29816
31592
  // ENTITY CLASS for MJ: Report User States
29817
31593
  //****************************************************************************
@@ -29922,72 +31698,226 @@ export class ReportUserStateResolver extends ResolverBase {
29922
31698
  return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
29923
31699
  }
29924
31700
 
29925
- @Query(() => RunReportUserStateViewResult)
29926
- async RunReportUserStateViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31701
+ @Query(() => RunReportUserStateViewResult)
31702
+ async RunReportUserStateViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31703
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31704
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
31705
+ }
31706
+
31707
+ @Query(() => RunReportUserStateViewResult)
31708
+ async RunReportUserStateDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31709
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31710
+ input.EntityName = 'MJ: Report User States';
31711
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
31712
+ }
31713
+ @Query(() => ReportUserState_, { nullable: true })
31714
+ async ReportUserState(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ReportUserState_ | null> {
31715
+ this.CheckUserReadPermissions('MJ: Report User States', userPayload);
31716
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31717
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwReportUserStates] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Report User States', userPayload, EntityPermissionType.Read, 'AND');
31718
+ const result = this.MapFieldNamesToCodeNames('MJ: Report User States', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
31719
+ return result;
31720
+ }
31721
+
31722
+ @Mutation(() => ReportUserState_)
31723
+ async CreateReportUserState(
31724
+ @Arg('input', () => CreateReportUserStateInput) input: CreateReportUserStateInput,
31725
+ @Ctx() { dataSources, userPayload }: AppContext,
31726
+ @PubSub() pubSub: PubSubEngine
31727
+ ) {
31728
+ const dataSource = GetReadWriteDataSource(dataSources);
31729
+ return this.CreateRecord('MJ: Report User States', input, dataSource, userPayload, pubSub)
31730
+ }
31731
+
31732
+ @Mutation(() => ReportUserState_)
31733
+ async UpdateReportUserState(
31734
+ @Arg('input', () => UpdateReportUserStateInput) input: UpdateReportUserStateInput,
31735
+ @Ctx() { dataSources, userPayload }: AppContext,
31736
+ @PubSub() pubSub: PubSubEngine
31737
+ ) {
31738
+ const dataSource = GetReadWriteDataSource(dataSources);
31739
+ return this.UpdateRecord('MJ: Report User States', input, dataSource, userPayload, pubSub);
31740
+ }
31741
+
31742
+ @Mutation(() => ReportUserState_)
31743
+ async DeleteReportUserState(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31744
+ const dataSource = GetReadWriteDataSource(dataSources);
31745
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
31746
+ return this.DeleteRecord('MJ: Report User States', key, options, dataSource, userPayload, pubSub);
31747
+ }
31748
+
31749
+ }
31750
+
31751
+ //****************************************************************************
31752
+ // ENTITY CLASS for Query Entities
31753
+ //****************************************************************************
31754
+ @ObjectType({ description: `Tracks which entities are involved in a given query. The Queries table stores SQL and descriptions for stored queries that can be executed and serve as examples for AI.` })
31755
+ export class QueryEntity_ {
31756
+ @Field({description: `Unique identifier for the QueryEntity record.`})
31757
+ @MaxLength(16)
31758
+ ID: string;
31759
+
31760
+ @Field({description: `References the ID of the query in the Queries table.`})
31761
+ @MaxLength(16)
31762
+ QueryID: string;
31763
+
31764
+ @Field({description: `References the ID of the entity in the Entities table.`})
31765
+ @MaxLength(16)
31766
+ EntityID: string;
31767
+
31768
+ @Field()
31769
+ @MaxLength(10)
31770
+ _mj__CreatedAt: Date;
31771
+
31772
+ @Field()
31773
+ @MaxLength(10)
31774
+ _mj__UpdatedAt: Date;
31775
+
31776
+ @Field()
31777
+ @MaxLength(510)
31778
+ Query: string;
31779
+
31780
+ @Field()
31781
+ @MaxLength(510)
31782
+ Entity: string;
31783
+
31784
+ }
31785
+
31786
+ //****************************************************************************
31787
+ // INPUT TYPE for Query Entities
31788
+ //****************************************************************************
31789
+ @InputType()
31790
+ export class CreateQueryEntityInput {
31791
+ @Field({ nullable: true })
31792
+ QueryID?: string;
31793
+
31794
+ @Field({ nullable: true })
31795
+ EntityID?: string;
31796
+ }
31797
+
31798
+
31799
+ //****************************************************************************
31800
+ // INPUT TYPE for Query Entities
31801
+ //****************************************************************************
31802
+ @InputType()
31803
+ export class UpdateQueryEntityInput {
31804
+ @Field()
31805
+ ID: string;
31806
+
31807
+ @Field({ nullable: true })
31808
+ QueryID?: string;
31809
+
31810
+ @Field({ nullable: true })
31811
+ EntityID?: string;
31812
+
31813
+ @Field(() => [KeyValuePairInput], { nullable: true })
31814
+ OldValues___?: KeyValuePairInput[];
31815
+ }
31816
+
31817
+ //****************************************************************************
31818
+ // RESOLVER for Query Entities
31819
+ //****************************************************************************
31820
+ @ObjectType()
31821
+ export class RunQueryEntityViewResult {
31822
+ @Field(() => [QueryEntity_])
31823
+ Results: QueryEntity_[];
31824
+
31825
+ @Field(() => String, {nullable: true})
31826
+ UserViewRunID?: string;
31827
+
31828
+ @Field(() => Int, {nullable: true})
31829
+ RowCount: number;
31830
+
31831
+ @Field(() => Int, {nullable: true})
31832
+ TotalRowCount: number;
31833
+
31834
+ @Field(() => Int, {nullable: true})
31835
+ ExecutionTime: number;
31836
+
31837
+ @Field({nullable: true})
31838
+ ErrorMessage?: string;
31839
+
31840
+ @Field(() => Boolean, {nullable: false})
31841
+ Success: boolean;
31842
+ }
31843
+
31844
+ @Resolver(QueryEntity_)
31845
+ export class QueryEntityResolver extends ResolverBase {
31846
+ @Query(() => RunQueryEntityViewResult)
31847
+ async RunQueryEntityViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31848
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
31849
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
31850
+ }
31851
+
31852
+ @Query(() => RunQueryEntityViewResult)
31853
+ async RunQueryEntityViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29927
31854
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29928
31855
  return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
29929
31856
  }
29930
31857
 
29931
- @Query(() => RunReportUserStateViewResult)
29932
- async RunReportUserStateDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31858
+ @Query(() => RunQueryEntityViewResult)
31859
+ async RunQueryEntityDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29933
31860
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29934
- input.EntityName = 'MJ: Report User States';
31861
+ input.EntityName = 'Query Entities';
29935
31862
  return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
29936
31863
  }
29937
- @Query(() => ReportUserState_, { nullable: true })
29938
- async ReportUserState(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ReportUserState_ | null> {
29939
- this.CheckUserReadPermissions('MJ: Report User States', userPayload);
31864
+ @Query(() => QueryEntity_, { nullable: true })
31865
+ async QueryEntity(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<QueryEntity_ | null> {
31866
+ this.CheckUserReadPermissions('Query Entities', userPayload);
29940
31867
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29941
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwReportUserStates] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Report User States', userPayload, EntityPermissionType.Read, 'AND');
29942
- const result = this.MapFieldNamesToCodeNames('MJ: Report User States', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
31868
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwQueryEntities] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('Query Entities', userPayload, EntityPermissionType.Read, 'AND');
31869
+ const result = this.MapFieldNamesToCodeNames('Query Entities', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
29943
31870
  return result;
29944
31871
  }
29945
31872
 
29946
- @Mutation(() => ReportUserState_)
29947
- async CreateReportUserState(
29948
- @Arg('input', () => CreateReportUserStateInput) input: CreateReportUserStateInput,
31873
+ @Mutation(() => QueryEntity_)
31874
+ async CreateQueryEntity(
31875
+ @Arg('input', () => CreateQueryEntityInput) input: CreateQueryEntityInput,
29949
31876
  @Ctx() { dataSources, userPayload }: AppContext,
29950
31877
  @PubSub() pubSub: PubSubEngine
29951
31878
  ) {
29952
31879
  const dataSource = GetReadWriteDataSource(dataSources);
29953
- return this.CreateRecord('MJ: Report User States', input, dataSource, userPayload, pubSub)
31880
+ return this.CreateRecord('Query Entities', input, dataSource, userPayload, pubSub)
29954
31881
  }
29955
31882
 
29956
- @Mutation(() => ReportUserState_)
29957
- async UpdateReportUserState(
29958
- @Arg('input', () => UpdateReportUserStateInput) input: UpdateReportUserStateInput,
31883
+ @Mutation(() => QueryEntity_)
31884
+ async UpdateQueryEntity(
31885
+ @Arg('input', () => UpdateQueryEntityInput) input: UpdateQueryEntityInput,
29959
31886
  @Ctx() { dataSources, userPayload }: AppContext,
29960
31887
  @PubSub() pubSub: PubSubEngine
29961
31888
  ) {
29962
31889
  const dataSource = GetReadWriteDataSource(dataSources);
29963
- return this.UpdateRecord('MJ: Report User States', input, dataSource, userPayload, pubSub);
31890
+ return this.UpdateRecord('Query Entities', input, dataSource, userPayload, pubSub);
29964
31891
  }
29965
31892
 
29966
- @Mutation(() => ReportUserState_)
29967
- async DeleteReportUserState(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
31893
+ @Mutation(() => QueryEntity_)
31894
+ async DeleteQueryEntity(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29968
31895
  const dataSource = GetReadWriteDataSource(dataSources);
29969
31896
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
29970
- return this.DeleteRecord('MJ: Report User States', key, options, dataSource, userPayload, pubSub);
31897
+ return this.DeleteRecord('Query Entities', key, options, dataSource, userPayload, pubSub);
29971
31898
  }
29972
31899
 
29973
31900
  }
29974
31901
 
29975
31902
  //****************************************************************************
29976
- // ENTITY CLASS for Query Entities
31903
+ // ENTITY CLASS for MJ: Dashboard User States
29977
31904
  //****************************************************************************
29978
- @ObjectType({ description: `Tracks which entities are involved in a given query. The Queries table stores SQL and descriptions for stored queries that can be executed and serve as examples for AI.` })
29979
- export class QueryEntity_ {
29980
- @Field({description: `Unique identifier for the QueryEntity record.`})
31905
+ @ObjectType()
31906
+ export class DashboardUserState_ {
31907
+ @Field()
29981
31908
  @MaxLength(16)
29982
31909
  ID: string;
29983
31910
 
29984
- @Field({description: `References the ID of the query in the Queries table.`})
31911
+ @Field({description: `Dashboard that this state applies to`})
29985
31912
  @MaxLength(16)
29986
- QueryID: string;
31913
+ DashboardID: string;
29987
31914
 
29988
- @Field({description: `References the ID of the entity in the Entities table.`})
31915
+ @Field({description: `User that this state belongs to`})
29989
31916
  @MaxLength(16)
29990
- EntityID: string;
31917
+ UserID: string;
31918
+
31919
+ @Field({nullable: true, description: `JSON object containing user-specific dashboard state`})
31920
+ UserState?: string;
29991
31921
 
29992
31922
  @Field()
29993
31923
  @MaxLength(10)
@@ -29999,52 +31929,58 @@ export class QueryEntity_ {
29999
31929
 
30000
31930
  @Field()
30001
31931
  @MaxLength(510)
30002
- Query: string;
31932
+ Dashboard: string;
30003
31933
 
30004
31934
  @Field()
30005
- @MaxLength(510)
30006
- Entity: string;
31935
+ @MaxLength(200)
31936
+ User: string;
30007
31937
 
30008
31938
  }
30009
31939
 
30010
31940
  //****************************************************************************
30011
- // INPUT TYPE for Query Entities
31941
+ // INPUT TYPE for MJ: Dashboard User States
30012
31942
  //****************************************************************************
30013
31943
  @InputType()
30014
- export class CreateQueryEntityInput {
31944
+ export class CreateDashboardUserStateInput {
30015
31945
  @Field({ nullable: true })
30016
- QueryID?: string;
31946
+ DashboardID?: string;
30017
31947
 
30018
31948
  @Field({ nullable: true })
30019
- EntityID?: string;
31949
+ UserID?: string;
31950
+
31951
+ @Field({ nullable: true })
31952
+ UserState: string | null;
30020
31953
  }
30021
31954
 
30022
31955
 
30023
31956
  //****************************************************************************
30024
- // INPUT TYPE for Query Entities
31957
+ // INPUT TYPE for MJ: Dashboard User States
30025
31958
  //****************************************************************************
30026
31959
  @InputType()
30027
- export class UpdateQueryEntityInput {
31960
+ export class UpdateDashboardUserStateInput {
30028
31961
  @Field()
30029
31962
  ID: string;
30030
31963
 
30031
31964
  @Field({ nullable: true })
30032
- QueryID?: string;
31965
+ DashboardID?: string;
30033
31966
 
30034
31967
  @Field({ nullable: true })
30035
- EntityID?: string;
31968
+ UserID?: string;
31969
+
31970
+ @Field({ nullable: true })
31971
+ UserState?: string | null;
30036
31972
 
30037
31973
  @Field(() => [KeyValuePairInput], { nullable: true })
30038
31974
  OldValues___?: KeyValuePairInput[];
30039
31975
  }
30040
31976
 
30041
31977
  //****************************************************************************
30042
- // RESOLVER for Query Entities
31978
+ // RESOLVER for MJ: Dashboard User States
30043
31979
  //****************************************************************************
30044
31980
  @ObjectType()
30045
- export class RunQueryEntityViewResult {
30046
- @Field(() => [QueryEntity_])
30047
- Results: QueryEntity_[];
31981
+ export class RunDashboardUserStateViewResult {
31982
+ @Field(() => [DashboardUserState_])
31983
+ Results: DashboardUserState_[];
30048
31984
 
30049
31985
  @Field(() => String, {nullable: true})
30050
31986
  UserViewRunID?: string;
@@ -30065,60 +32001,60 @@ export class RunQueryEntityViewResult {
30065
32001
  Success: boolean;
30066
32002
  }
30067
32003
 
30068
- @Resolver(QueryEntity_)
30069
- export class QueryEntityResolver extends ResolverBase {
30070
- @Query(() => RunQueryEntityViewResult)
30071
- async RunQueryEntityViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32004
+ @Resolver(DashboardUserState_)
32005
+ export class DashboardUserStateResolver extends ResolverBase {
32006
+ @Query(() => RunDashboardUserStateViewResult)
32007
+ async RunDashboardUserStateViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
30072
32008
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
30073
32009
  return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
30074
32010
  }
30075
32011
 
30076
- @Query(() => RunQueryEntityViewResult)
30077
- async RunQueryEntityViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32012
+ @Query(() => RunDashboardUserStateViewResult)
32013
+ async RunDashboardUserStateViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
30078
32014
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
30079
32015
  return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
30080
32016
  }
30081
32017
 
30082
- @Query(() => RunQueryEntityViewResult)
30083
- async RunQueryEntityDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32018
+ @Query(() => RunDashboardUserStateViewResult)
32019
+ async RunDashboardUserStateDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
30084
32020
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
30085
- input.EntityName = 'Query Entities';
32021
+ input.EntityName = 'MJ: Dashboard User States';
30086
32022
  return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
30087
32023
  }
30088
- @Query(() => QueryEntity_, { nullable: true })
30089
- async QueryEntity(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<QueryEntity_ | null> {
30090
- this.CheckUserReadPermissions('Query Entities', userPayload);
32024
+ @Query(() => DashboardUserState_, { nullable: true })
32025
+ async DashboardUserState(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<DashboardUserState_ | null> {
32026
+ this.CheckUserReadPermissions('MJ: Dashboard User States', userPayload);
30091
32027
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
30092
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwQueryEntities] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('Query Entities', userPayload, EntityPermissionType.Read, 'AND');
30093
- const result = this.MapFieldNamesToCodeNames('Query Entities', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
32028
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserStates] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Dashboard User States', userPayload, EntityPermissionType.Read, 'AND');
32029
+ const result = this.MapFieldNamesToCodeNames('MJ: Dashboard User States', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
30094
32030
  return result;
30095
32031
  }
30096
32032
 
30097
- @Mutation(() => QueryEntity_)
30098
- async CreateQueryEntity(
30099
- @Arg('input', () => CreateQueryEntityInput) input: CreateQueryEntityInput,
32033
+ @Mutation(() => DashboardUserState_)
32034
+ async CreateDashboardUserState(
32035
+ @Arg('input', () => CreateDashboardUserStateInput) input: CreateDashboardUserStateInput,
30100
32036
  @Ctx() { dataSources, userPayload }: AppContext,
30101
32037
  @PubSub() pubSub: PubSubEngine
30102
32038
  ) {
30103
32039
  const dataSource = GetReadWriteDataSource(dataSources);
30104
- return this.CreateRecord('Query Entities', input, dataSource, userPayload, pubSub)
32040
+ return this.CreateRecord('MJ: Dashboard User States', input, dataSource, userPayload, pubSub)
30105
32041
  }
30106
32042
 
30107
- @Mutation(() => QueryEntity_)
30108
- async UpdateQueryEntity(
30109
- @Arg('input', () => UpdateQueryEntityInput) input: UpdateQueryEntityInput,
32043
+ @Mutation(() => DashboardUserState_)
32044
+ async UpdateDashboardUserState(
32045
+ @Arg('input', () => UpdateDashboardUserStateInput) input: UpdateDashboardUserStateInput,
30110
32046
  @Ctx() { dataSources, userPayload }: AppContext,
30111
32047
  @PubSub() pubSub: PubSubEngine
30112
32048
  ) {
30113
32049
  const dataSource = GetReadWriteDataSource(dataSources);
30114
- return this.UpdateRecord('Query Entities', input, dataSource, userPayload, pubSub);
32050
+ return this.UpdateRecord('MJ: Dashboard User States', input, dataSource, userPayload, pubSub);
30115
32051
  }
30116
32052
 
30117
- @Mutation(() => QueryEntity_)
30118
- async DeleteQueryEntity(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32053
+ @Mutation(() => DashboardUserState_)
32054
+ async DeleteDashboardUserState(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
30119
32055
  const dataSource = GetReadWriteDataSource(dataSources);
30120
32056
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
30121
- return this.DeleteRecord('Query Entities', key, options, dataSource, userPayload, pubSub);
32057
+ return this.DeleteRecord('MJ: Dashboard User States', key, options, dataSource, userPayload, pubSub);
30122
32058
  }
30123
32059
 
30124
32060
  }
@@ -30296,6 +32232,176 @@ export class ArtifactTypeResolver extends ResolverBase {
30296
32232
 
30297
32233
  }
30298
32234
 
32235
+ //****************************************************************************
32236
+ // ENTITY CLASS for MJ: AI Vendor Types
32237
+ //****************************************************************************
32238
+ @ObjectType()
32239
+ export class AIVendorType_ {
32240
+ @Field()
32241
+ @MaxLength(16)
32242
+ ID: string;
32243
+
32244
+ @Field()
32245
+ @MaxLength(16)
32246
+ VendorID: string;
32247
+
32248
+ @Field()
32249
+ @MaxLength(16)
32250
+ TypeID: string;
32251
+
32252
+ @Field(() => Int, {description: `Determines the priority rank of this type for the vendor. Higher values indicate higher priority.`})
32253
+ Rank: number;
32254
+
32255
+ @Field({description: `The current status of this vendor type. Values include Active, Inactive, Deprecated, and Preview.`})
32256
+ @MaxLength(40)
32257
+ Status: string;
32258
+
32259
+ @Field()
32260
+ @MaxLength(10)
32261
+ _mj__CreatedAt: Date;
32262
+
32263
+ @Field()
32264
+ @MaxLength(10)
32265
+ _mj__UpdatedAt: Date;
32266
+
32267
+ @Field()
32268
+ @MaxLength(100)
32269
+ Vendor: string;
32270
+
32271
+ @Field()
32272
+ @MaxLength(100)
32273
+ Type: string;
32274
+
32275
+ }
32276
+
32277
+ //****************************************************************************
32278
+ // INPUT TYPE for MJ: AI Vendor Types
32279
+ //****************************************************************************
32280
+ @InputType()
32281
+ export class CreateAIVendorTypeInput {
32282
+ @Field({ nullable: true })
32283
+ VendorID?: string;
32284
+
32285
+ @Field({ nullable: true })
32286
+ TypeID?: string;
32287
+
32288
+ @Field(() => Int, { nullable: true })
32289
+ Rank?: number;
32290
+
32291
+ @Field({ nullable: true })
32292
+ Status?: string;
32293
+ }
32294
+
32295
+
32296
+ //****************************************************************************
32297
+ // INPUT TYPE for MJ: AI Vendor Types
32298
+ //****************************************************************************
32299
+ @InputType()
32300
+ export class UpdateAIVendorTypeInput {
32301
+ @Field()
32302
+ ID: string;
32303
+
32304
+ @Field({ nullable: true })
32305
+ VendorID?: string;
32306
+
32307
+ @Field({ nullable: true })
32308
+ TypeID?: string;
32309
+
32310
+ @Field(() => Int, { nullable: true })
32311
+ Rank?: number;
32312
+
32313
+ @Field({ nullable: true })
32314
+ Status?: string;
32315
+
32316
+ @Field(() => [KeyValuePairInput], { nullable: true })
32317
+ OldValues___?: KeyValuePairInput[];
32318
+ }
32319
+
32320
+ //****************************************************************************
32321
+ // RESOLVER for MJ: AI Vendor Types
32322
+ //****************************************************************************
32323
+ @ObjectType()
32324
+ export class RunAIVendorTypeViewResult {
32325
+ @Field(() => [AIVendorType_])
32326
+ Results: AIVendorType_[];
32327
+
32328
+ @Field(() => String, {nullable: true})
32329
+ UserViewRunID?: string;
32330
+
32331
+ @Field(() => Int, {nullable: true})
32332
+ RowCount: number;
32333
+
32334
+ @Field(() => Int, {nullable: true})
32335
+ TotalRowCount: number;
32336
+
32337
+ @Field(() => Int, {nullable: true})
32338
+ ExecutionTime: number;
32339
+
32340
+ @Field({nullable: true})
32341
+ ErrorMessage?: string;
32342
+
32343
+ @Field(() => Boolean, {nullable: false})
32344
+ Success: boolean;
32345
+ }
32346
+
32347
+ @Resolver(AIVendorType_)
32348
+ export class AIVendorTypeResolver extends ResolverBase {
32349
+ @Query(() => RunAIVendorTypeViewResult)
32350
+ async RunAIVendorTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32351
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32352
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
32353
+ }
32354
+
32355
+ @Query(() => RunAIVendorTypeViewResult)
32356
+ async RunAIVendorTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32357
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32358
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
32359
+ }
32360
+
32361
+ @Query(() => RunAIVendorTypeViewResult)
32362
+ async RunAIVendorTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32363
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32364
+ input.EntityName = 'MJ: AI Vendor Types';
32365
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
32366
+ }
32367
+ @Query(() => AIVendorType_, { nullable: true })
32368
+ async AIVendorType(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIVendorType_ | null> {
32369
+ this.CheckUserReadPermissions('MJ: AI Vendor Types', userPayload);
32370
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32371
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIVendorTypes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Vendor Types', userPayload, EntityPermissionType.Read, 'AND');
32372
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Vendor Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
32373
+ return result;
32374
+ }
32375
+
32376
+ @Mutation(() => AIVendorType_)
32377
+ async CreateAIVendorType(
32378
+ @Arg('input', () => CreateAIVendorTypeInput) input: CreateAIVendorTypeInput,
32379
+ @Ctx() { dataSources, userPayload }: AppContext,
32380
+ @PubSub() pubSub: PubSubEngine
32381
+ ) {
32382
+ const dataSource = GetReadWriteDataSource(dataSources);
32383
+ return this.CreateRecord('MJ: AI Vendor Types', input, dataSource, userPayload, pubSub)
32384
+ }
32385
+
32386
+ @Mutation(() => AIVendorType_)
32387
+ async UpdateAIVendorType(
32388
+ @Arg('input', () => UpdateAIVendorTypeInput) input: UpdateAIVendorTypeInput,
32389
+ @Ctx() { dataSources, userPayload }: AppContext,
32390
+ @PubSub() pubSub: PubSubEngine
32391
+ ) {
32392
+ const dataSource = GetReadWriteDataSource(dataSources);
32393
+ return this.UpdateRecord('MJ: AI Vendor Types', input, dataSource, userPayload, pubSub);
32394
+ }
32395
+
32396
+ @Mutation(() => AIVendorType_)
32397
+ async DeleteAIVendorType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32398
+ const dataSource = GetReadWriteDataSource(dataSources);
32399
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
32400
+ return this.DeleteRecord('MJ: AI Vendor Types', key, options, dataSource, userPayload, pubSub);
32401
+ }
32402
+
32403
+ }
32404
+
30299
32405
  //****************************************************************************
30300
32406
  // ENTITY CLASS for MJ: Conversation Artifacts
30301
32407
  //****************************************************************************
@@ -30521,6 +32627,402 @@ export class ConversationArtifactResolver extends ResolverBase {
30521
32627
 
30522
32628
  }
30523
32629
 
32630
+ //****************************************************************************
32631
+ // ENTITY CLASS for MJ: AI Agent Prompts
32632
+ //****************************************************************************
32633
+ @ObjectType()
32634
+ export class AIAgentPrompt_ {
32635
+ @Field()
32636
+ @MaxLength(16)
32637
+ ID: string;
32638
+
32639
+ @Field({description: `References the agent this prompt is associated with.`})
32640
+ @MaxLength(16)
32641
+ AgentID: string;
32642
+
32643
+ @Field({description: `References the prompt to be used by the agent.`})
32644
+ @MaxLength(16)
32645
+ PromptID: string;
32646
+
32647
+ @Field({nullable: true, description: `The functional purpose of this prompt within the agent, such as "Initialize", "ProcessData", or "Summarize".`})
32648
+ Purpose?: string;
32649
+
32650
+ @Field(() => Int, {description: `The sequence order in which this prompt should be executed within the agent's workflow.`})
32651
+ ExecutionOrder: number;
32652
+
32653
+ @Field({nullable: true, description: `Optional reference to a specific configuration to use for this prompt. If NULL, uses the default configuration.`})
32654
+ @MaxLength(16)
32655
+ ConfigurationID?: string;
32656
+
32657
+ @Field({description: `The current status of this agent-prompt mapping. Values include Active, Inactive, Deprecated, and Preview.`})
32658
+ @MaxLength(40)
32659
+ Status: string;
32660
+
32661
+ @Field({description: `Determines how conversation context is filtered for this prompt: Complete, Smart, None, RecentMessages, InitialMessages, or Custom.`})
32662
+ @MaxLength(100)
32663
+ ContextBehavior: string;
32664
+
32665
+ @Field(() => Int, {nullable: true, description: `The number of messages to include when ContextBehavior is set to RecentMessages or InitialMessages.`})
32666
+ ContextMessageCount?: number;
32667
+
32668
+ @Field()
32669
+ @MaxLength(10)
32670
+ _mj__CreatedAt: Date;
32671
+
32672
+ @Field()
32673
+ @MaxLength(10)
32674
+ _mj__UpdatedAt: Date;
32675
+
32676
+ @Field({nullable: true})
32677
+ @MaxLength(510)
32678
+ Agent?: string;
32679
+
32680
+ @Field()
32681
+ @MaxLength(510)
32682
+ Prompt: string;
32683
+
32684
+ @Field({nullable: true})
32685
+ @MaxLength(200)
32686
+ Configuration?: string;
32687
+
32688
+ }
32689
+
32690
+ //****************************************************************************
32691
+ // INPUT TYPE for MJ: AI Agent Prompts
32692
+ //****************************************************************************
32693
+ @InputType()
32694
+ export class CreateAIAgentPromptInput {
32695
+ @Field({ nullable: true })
32696
+ AgentID?: string;
32697
+
32698
+ @Field({ nullable: true })
32699
+ PromptID?: string;
32700
+
32701
+ @Field({ nullable: true })
32702
+ Purpose: string | null;
32703
+
32704
+ @Field(() => Int, { nullable: true })
32705
+ ExecutionOrder?: number;
32706
+
32707
+ @Field({ nullable: true })
32708
+ ConfigurationID: string | null;
32709
+
32710
+ @Field({ nullable: true })
32711
+ Status?: string;
32712
+
32713
+ @Field({ nullable: true })
32714
+ ContextBehavior?: string;
32715
+
32716
+ @Field(() => Int, { nullable: true })
32717
+ ContextMessageCount: number | null;
32718
+ }
32719
+
32720
+
32721
+ //****************************************************************************
32722
+ // INPUT TYPE for MJ: AI Agent Prompts
32723
+ //****************************************************************************
32724
+ @InputType()
32725
+ export class UpdateAIAgentPromptInput {
32726
+ @Field()
32727
+ ID: string;
32728
+
32729
+ @Field({ nullable: true })
32730
+ AgentID?: string;
32731
+
32732
+ @Field({ nullable: true })
32733
+ PromptID?: string;
32734
+
32735
+ @Field({ nullable: true })
32736
+ Purpose?: string | null;
32737
+
32738
+ @Field(() => Int, { nullable: true })
32739
+ ExecutionOrder?: number;
32740
+
32741
+ @Field({ nullable: true })
32742
+ ConfigurationID?: string | null;
32743
+
32744
+ @Field({ nullable: true })
32745
+ Status?: string;
32746
+
32747
+ @Field({ nullable: true })
32748
+ ContextBehavior?: string;
32749
+
32750
+ @Field(() => Int, { nullable: true })
32751
+ ContextMessageCount?: number | null;
32752
+
32753
+ @Field(() => [KeyValuePairInput], { nullable: true })
32754
+ OldValues___?: KeyValuePairInput[];
32755
+ }
32756
+
32757
+ //****************************************************************************
32758
+ // RESOLVER for MJ: AI Agent Prompts
32759
+ //****************************************************************************
32760
+ @ObjectType()
32761
+ export class RunAIAgentPromptViewResult {
32762
+ @Field(() => [AIAgentPrompt_])
32763
+ Results: AIAgentPrompt_[];
32764
+
32765
+ @Field(() => String, {nullable: true})
32766
+ UserViewRunID?: string;
32767
+
32768
+ @Field(() => Int, {nullable: true})
32769
+ RowCount: number;
32770
+
32771
+ @Field(() => Int, {nullable: true})
32772
+ TotalRowCount: number;
32773
+
32774
+ @Field(() => Int, {nullable: true})
32775
+ ExecutionTime: number;
32776
+
32777
+ @Field({nullable: true})
32778
+ ErrorMessage?: string;
32779
+
32780
+ @Field(() => Boolean, {nullable: false})
32781
+ Success: boolean;
32782
+ }
32783
+
32784
+ @Resolver(AIAgentPrompt_)
32785
+ export class AIAgentPromptResolver extends ResolverBase {
32786
+ @Query(() => RunAIAgentPromptViewResult)
32787
+ async RunAIAgentPromptViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32788
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32789
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
32790
+ }
32791
+
32792
+ @Query(() => RunAIAgentPromptViewResult)
32793
+ async RunAIAgentPromptViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32794
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32795
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
32796
+ }
32797
+
32798
+ @Query(() => RunAIAgentPromptViewResult)
32799
+ async RunAIAgentPromptDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32800
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32801
+ input.EntityName = 'MJ: AI Agent Prompts';
32802
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
32803
+ }
32804
+ @Query(() => AIAgentPrompt_, { nullable: true })
32805
+ async AIAgentPrompt(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIAgentPrompt_ | null> {
32806
+ this.CheckUserReadPermissions('MJ: AI Agent Prompts', userPayload);
32807
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32808
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentPrompts] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Agent Prompts', userPayload, EntityPermissionType.Read, 'AND');
32809
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Agent Prompts', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
32810
+ return result;
32811
+ }
32812
+
32813
+ @Mutation(() => AIAgentPrompt_)
32814
+ async CreateAIAgentPrompt(
32815
+ @Arg('input', () => CreateAIAgentPromptInput) input: CreateAIAgentPromptInput,
32816
+ @Ctx() { dataSources, userPayload }: AppContext,
32817
+ @PubSub() pubSub: PubSubEngine
32818
+ ) {
32819
+ const dataSource = GetReadWriteDataSource(dataSources);
32820
+ return this.CreateRecord('MJ: AI Agent Prompts', input, dataSource, userPayload, pubSub)
32821
+ }
32822
+
32823
+ @Mutation(() => AIAgentPrompt_)
32824
+ async UpdateAIAgentPrompt(
32825
+ @Arg('input', () => UpdateAIAgentPromptInput) input: UpdateAIAgentPromptInput,
32826
+ @Ctx() { dataSources, userPayload }: AppContext,
32827
+ @PubSub() pubSub: PubSubEngine
32828
+ ) {
32829
+ const dataSource = GetReadWriteDataSource(dataSources);
32830
+ return this.UpdateRecord('MJ: AI Agent Prompts', input, dataSource, userPayload, pubSub);
32831
+ }
32832
+
32833
+ @Mutation(() => AIAgentPrompt_)
32834
+ async DeleteAIAgentPrompt(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32835
+ const dataSource = GetReadWriteDataSource(dataSources);
32836
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
32837
+ return this.DeleteRecord('MJ: AI Agent Prompts', key, options, dataSource, userPayload, pubSub);
32838
+ }
32839
+
32840
+ }
32841
+
32842
+ //****************************************************************************
32843
+ // ENTITY CLASS for MJ: Dashboard User Preferences
32844
+ //****************************************************************************
32845
+ @ObjectType()
32846
+ export class DashboardUserPreference_ {
32847
+ @Field()
32848
+ @MaxLength(16)
32849
+ ID: string;
32850
+
32851
+ @Field({nullable: true, description: `User that these preferences belong to, NULL for system defaults`})
32852
+ @MaxLength(16)
32853
+ UserID?: string;
32854
+
32855
+ @Field({description: `Dashboard that this preference refers to`})
32856
+ @MaxLength(16)
32857
+ DashboardID: string;
32858
+
32859
+ @Field({description: `Scope of the preference (Global or App)`})
32860
+ @MaxLength(40)
32861
+ Scope: string;
32862
+
32863
+ @Field({nullable: true, description: `Application that this preference applies to (only for App scope)`})
32864
+ @MaxLength(16)
32865
+ ApplicationID?: string;
32866
+
32867
+ @Field(() => Int, {description: `Order in which to display the dashboard`})
32868
+ DisplayOrder: number;
32869
+
32870
+ @Field()
32871
+ @MaxLength(10)
32872
+ _mj__CreatedAt: Date;
32873
+
32874
+ @Field()
32875
+ @MaxLength(10)
32876
+ _mj__UpdatedAt: Date;
32877
+
32878
+ @Field({nullable: true})
32879
+ @MaxLength(200)
32880
+ User?: string;
32881
+
32882
+ @Field()
32883
+ @MaxLength(510)
32884
+ Dashboard: string;
32885
+
32886
+ @Field({nullable: true})
32887
+ @MaxLength(200)
32888
+ Application?: string;
32889
+
32890
+ }
32891
+
32892
+ //****************************************************************************
32893
+ // INPUT TYPE for MJ: Dashboard User Preferences
32894
+ //****************************************************************************
32895
+ @InputType()
32896
+ export class CreateDashboardUserPreferenceInput {
32897
+ @Field({ nullable: true })
32898
+ UserID: string | null;
32899
+
32900
+ @Field({ nullable: true })
32901
+ DashboardID?: string;
32902
+
32903
+ @Field({ nullable: true })
32904
+ Scope?: string;
32905
+
32906
+ @Field({ nullable: true })
32907
+ ApplicationID: string | null;
32908
+
32909
+ @Field(() => Int, { nullable: true })
32910
+ DisplayOrder?: number;
32911
+ }
32912
+
32913
+
32914
+ //****************************************************************************
32915
+ // INPUT TYPE for MJ: Dashboard User Preferences
32916
+ //****************************************************************************
32917
+ @InputType()
32918
+ export class UpdateDashboardUserPreferenceInput {
32919
+ @Field()
32920
+ ID: string;
32921
+
32922
+ @Field({ nullable: true })
32923
+ UserID?: string | null;
32924
+
32925
+ @Field({ nullable: true })
32926
+ DashboardID?: string;
32927
+
32928
+ @Field({ nullable: true })
32929
+ Scope?: string;
32930
+
32931
+ @Field({ nullable: true })
32932
+ ApplicationID?: string | null;
32933
+
32934
+ @Field(() => Int, { nullable: true })
32935
+ DisplayOrder?: number;
32936
+
32937
+ @Field(() => [KeyValuePairInput], { nullable: true })
32938
+ OldValues___?: KeyValuePairInput[];
32939
+ }
32940
+
32941
+ //****************************************************************************
32942
+ // RESOLVER for MJ: Dashboard User Preferences
32943
+ //****************************************************************************
32944
+ @ObjectType()
32945
+ export class RunDashboardUserPreferenceViewResult {
32946
+ @Field(() => [DashboardUserPreference_])
32947
+ Results: DashboardUserPreference_[];
32948
+
32949
+ @Field(() => String, {nullable: true})
32950
+ UserViewRunID?: string;
32951
+
32952
+ @Field(() => Int, {nullable: true})
32953
+ RowCount: number;
32954
+
32955
+ @Field(() => Int, {nullable: true})
32956
+ TotalRowCount: number;
32957
+
32958
+ @Field(() => Int, {nullable: true})
32959
+ ExecutionTime: number;
32960
+
32961
+ @Field({nullable: true})
32962
+ ErrorMessage?: string;
32963
+
32964
+ @Field(() => Boolean, {nullable: false})
32965
+ Success: boolean;
32966
+ }
32967
+
32968
+ @Resolver(DashboardUserPreference_)
32969
+ export class DashboardUserPreferenceResolver extends ResolverBase {
32970
+ @Query(() => RunDashboardUserPreferenceViewResult)
32971
+ async RunDashboardUserPreferenceViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32972
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32973
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
32974
+ }
32975
+
32976
+ @Query(() => RunDashboardUserPreferenceViewResult)
32977
+ async RunDashboardUserPreferenceViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32978
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32979
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
32980
+ }
32981
+
32982
+ @Query(() => RunDashboardUserPreferenceViewResult)
32983
+ async RunDashboardUserPreferenceDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32984
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32985
+ input.EntityName = 'MJ: Dashboard User Preferences';
32986
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
32987
+ }
32988
+ @Query(() => DashboardUserPreference_, { nullable: true })
32989
+ async DashboardUserPreference(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<DashboardUserPreference_ | null> {
32990
+ this.CheckUserReadPermissions('MJ: Dashboard User Preferences', userPayload);
32991
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32992
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDashboardUserPreferences] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Dashboard User Preferences', userPayload, EntityPermissionType.Read, 'AND');
32993
+ const result = this.MapFieldNamesToCodeNames('MJ: Dashboard User Preferences', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
32994
+ return result;
32995
+ }
32996
+
32997
+ @Mutation(() => DashboardUserPreference_)
32998
+ async CreateDashboardUserPreference(
32999
+ @Arg('input', () => CreateDashboardUserPreferenceInput) input: CreateDashboardUserPreferenceInput,
33000
+ @Ctx() { dataSources, userPayload }: AppContext,
33001
+ @PubSub() pubSub: PubSubEngine
33002
+ ) {
33003
+ const dataSource = GetReadWriteDataSource(dataSources);
33004
+ return this.CreateRecord('MJ: Dashboard User Preferences', input, dataSource, userPayload, pubSub)
33005
+ }
33006
+
33007
+ @Mutation(() => DashboardUserPreference_)
33008
+ async UpdateDashboardUserPreference(
33009
+ @Arg('input', () => UpdateDashboardUserPreferenceInput) input: UpdateDashboardUserPreferenceInput,
33010
+ @Ctx() { dataSources, userPayload }: AppContext,
33011
+ @PubSub() pubSub: PubSubEngine
33012
+ ) {
33013
+ const dataSource = GetReadWriteDataSource(dataSources);
33014
+ return this.UpdateRecord('MJ: Dashboard User Preferences', input, dataSource, userPayload, pubSub);
33015
+ }
33016
+
33017
+ @Mutation(() => DashboardUserPreference_)
33018
+ async DeleteDashboardUserPreference(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
33019
+ const dataSource = GetReadWriteDataSource(dataSources);
33020
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
33021
+ return this.DeleteRecord('MJ: Dashboard User Preferences', key, options, dataSource, userPayload, pubSub);
33022
+ }
33023
+
33024
+ }
33025
+
30524
33026
  //****************************************************************************
30525
33027
  // ENTITY CLASS for Content Process Runs
30526
33028
  //****************************************************************************
@@ -32732,6 +35234,310 @@ export class GeneratedCodeResolver extends ResolverBase {
32732
35234
 
32733
35235
  }
32734
35236
 
35237
+ //****************************************************************************
35238
+ // ENTITY CLASS for MJ: AI Prompt Runs
35239
+ //****************************************************************************
35240
+ @ObjectType()
35241
+ export class AIPromptRun_ {
35242
+ @Field()
35243
+ @MaxLength(16)
35244
+ ID: string;
35245
+
35246
+ @Field({description: `The prompt that was executed.`})
35247
+ @MaxLength(16)
35248
+ PromptID: string;
35249
+
35250
+ @Field({description: `The AI model used for execution.`})
35251
+ @MaxLength(16)
35252
+ ModelID: string;
35253
+
35254
+ @Field({description: `The vendor providing the model/inference.`})
35255
+ @MaxLength(16)
35256
+ VendorID: string;
35257
+
35258
+ @Field({nullable: true, description: `If this prompt was run as part of an agent, references the agent.`})
35259
+ @MaxLength(16)
35260
+ AgentID?: string;
35261
+
35262
+ @Field({nullable: true, description: `Optional configuration used for this execution.`})
35263
+ @MaxLength(16)
35264
+ ConfigurationID?: string;
35265
+
35266
+ @Field(() => Int, {description: `When the prompt execution started.`})
35267
+ RunAt: Date;
35268
+
35269
+ @Field(() => Int, {nullable: true, description: `When the prompt execution finished. NULL indicates a pending or interrupted execution.`})
35270
+ CompletedAt?: Date;
35271
+
35272
+ @Field(() => Int, {nullable: true, description: `Total execution time in milliseconds.`})
35273
+ ExecutionTimeMS?: number;
35274
+
35275
+ @Field({nullable: true, description: `The input messages sent to the model, typically in JSON format.`})
35276
+ Messages?: string;
35277
+
35278
+ @Field({nullable: true, description: `The output result from the model.`})
35279
+ Result?: string;
35280
+
35281
+ @Field(() => Int, {nullable: true, description: `Total number of tokens used (prompt + completion).`})
35282
+ TokensUsed?: number;
35283
+
35284
+ @Field(() => Int, {nullable: true, description: `Number of tokens in the prompt.`})
35285
+ TokensPrompt?: number;
35286
+
35287
+ @Field(() => Int, {nullable: true, description: `Number of tokens in the completion/result.`})
35288
+ TokensCompletion?: number;
35289
+
35290
+ @Field(() => Float, {nullable: true, description: `Estimated cost of this execution in USD.`})
35291
+ TotalCost?: number;
35292
+
35293
+ @Field(() => Boolean, {description: `Whether the execution was successful.`})
35294
+ Success: boolean;
35295
+
35296
+ @Field({nullable: true, description: `Error message if the execution failed.`})
35297
+ ErrorMessage?: string;
35298
+
35299
+ @Field()
35300
+ @MaxLength(10)
35301
+ _mj__CreatedAt: Date;
35302
+
35303
+ @Field()
35304
+ @MaxLength(10)
35305
+ _mj__UpdatedAt: Date;
35306
+
35307
+ @Field()
35308
+ @MaxLength(510)
35309
+ Prompt: string;
35310
+
35311
+ @Field()
35312
+ @MaxLength(100)
35313
+ Model: string;
35314
+
35315
+ @Field()
35316
+ @MaxLength(100)
35317
+ Vendor: string;
35318
+
35319
+ @Field({nullable: true})
35320
+ @MaxLength(510)
35321
+ Agent?: string;
35322
+
35323
+ @Field({nullable: true})
35324
+ @MaxLength(200)
35325
+ Configuration?: string;
35326
+
35327
+ @Field(() => [AIResultCache_])
35328
+ AIResultCache_PromptRunIDArray: AIResultCache_[]; // Link to AIResultCache
35329
+
35330
+ }
35331
+
35332
+ //****************************************************************************
35333
+ // INPUT TYPE for MJ: AI Prompt Runs
35334
+ //****************************************************************************
35335
+ @InputType()
35336
+ export class CreateAIPromptRunInput {
35337
+ @Field({ nullable: true })
35338
+ PromptID?: string;
35339
+
35340
+ @Field({ nullable: true })
35341
+ ModelID?: string;
35342
+
35343
+ @Field({ nullable: true })
35344
+ VendorID?: string;
35345
+
35346
+ @Field({ nullable: true })
35347
+ AgentID: string | null;
35348
+
35349
+ @Field({ nullable: true })
35350
+ ConfigurationID: string | null;
35351
+
35352
+ @Field(() => Int, { nullable: true })
35353
+ RunAt?: Date;
35354
+
35355
+ @Field(() => Int, { nullable: true })
35356
+ CompletedAt: Date | null;
35357
+
35358
+ @Field(() => Int, { nullable: true })
35359
+ ExecutionTimeMS: number | null;
35360
+
35361
+ @Field({ nullable: true })
35362
+ Messages: string | null;
35363
+
35364
+ @Field({ nullable: true })
35365
+ Result: string | null;
35366
+
35367
+ @Field(() => Int, { nullable: true })
35368
+ TokensUsed: number | null;
35369
+
35370
+ @Field(() => Int, { nullable: true })
35371
+ TokensPrompt: number | null;
35372
+
35373
+ @Field(() => Int, { nullable: true })
35374
+ TokensCompletion: number | null;
35375
+
35376
+ @Field(() => Float, { nullable: true })
35377
+ TotalCost: number | null;
35378
+
35379
+ @Field(() => Boolean, { nullable: true })
35380
+ Success?: boolean;
35381
+
35382
+ @Field({ nullable: true })
35383
+ ErrorMessage: string | null;
35384
+ }
35385
+
35386
+
35387
+ //****************************************************************************
35388
+ // INPUT TYPE for MJ: AI Prompt Runs
35389
+ //****************************************************************************
35390
+ @InputType()
35391
+ export class UpdateAIPromptRunInput {
35392
+ @Field()
35393
+ ID: string;
35394
+
35395
+ @Field({ nullable: true })
35396
+ PromptID?: string;
35397
+
35398
+ @Field({ nullable: true })
35399
+ ModelID?: string;
35400
+
35401
+ @Field({ nullable: true })
35402
+ VendorID?: string;
35403
+
35404
+ @Field({ nullable: true })
35405
+ AgentID?: string | null;
35406
+
35407
+ @Field({ nullable: true })
35408
+ ConfigurationID?: string | null;
35409
+
35410
+ @Field(() => Int, { nullable: true })
35411
+ RunAt?: Date;
35412
+
35413
+ @Field(() => Int, { nullable: true })
35414
+ CompletedAt?: Date | null;
35415
+
35416
+ @Field(() => Int, { nullable: true })
35417
+ ExecutionTimeMS?: number | null;
35418
+
35419
+ @Field({ nullable: true })
35420
+ Messages?: string | null;
35421
+
35422
+ @Field({ nullable: true })
35423
+ Result?: string | null;
35424
+
35425
+ @Field(() => Int, { nullable: true })
35426
+ TokensUsed?: number | null;
35427
+
35428
+ @Field(() => Int, { nullable: true })
35429
+ TokensPrompt?: number | null;
35430
+
35431
+ @Field(() => Int, { nullable: true })
35432
+ TokensCompletion?: number | null;
35433
+
35434
+ @Field(() => Float, { nullable: true })
35435
+ TotalCost?: number | null;
35436
+
35437
+ @Field(() => Boolean, { nullable: true })
35438
+ Success?: boolean;
35439
+
35440
+ @Field({ nullable: true })
35441
+ ErrorMessage?: string | null;
35442
+
35443
+ @Field(() => [KeyValuePairInput], { nullable: true })
35444
+ OldValues___?: KeyValuePairInput[];
35445
+ }
35446
+
35447
+ //****************************************************************************
35448
+ // RESOLVER for MJ: AI Prompt Runs
35449
+ //****************************************************************************
35450
+ @ObjectType()
35451
+ export class RunAIPromptRunViewResult {
35452
+ @Field(() => [AIPromptRun_])
35453
+ Results: AIPromptRun_[];
35454
+
35455
+ @Field(() => String, {nullable: true})
35456
+ UserViewRunID?: string;
35457
+
35458
+ @Field(() => Int, {nullable: true})
35459
+ RowCount: number;
35460
+
35461
+ @Field(() => Int, {nullable: true})
35462
+ TotalRowCount: number;
35463
+
35464
+ @Field(() => Int, {nullable: true})
35465
+ ExecutionTime: number;
35466
+
35467
+ @Field({nullable: true})
35468
+ ErrorMessage?: string;
35469
+
35470
+ @Field(() => Boolean, {nullable: false})
35471
+ Success: boolean;
35472
+ }
35473
+
35474
+ @Resolver(AIPromptRun_)
35475
+ export class AIPromptRunResolver extends ResolverBase {
35476
+ @Query(() => RunAIPromptRunViewResult)
35477
+ async RunAIPromptRunViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35478
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35479
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
35480
+ }
35481
+
35482
+ @Query(() => RunAIPromptRunViewResult)
35483
+ async RunAIPromptRunViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35484
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35485
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
35486
+ }
35487
+
35488
+ @Query(() => RunAIPromptRunViewResult)
35489
+ async RunAIPromptRunDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35490
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35491
+ input.EntityName = 'MJ: AI Prompt Runs';
35492
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
35493
+ }
35494
+ @Query(() => AIPromptRun_, { nullable: true })
35495
+ async AIPromptRun(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIPromptRun_ | null> {
35496
+ this.CheckUserReadPermissions('MJ: AI Prompt Runs', userPayload);
35497
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35498
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIPromptRuns] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Prompt Runs', userPayload, EntityPermissionType.Read, 'AND');
35499
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Prompt Runs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
35500
+ return result;
35501
+ }
35502
+
35503
+ @FieldResolver(() => [AIResultCache_])
35504
+ async AIResultCache_PromptRunIDArray(@Root() aipromptrun_: AIPromptRun_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35505
+ this.CheckUserReadPermissions('AI Result Cache', userPayload);
35506
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35507
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIResultCaches] WHERE [PromptRunID]='${aipromptrun_.ID}' ` + this.getRowLevelSecurityWhereClause('AI Result Cache', userPayload, EntityPermissionType.Read, 'AND');
35508
+ const result = this.ArrayMapFieldNamesToCodeNames('AI Result Cache', await dataSource.query(sSQL));
35509
+ return result;
35510
+ }
35511
+
35512
+ @Mutation(() => AIPromptRun_)
35513
+ async CreateAIPromptRun(
35514
+ @Arg('input', () => CreateAIPromptRunInput) input: CreateAIPromptRunInput,
35515
+ @Ctx() { dataSources, userPayload }: AppContext,
35516
+ @PubSub() pubSub: PubSubEngine
35517
+ ) {
35518
+ const dataSource = GetReadWriteDataSource(dataSources);
35519
+ return this.CreateRecord('MJ: AI Prompt Runs', input, dataSource, userPayload, pubSub)
35520
+ }
35521
+
35522
+ @Mutation(() => AIPromptRun_)
35523
+ async UpdateAIPromptRun(
35524
+ @Arg('input', () => UpdateAIPromptRunInput) input: UpdateAIPromptRunInput,
35525
+ @Ctx() { dataSources, userPayload }: AppContext,
35526
+ @PubSub() pubSub: PubSubEngine
35527
+ ) {
35528
+ const dataSource = GetReadWriteDataSource(dataSources);
35529
+ return this.UpdateRecord('MJ: AI Prompt Runs', input, dataSource, userPayload, pubSub);
35530
+ }
35531
+
35532
+ @Mutation(() => AIPromptRun_)
35533
+ async DeleteAIPromptRun(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35534
+ const dataSource = GetReadWriteDataSource(dataSources);
35535
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
35536
+ return this.DeleteRecord('MJ: AI Prompt Runs', key, options, dataSource, userPayload, pubSub);
35537
+ }
35538
+
35539
+ }
35540
+
32735
35541
  //****************************************************************************
32736
35542
  // ENTITY CLASS for MJ: Conversation Artifact Permissions
32737
35543
  //****************************************************************************
@@ -33246,4 +36052,179 @@ export class ReportVersionResolver extends ResolverBase {
33246
36052
  return this.DeleteRecord('MJ: Report Versions', key, options, dataSource, userPayload, pubSub);
33247
36053
  }
33248
36054
 
36055
+ }
36056
+
36057
+ //****************************************************************************
36058
+ // ENTITY CLASS for MJ: AI Configuration Params
36059
+ //****************************************************************************
36060
+ @ObjectType()
36061
+ export class AIConfigurationParam_ {
36062
+ @Field()
36063
+ @MaxLength(16)
36064
+ ID: string;
36065
+
36066
+ @Field()
36067
+ @MaxLength(16)
36068
+ ConfigurationID: string;
36069
+
36070
+ @Field({description: `The name of the configuration parameter.`})
36071
+ @MaxLength(200)
36072
+ Name: string;
36073
+
36074
+ @Field({description: `The data type of the parameter (string, number, boolean, date, object).`})
36075
+ @MaxLength(40)
36076
+ Type: string;
36077
+
36078
+ @Field({description: `The value of the parameter, stored as a string but interpreted according to the Type.`})
36079
+ Value: string;
36080
+
36081
+ @Field({nullable: true, description: `Detailed description of the parameter and its usage.`})
36082
+ Description?: string;
36083
+
36084
+ @Field()
36085
+ @MaxLength(10)
36086
+ _mj__CreatedAt: Date;
36087
+
36088
+ @Field()
36089
+ @MaxLength(10)
36090
+ _mj__UpdatedAt: Date;
36091
+
36092
+ @Field()
36093
+ @MaxLength(200)
36094
+ Configuration: string;
36095
+
36096
+ }
36097
+
36098
+ //****************************************************************************
36099
+ // INPUT TYPE for MJ: AI Configuration Params
36100
+ //****************************************************************************
36101
+ @InputType()
36102
+ export class CreateAIConfigurationParamInput {
36103
+ @Field({ nullable: true })
36104
+ ConfigurationID?: string;
36105
+
36106
+ @Field({ nullable: true })
36107
+ Name?: string;
36108
+
36109
+ @Field({ nullable: true })
36110
+ Type?: string;
36111
+
36112
+ @Field({ nullable: true })
36113
+ Value?: string;
36114
+
36115
+ @Field({ nullable: true })
36116
+ Description: string | null;
36117
+ }
36118
+
36119
+
36120
+ //****************************************************************************
36121
+ // INPUT TYPE for MJ: AI Configuration Params
36122
+ //****************************************************************************
36123
+ @InputType()
36124
+ export class UpdateAIConfigurationParamInput {
36125
+ @Field()
36126
+ ID: string;
36127
+
36128
+ @Field({ nullable: true })
36129
+ ConfigurationID?: string;
36130
+
36131
+ @Field({ nullable: true })
36132
+ Name?: string;
36133
+
36134
+ @Field({ nullable: true })
36135
+ Type?: string;
36136
+
36137
+ @Field({ nullable: true })
36138
+ Value?: string;
36139
+
36140
+ @Field({ nullable: true })
36141
+ Description?: string | null;
36142
+
36143
+ @Field(() => [KeyValuePairInput], { nullable: true })
36144
+ OldValues___?: KeyValuePairInput[];
36145
+ }
36146
+
36147
+ //****************************************************************************
36148
+ // RESOLVER for MJ: AI Configuration Params
36149
+ //****************************************************************************
36150
+ @ObjectType()
36151
+ export class RunAIConfigurationParamViewResult {
36152
+ @Field(() => [AIConfigurationParam_])
36153
+ Results: AIConfigurationParam_[];
36154
+
36155
+ @Field(() => String, {nullable: true})
36156
+ UserViewRunID?: string;
36157
+
36158
+ @Field(() => Int, {nullable: true})
36159
+ RowCount: number;
36160
+
36161
+ @Field(() => Int, {nullable: true})
36162
+ TotalRowCount: number;
36163
+
36164
+ @Field(() => Int, {nullable: true})
36165
+ ExecutionTime: number;
36166
+
36167
+ @Field({nullable: true})
36168
+ ErrorMessage?: string;
36169
+
36170
+ @Field(() => Boolean, {nullable: false})
36171
+ Success: boolean;
36172
+ }
36173
+
36174
+ @Resolver(AIConfigurationParam_)
36175
+ export class AIConfigurationParamResolver extends ResolverBase {
36176
+ @Query(() => RunAIConfigurationParamViewResult)
36177
+ async RunAIConfigurationParamViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36178
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36179
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
36180
+ }
36181
+
36182
+ @Query(() => RunAIConfigurationParamViewResult)
36183
+ async RunAIConfigurationParamViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36184
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36185
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
36186
+ }
36187
+
36188
+ @Query(() => RunAIConfigurationParamViewResult)
36189
+ async RunAIConfigurationParamDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36190
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36191
+ input.EntityName = 'MJ: AI Configuration Params';
36192
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
36193
+ }
36194
+ @Query(() => AIConfigurationParam_, { nullable: true })
36195
+ async AIConfigurationParam(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIConfigurationParam_ | null> {
36196
+ this.CheckUserReadPermissions('MJ: AI Configuration Params', userPayload);
36197
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36198
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIConfigurationParams] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: AI Configuration Params', userPayload, EntityPermissionType.Read, 'AND');
36199
+ const result = this.MapFieldNamesToCodeNames('MJ: AI Configuration Params', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
36200
+ return result;
36201
+ }
36202
+
36203
+ @Mutation(() => AIConfigurationParam_)
36204
+ async CreateAIConfigurationParam(
36205
+ @Arg('input', () => CreateAIConfigurationParamInput) input: CreateAIConfigurationParamInput,
36206
+ @Ctx() { dataSources, userPayload }: AppContext,
36207
+ @PubSub() pubSub: PubSubEngine
36208
+ ) {
36209
+ const dataSource = GetReadWriteDataSource(dataSources);
36210
+ return this.CreateRecord('MJ: AI Configuration Params', input, dataSource, userPayload, pubSub)
36211
+ }
36212
+
36213
+ @Mutation(() => AIConfigurationParam_)
36214
+ async UpdateAIConfigurationParam(
36215
+ @Arg('input', () => UpdateAIConfigurationParamInput) input: UpdateAIConfigurationParamInput,
36216
+ @Ctx() { dataSources, userPayload }: AppContext,
36217
+ @PubSub() pubSub: PubSubEngine
36218
+ ) {
36219
+ const dataSource = GetReadWriteDataSource(dataSources);
36220
+ return this.UpdateRecord('MJ: AI Configuration Params', input, dataSource, userPayload, pubSub);
36221
+ }
36222
+
36223
+ @Mutation(() => AIConfigurationParam_)
36224
+ async DeleteAIConfigurationParam(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36225
+ const dataSource = GetReadWriteDataSource(dataSources);
36226
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
36227
+ return this.DeleteRecord('MJ: AI Configuration Params', key, options, dataSource, userPayload, pubSub);
36228
+ }
36229
+
33249
36230
  }