@memberjunction/server 2.29.2 → 2.31.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, 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, AIAgentRequestEntity, QueryEntityEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, AIAgentLearningCycleEntity } from '@memberjunction/core-entities';
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, AIAgentRequestEntity, ReportUserStateEntity, QueryEntityEntity, ContentProcessRunEntity, ContentSourceEntity, ContentSourceParamEntity, ContentSourceTypeEntity, ContentSourceTypeParamEntity, ContentTypeEntity, ContentTypeAttributeEntity, ContentFileTypeEntity, ContentItemEntity, ContentItemAttributeEntity, ContentItemTagEntity, GeneratedCodeEntity, AIAgentLearningCycleEntity, ReportVersionEntity } from '@memberjunction/core-entities';
23
23
 
24
24
 
25
25
  //****************************************************************************
@@ -678,6 +678,186 @@ export class ExplorerNavigationItemResolver extends ResolverBase {
678
678
 
679
679
  }
680
680
 
681
+ //****************************************************************************
682
+ // ENTITY CLASS for Generated Code Categories
683
+ //****************************************************************************
684
+ @ObjectType()
685
+ export class GeneratedCodeCategory_ {
686
+ @Field()
687
+ @MaxLength(16)
688
+ ID: string;
689
+
690
+ @Field()
691
+ @MaxLength(510)
692
+ Name: string;
693
+
694
+ @Field({nullable: true})
695
+ Description?: string;
696
+
697
+ @Field({nullable: true, description: `Parent category ID, allowing for hierarchical categorization.`})
698
+ @MaxLength(16)
699
+ ParentID?: string;
700
+
701
+ @Field()
702
+ @MaxLength(10)
703
+ _mj__CreatedAt: Date;
704
+
705
+ @Field()
706
+ @MaxLength(10)
707
+ _mj__UpdatedAt: Date;
708
+
709
+ @Field({nullable: true})
710
+ @MaxLength(510)
711
+ Parent?: string;
712
+
713
+ @Field(() => [GeneratedCodeCategory_])
714
+ GeneratedCodeCategories_ParentIDArray: GeneratedCodeCategory_[]; // Link to GeneratedCodeCategories
715
+
716
+ @Field(() => [GeneratedCode_])
717
+ GeneratedCodes_CategoryIDArray: GeneratedCode_[]; // Link to GeneratedCodes
718
+
719
+ }
720
+
721
+ //****************************************************************************
722
+ // INPUT TYPE for Generated Code Categories
723
+ //****************************************************************************
724
+ @InputType()
725
+ export class CreateGeneratedCodeCategoryInput {
726
+ @Field({ nullable: true })
727
+ Name?: string;
728
+
729
+ @Field({ nullable: true })
730
+ Description: string | null;
731
+
732
+ @Field({ nullable: true })
733
+ ParentID: string | null;
734
+ }
735
+
736
+
737
+ //****************************************************************************
738
+ // INPUT TYPE for Generated Code Categories
739
+ //****************************************************************************
740
+ @InputType()
741
+ export class UpdateGeneratedCodeCategoryInput {
742
+ @Field()
743
+ ID: string;
744
+
745
+ @Field({ nullable: true })
746
+ Name?: string;
747
+
748
+ @Field({ nullable: true })
749
+ Description?: string | null;
750
+
751
+ @Field({ nullable: true })
752
+ ParentID?: string | null;
753
+
754
+ @Field(() => [KeyValuePairInput], { nullable: true })
755
+ OldValues___?: KeyValuePairInput[];
756
+ }
757
+
758
+ //****************************************************************************
759
+ // RESOLVER for Generated Code Categories
760
+ //****************************************************************************
761
+ @ObjectType()
762
+ export class RunGeneratedCodeCategoryViewResult {
763
+ @Field(() => [GeneratedCodeCategory_])
764
+ Results: GeneratedCodeCategory_[];
765
+
766
+ @Field(() => String, {nullable: true})
767
+ UserViewRunID?: string;
768
+
769
+ @Field(() => Int, {nullable: true})
770
+ RowCount: number;
771
+
772
+ @Field(() => Int, {nullable: true})
773
+ TotalRowCount: number;
774
+
775
+ @Field(() => Int, {nullable: true})
776
+ ExecutionTime: number;
777
+
778
+ @Field({nullable: true})
779
+ ErrorMessage?: string;
780
+
781
+ @Field(() => Boolean, {nullable: false})
782
+ Success: boolean;
783
+ }
784
+
785
+ @Resolver(GeneratedCodeCategory_)
786
+ export class GeneratedCodeCategoryResolver extends ResolverBase {
787
+ @Query(() => RunGeneratedCodeCategoryViewResult)
788
+ async RunGeneratedCodeCategoryViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
789
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
790
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
791
+ }
792
+
793
+ @Query(() => RunGeneratedCodeCategoryViewResult)
794
+ async RunGeneratedCodeCategoryViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
795
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
796
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
797
+ }
798
+
799
+ @Query(() => RunGeneratedCodeCategoryViewResult)
800
+ async RunGeneratedCodeCategoryDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
801
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
802
+ input.EntityName = 'Generated Code Categories';
803
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
804
+ }
805
+ @Query(() => GeneratedCodeCategory_, { nullable: true })
806
+ async GeneratedCodeCategory(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<GeneratedCodeCategory_ | null> {
807
+ this.CheckUserReadPermissions('Generated Code Categories', userPayload);
808
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
809
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwGeneratedCodeCategories] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('Generated Code Categories', userPayload, EntityPermissionType.Read, 'AND');
810
+ const result = this.MapFieldNamesToCodeNames('Generated Code Categories', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
811
+ return result;
812
+ }
813
+
814
+ @FieldResolver(() => [GeneratedCodeCategory_])
815
+ async GeneratedCodeCategories_ParentIDArray(@Root() generatedcodecategory_: GeneratedCodeCategory_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
816
+ this.CheckUserReadPermissions('Generated Code Categories', userPayload);
817
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
818
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwGeneratedCodeCategories] WHERE [ParentID]='${generatedcodecategory_.ID}' ` + this.getRowLevelSecurityWhereClause('Generated Code Categories', userPayload, EntityPermissionType.Read, 'AND');
819
+ const result = this.ArrayMapFieldNamesToCodeNames('Generated Code Categories', await dataSource.query(sSQL));
820
+ return result;
821
+ }
822
+
823
+ @FieldResolver(() => [GeneratedCode_])
824
+ async GeneratedCodes_CategoryIDArray(@Root() generatedcodecategory_: GeneratedCodeCategory_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
825
+ this.CheckUserReadPermissions('Generated Codes', userPayload);
826
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
827
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwGeneratedCodes] WHERE [CategoryID]='${generatedcodecategory_.ID}' ` + this.getRowLevelSecurityWhereClause('Generated Codes', userPayload, EntityPermissionType.Read, 'AND');
828
+ const result = this.ArrayMapFieldNamesToCodeNames('Generated Codes', await dataSource.query(sSQL));
829
+ return result;
830
+ }
831
+
832
+ @Mutation(() => GeneratedCodeCategory_)
833
+ async CreateGeneratedCodeCategory(
834
+ @Arg('input', () => CreateGeneratedCodeCategoryInput) input: CreateGeneratedCodeCategoryInput,
835
+ @Ctx() { dataSources, userPayload }: AppContext,
836
+ @PubSub() pubSub: PubSubEngine
837
+ ) {
838
+ const dataSource = GetReadWriteDataSource(dataSources);
839
+ return this.CreateRecord('Generated Code Categories', input, dataSource, userPayload, pubSub)
840
+ }
841
+
842
+ @Mutation(() => GeneratedCodeCategory_)
843
+ async UpdateGeneratedCodeCategory(
844
+ @Arg('input', () => UpdateGeneratedCodeCategoryInput) input: UpdateGeneratedCodeCategoryInput,
845
+ @Ctx() { dataSources, userPayload }: AppContext,
846
+ @PubSub() pubSub: PubSubEngine
847
+ ) {
848
+ const dataSource = GetReadWriteDataSource(dataSources);
849
+ return this.UpdateRecord('Generated Code Categories', input, dataSource, userPayload, pubSub);
850
+ }
851
+
852
+ @Mutation(() => GeneratedCodeCategory_)
853
+ async DeleteGeneratedCodeCategory(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
854
+ const dataSource = GetReadWriteDataSource(dataSources);
855
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
856
+ return this.DeleteRecord('Generated Code Categories', key, options, dataSource, userPayload, pubSub);
857
+ }
858
+
859
+ }
860
+
681
861
  //****************************************************************************
682
862
  // ENTITY CLASS for AI Agent Models
683
863
  //****************************************************************************
@@ -5221,6 +5401,9 @@ export class Entity_ {
5221
5401
  @Field(() => [QueryEntity_])
5222
5402
  QueryEntities_EntityIDArray: QueryEntity_[]; // Link to QueryEntities
5223
5403
 
5404
+ @Field(() => [GeneratedCode_])
5405
+ GeneratedCodes_LinkedEntityIDArray: GeneratedCode_[]; // Link to GeneratedCodes
5406
+
5224
5407
  }
5225
5408
 
5226
5409
  //****************************************************************************
@@ -5913,6 +6096,15 @@ export class EntityResolverBase extends ResolverBase {
5913
6096
  return result;
5914
6097
  }
5915
6098
 
6099
+ @FieldResolver(() => [GeneratedCode_])
6100
+ async GeneratedCodes_LinkedEntityIDArray(@Root() entity_: Entity_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
6101
+ this.CheckUserReadPermissions('Generated Codes', userPayload);
6102
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
6103
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwGeneratedCodes] WHERE [LinkedEntityID]='${entity_.ID}' ` + this.getRowLevelSecurityWhereClause('Generated Codes', userPayload, EntityPermissionType.Read, 'AND');
6104
+ const result = this.ArrayMapFieldNamesToCodeNames('Generated Codes', await dataSource.query(sSQL));
6105
+ return result;
6106
+ }
6107
+
5916
6108
  @Mutation(() => Entity_)
5917
6109
  async CreateEntity(
5918
6110
  @Arg('input', () => CreateEntityInput) input: CreateEntityInput,
@@ -6128,6 +6320,9 @@ export class User_ {
6128
6320
  @Field(() => [AIAgentRequest_])
6129
6321
  AIAgentRequests_ResponseByUserIDArray: AIAgentRequest_[]; // Link to AIAgentRequests
6130
6322
 
6323
+ @Field(() => [ReportUserState_])
6324
+ MJ_ReportUserStates_UserIDArray: ReportUserState_[]; // Link to MJ_ReportUserStates
6325
+
6131
6326
  @Field(() => [AIAgentNote_])
6132
6327
  AIAgentNotes_UserIDArray: AIAgentNote_[]; // Link to AIAgentNotes
6133
6328
 
@@ -6598,6 +6793,15 @@ export class UserResolverBase extends ResolverBase {
6598
6793
  return result;
6599
6794
  }
6600
6795
 
6796
+ @FieldResolver(() => [ReportUserState_])
6797
+ async MJ_ReportUserStates_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
6798
+ this.CheckUserReadPermissions('MJ: Report User States', userPayload);
6799
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
6800
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwReportUserStates] WHERE [UserID]='${user_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Report User States', userPayload, EntityPermissionType.Read, 'AND');
6801
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Report User States', await dataSource.query(sSQL));
6802
+ return result;
6803
+ }
6804
+
6601
6805
  @FieldResolver(() => [AIAgentNote_])
6602
6806
  async AIAgentNotes_UserIDArray(@Root() user_: User_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
6603
6807
  this.CheckUserReadPermissions('AI Agent Notes', userPayload);
@@ -11884,6 +12088,9 @@ export class AIModel_ {
11884
12088
  @Field(() => [AIAgentModel_])
11885
12089
  AIAgentModels_ModelIDArray: AIAgentModel_[]; // Link to AIAgentModels
11886
12090
 
12091
+ @Field(() => [GeneratedCode_])
12092
+ GeneratedCodes_GeneratedByModelIDArray: GeneratedCode_[]; // Link to GeneratedCodes
12093
+
11887
12094
  }
11888
12095
 
11889
12096
  //****************************************************************************
@@ -12126,6 +12333,15 @@ export class AIModelResolver extends ResolverBase {
12126
12333
  return result;
12127
12334
  }
12128
12335
 
12336
+ @FieldResolver(() => [GeneratedCode_])
12337
+ async GeneratedCodes_GeneratedByModelIDArray(@Root() aimodel_: AIModel_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
12338
+ this.CheckUserReadPermissions('Generated Codes', userPayload);
12339
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
12340
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwGeneratedCodes] WHERE [GeneratedByModelID]='${aimodel_.ID}' ` + this.getRowLevelSecurityWhereClause('Generated Codes', userPayload, EntityPermissionType.Read, 'AND');
12341
+ const result = this.ArrayMapFieldNamesToCodeNames('Generated Codes', await dataSource.query(sSQL));
12342
+ return result;
12343
+ }
12344
+
12129
12345
  @Mutation(() => AIModel_)
12130
12346
  async CreateAIModel(
12131
12347
  @Arg('input', () => CreateAIModelInput) input: CreateAIModelInput,
@@ -14135,6 +14351,12 @@ export class Report_ {
14135
14351
  @Field(() => [ReportSnapshot_])
14136
14352
  ReportSnapshots_ReportIDArray: ReportSnapshot_[]; // Link to ReportSnapshots
14137
14353
 
14354
+ @Field(() => [ReportVersion_])
14355
+ MJ_ReportVersions_ReportIDArray: ReportVersion_[]; // Link to MJ_ReportVersions
14356
+
14357
+ @Field(() => [ReportUserState_])
14358
+ MJ_ReportUserStates_ReportIDArray: ReportUserState_[]; // Link to MJ_ReportUserStates
14359
+
14138
14360
  }
14139
14361
 
14140
14362
  //****************************************************************************
@@ -14311,6 +14533,24 @@ export class ReportResolver extends ResolverBase {
14311
14533
  return result;
14312
14534
  }
14313
14535
 
14536
+ @FieldResolver(() => [ReportVersion_])
14537
+ async MJ_ReportVersions_ReportIDArray(@Root() report_: Report_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
14538
+ this.CheckUserReadPermissions('MJ: Report Versions', userPayload);
14539
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
14540
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwReportVersions] WHERE [ReportID]='${report_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Report Versions', userPayload, EntityPermissionType.Read, 'AND');
14541
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Report Versions', await dataSource.query(sSQL));
14542
+ return result;
14543
+ }
14544
+
14545
+ @FieldResolver(() => [ReportUserState_])
14546
+ async MJ_ReportUserStates_ReportIDArray(@Root() report_: Report_, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
14547
+ this.CheckUserReadPermissions('MJ: Report User States', userPayload);
14548
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
14549
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwReportUserStates] WHERE [ReportID]='${report_.ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Report User States', userPayload, EntityPermissionType.Read, 'AND');
14550
+ const result = this.ArrayMapFieldNamesToCodeNames('MJ: Report User States', await dataSource.query(sSQL));
14551
+ return result;
14552
+ }
14553
+
14314
14554
  @Mutation(() => Report_)
14315
14555
  async CreateReport(
14316
14556
  @Arg('input', () => CreateReportInput) input: CreateReportInput,
@@ -29361,21 +29601,24 @@ export class AIAgentRequestResolver extends ResolverBase {
29361
29601
  }
29362
29602
 
29363
29603
  //****************************************************************************
29364
- // ENTITY CLASS for Query Entities
29604
+ // ENTITY CLASS for MJ: Report User States
29365
29605
  //****************************************************************************
29366
- @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.` })
29367
- export class QueryEntity_ {
29368
- @Field({description: `Unique identifier for the QueryEntity record.`})
29606
+ @ObjectType()
29607
+ export class ReportUserState_ {
29608
+ @Field()
29369
29609
  @MaxLength(16)
29370
29610
  ID: string;
29371
29611
 
29372
- @Field({description: `References the ID of the query in the Queries table.`})
29612
+ @Field()
29373
29613
  @MaxLength(16)
29374
- QueryID: string;
29614
+ ReportID: string;
29375
29615
 
29376
- @Field({description: `References the ID of the entity in the Entities table.`})
29616
+ @Field()
29377
29617
  @MaxLength(16)
29378
- EntityID: string;
29618
+ UserID: string;
29619
+
29620
+ @Field({nullable: true, description: `JSON serialized state of user interaction with the report`})
29621
+ ReportState?: string;
29379
29622
 
29380
29623
  @Field()
29381
29624
  @MaxLength(10)
@@ -29387,52 +29630,58 @@ export class QueryEntity_ {
29387
29630
 
29388
29631
  @Field()
29389
29632
  @MaxLength(510)
29390
- Query: string;
29633
+ Report: string;
29391
29634
 
29392
29635
  @Field()
29393
- @MaxLength(510)
29394
- Entity: string;
29636
+ @MaxLength(200)
29637
+ User: string;
29395
29638
 
29396
29639
  }
29397
29640
 
29398
29641
  //****************************************************************************
29399
- // INPUT TYPE for Query Entities
29642
+ // INPUT TYPE for MJ: Report User States
29400
29643
  //****************************************************************************
29401
29644
  @InputType()
29402
- export class CreateQueryEntityInput {
29645
+ export class CreateReportUserStateInput {
29403
29646
  @Field({ nullable: true })
29404
- QueryID?: string;
29647
+ ReportID?: string;
29405
29648
 
29406
29649
  @Field({ nullable: true })
29407
- EntityID?: string;
29650
+ UserID?: string;
29651
+
29652
+ @Field({ nullable: true })
29653
+ ReportState: string | null;
29408
29654
  }
29409
29655
 
29410
29656
 
29411
29657
  //****************************************************************************
29412
- // INPUT TYPE for Query Entities
29658
+ // INPUT TYPE for MJ: Report User States
29413
29659
  //****************************************************************************
29414
29660
  @InputType()
29415
- export class UpdateQueryEntityInput {
29661
+ export class UpdateReportUserStateInput {
29416
29662
  @Field()
29417
29663
  ID: string;
29418
29664
 
29419
29665
  @Field({ nullable: true })
29420
- QueryID?: string;
29666
+ ReportID?: string;
29421
29667
 
29422
29668
  @Field({ nullable: true })
29423
- EntityID?: string;
29669
+ UserID?: string;
29670
+
29671
+ @Field({ nullable: true })
29672
+ ReportState?: string | null;
29424
29673
 
29425
29674
  @Field(() => [KeyValuePairInput], { nullable: true })
29426
29675
  OldValues___?: KeyValuePairInput[];
29427
29676
  }
29428
29677
 
29429
29678
  //****************************************************************************
29430
- // RESOLVER for Query Entities
29679
+ // RESOLVER for MJ: Report User States
29431
29680
  //****************************************************************************
29432
29681
  @ObjectType()
29433
- export class RunQueryEntityViewResult {
29434
- @Field(() => [QueryEntity_])
29435
- Results: QueryEntity_[];
29682
+ export class RunReportUserStateViewResult {
29683
+ @Field(() => [ReportUserState_])
29684
+ Results: ReportUserState_[];
29436
29685
 
29437
29686
  @Field(() => String, {nullable: true})
29438
29687
  UserViewRunID?: string;
@@ -29453,91 +29702,80 @@ export class RunQueryEntityViewResult {
29453
29702
  Success: boolean;
29454
29703
  }
29455
29704
 
29456
- @Resolver(QueryEntity_)
29457
- export class QueryEntityResolver extends ResolverBase {
29458
- @Query(() => RunQueryEntityViewResult)
29459
- async RunQueryEntityViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29705
+ @Resolver(ReportUserState_)
29706
+ export class ReportUserStateResolver extends ResolverBase {
29707
+ @Query(() => RunReportUserStateViewResult)
29708
+ async RunReportUserStateViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29460
29709
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29461
29710
  return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
29462
29711
  }
29463
29712
 
29464
- @Query(() => RunQueryEntityViewResult)
29465
- async RunQueryEntityViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29713
+ @Query(() => RunReportUserStateViewResult)
29714
+ async RunReportUserStateViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29466
29715
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29467
29716
  return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
29468
29717
  }
29469
29718
 
29470
- @Query(() => RunQueryEntityViewResult)
29471
- async RunQueryEntityDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29719
+ @Query(() => RunReportUserStateViewResult)
29720
+ async RunReportUserStateDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29472
29721
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29473
- input.EntityName = 'Query Entities';
29722
+ input.EntityName = 'MJ: Report User States';
29474
29723
  return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
29475
29724
  }
29476
- @Query(() => QueryEntity_, { nullable: true })
29477
- async QueryEntity(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<QueryEntity_ | null> {
29478
- this.CheckUserReadPermissions('Query Entities', userPayload);
29725
+ @Query(() => ReportUserState_, { nullable: true })
29726
+ async ReportUserState(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ReportUserState_ | null> {
29727
+ this.CheckUserReadPermissions('MJ: Report User States', userPayload);
29479
29728
  const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29480
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwQueryEntities] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('Query Entities', userPayload, EntityPermissionType.Read, 'AND');
29481
- const result = this.MapFieldNamesToCodeNames('Query Entities', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
29729
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwReportUserStates] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Report User States', userPayload, EntityPermissionType.Read, 'AND');
29730
+ const result = this.MapFieldNamesToCodeNames('MJ: Report User States', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
29482
29731
  return result;
29483
29732
  }
29484
29733
 
29485
- @Mutation(() => QueryEntity_)
29486
- async CreateQueryEntity(
29487
- @Arg('input', () => CreateQueryEntityInput) input: CreateQueryEntityInput,
29734
+ @Mutation(() => ReportUserState_)
29735
+ async CreateReportUserState(
29736
+ @Arg('input', () => CreateReportUserStateInput) input: CreateReportUserStateInput,
29488
29737
  @Ctx() { dataSources, userPayload }: AppContext,
29489
29738
  @PubSub() pubSub: PubSubEngine
29490
29739
  ) {
29491
29740
  const dataSource = GetReadWriteDataSource(dataSources);
29492
- return this.CreateRecord('Query Entities', input, dataSource, userPayload, pubSub)
29741
+ return this.CreateRecord('MJ: Report User States', input, dataSource, userPayload, pubSub)
29493
29742
  }
29494
29743
 
29495
- @Mutation(() => QueryEntity_)
29496
- async UpdateQueryEntity(
29497
- @Arg('input', () => UpdateQueryEntityInput) input: UpdateQueryEntityInput,
29744
+ @Mutation(() => ReportUserState_)
29745
+ async UpdateReportUserState(
29746
+ @Arg('input', () => UpdateReportUserStateInput) input: UpdateReportUserStateInput,
29498
29747
  @Ctx() { dataSources, userPayload }: AppContext,
29499
29748
  @PubSub() pubSub: PubSubEngine
29500
29749
  ) {
29501
29750
  const dataSource = GetReadWriteDataSource(dataSources);
29502
- return this.UpdateRecord('Query Entities', input, dataSource, userPayload, pubSub);
29751
+ return this.UpdateRecord('MJ: Report User States', input, dataSource, userPayload, pubSub);
29503
29752
  }
29504
29753
 
29505
- @Mutation(() => QueryEntity_)
29506
- async DeleteQueryEntity(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29754
+ @Mutation(() => ReportUserState_)
29755
+ async DeleteReportUserState(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29507
29756
  const dataSource = GetReadWriteDataSource(dataSources);
29508
29757
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
29509
- return this.DeleteRecord('Query Entities', key, options, dataSource, userPayload, pubSub);
29758
+ return this.DeleteRecord('MJ: Report User States', key, options, dataSource, userPayload, pubSub);
29510
29759
  }
29511
29760
 
29512
29761
  }
29513
29762
 
29514
29763
  //****************************************************************************
29515
- // ENTITY CLASS for Content Process Runs
29764
+ // ENTITY CLASS for Query Entities
29516
29765
  //****************************************************************************
29517
- @ObjectType()
29518
- export class ContentProcessRun_ {
29519
- @Field()
29766
+ @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.` })
29767
+ export class QueryEntity_ {
29768
+ @Field({description: `Unique identifier for the QueryEntity record.`})
29520
29769
  @MaxLength(16)
29521
29770
  ID: string;
29522
29771
 
29523
- @Field()
29772
+ @Field({description: `References the ID of the query in the Queries table.`})
29524
29773
  @MaxLength(16)
29525
- SourceID: string;
29526
-
29527
- @Field({nullable: true})
29528
- @MaxLength(8)
29529
- StartTime?: Date;
29530
-
29531
- @Field({nullable: true})
29532
- @MaxLength(8)
29533
- EndTime?: Date;
29534
-
29535
- @Field({nullable: true})
29536
- @MaxLength(200)
29537
- Status?: string;
29774
+ QueryID: string;
29538
29775
 
29539
- @Field(() => Int, {nullable: true})
29540
- ProcessedItems?: number;
29776
+ @Field({description: `References the ID of the entity in the Entities table.`})
29777
+ @MaxLength(16)
29778
+ EntityID: string;
29541
29779
 
29542
29780
  @Field()
29543
29781
  @MaxLength(10)
@@ -29547,12 +29785,174 @@ export class ContentProcessRun_ {
29547
29785
  @MaxLength(10)
29548
29786
  _mj__UpdatedAt: Date;
29549
29787
 
29550
- @Field({nullable: true})
29788
+ @Field()
29551
29789
  @MaxLength(510)
29552
- Source?: string;
29790
+ Query: string;
29553
29791
 
29554
- }
29555
-
29792
+ @Field()
29793
+ @MaxLength(510)
29794
+ Entity: string;
29795
+
29796
+ }
29797
+
29798
+ //****************************************************************************
29799
+ // INPUT TYPE for Query Entities
29800
+ //****************************************************************************
29801
+ @InputType()
29802
+ export class CreateQueryEntityInput {
29803
+ @Field({ nullable: true })
29804
+ QueryID?: string;
29805
+
29806
+ @Field({ nullable: true })
29807
+ EntityID?: string;
29808
+ }
29809
+
29810
+
29811
+ //****************************************************************************
29812
+ // INPUT TYPE for Query Entities
29813
+ //****************************************************************************
29814
+ @InputType()
29815
+ export class UpdateQueryEntityInput {
29816
+ @Field()
29817
+ ID: string;
29818
+
29819
+ @Field({ nullable: true })
29820
+ QueryID?: string;
29821
+
29822
+ @Field({ nullable: true })
29823
+ EntityID?: string;
29824
+
29825
+ @Field(() => [KeyValuePairInput], { nullable: true })
29826
+ OldValues___?: KeyValuePairInput[];
29827
+ }
29828
+
29829
+ //****************************************************************************
29830
+ // RESOLVER for Query Entities
29831
+ //****************************************************************************
29832
+ @ObjectType()
29833
+ export class RunQueryEntityViewResult {
29834
+ @Field(() => [QueryEntity_])
29835
+ Results: QueryEntity_[];
29836
+
29837
+ @Field(() => String, {nullable: true})
29838
+ UserViewRunID?: string;
29839
+
29840
+ @Field(() => Int, {nullable: true})
29841
+ RowCount: number;
29842
+
29843
+ @Field(() => Int, {nullable: true})
29844
+ TotalRowCount: number;
29845
+
29846
+ @Field(() => Int, {nullable: true})
29847
+ ExecutionTime: number;
29848
+
29849
+ @Field({nullable: true})
29850
+ ErrorMessage?: string;
29851
+
29852
+ @Field(() => Boolean, {nullable: false})
29853
+ Success: boolean;
29854
+ }
29855
+
29856
+ @Resolver(QueryEntity_)
29857
+ export class QueryEntityResolver extends ResolverBase {
29858
+ @Query(() => RunQueryEntityViewResult)
29859
+ async RunQueryEntityViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29860
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29861
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
29862
+ }
29863
+
29864
+ @Query(() => RunQueryEntityViewResult)
29865
+ async RunQueryEntityViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29866
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29867
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
29868
+ }
29869
+
29870
+ @Query(() => RunQueryEntityViewResult)
29871
+ async RunQueryEntityDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29872
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29873
+ input.EntityName = 'Query Entities';
29874
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
29875
+ }
29876
+ @Query(() => QueryEntity_, { nullable: true })
29877
+ async QueryEntity(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<QueryEntity_ | null> {
29878
+ this.CheckUserReadPermissions('Query Entities', userPayload);
29879
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
29880
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwQueryEntities] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('Query Entities', userPayload, EntityPermissionType.Read, 'AND');
29881
+ const result = this.MapFieldNamesToCodeNames('Query Entities', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
29882
+ return result;
29883
+ }
29884
+
29885
+ @Mutation(() => QueryEntity_)
29886
+ async CreateQueryEntity(
29887
+ @Arg('input', () => CreateQueryEntityInput) input: CreateQueryEntityInput,
29888
+ @Ctx() { dataSources, userPayload }: AppContext,
29889
+ @PubSub() pubSub: PubSubEngine
29890
+ ) {
29891
+ const dataSource = GetReadWriteDataSource(dataSources);
29892
+ return this.CreateRecord('Query Entities', input, dataSource, userPayload, pubSub)
29893
+ }
29894
+
29895
+ @Mutation(() => QueryEntity_)
29896
+ async UpdateQueryEntity(
29897
+ @Arg('input', () => UpdateQueryEntityInput) input: UpdateQueryEntityInput,
29898
+ @Ctx() { dataSources, userPayload }: AppContext,
29899
+ @PubSub() pubSub: PubSubEngine
29900
+ ) {
29901
+ const dataSource = GetReadWriteDataSource(dataSources);
29902
+ return this.UpdateRecord('Query Entities', input, dataSource, userPayload, pubSub);
29903
+ }
29904
+
29905
+ @Mutation(() => QueryEntity_)
29906
+ async DeleteQueryEntity(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
29907
+ const dataSource = GetReadWriteDataSource(dataSources);
29908
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
29909
+ return this.DeleteRecord('Query Entities', key, options, dataSource, userPayload, pubSub);
29910
+ }
29911
+
29912
+ }
29913
+
29914
+ //****************************************************************************
29915
+ // ENTITY CLASS for Content Process Runs
29916
+ //****************************************************************************
29917
+ @ObjectType()
29918
+ export class ContentProcessRun_ {
29919
+ @Field()
29920
+ @MaxLength(16)
29921
+ ID: string;
29922
+
29923
+ @Field()
29924
+ @MaxLength(16)
29925
+ SourceID: string;
29926
+
29927
+ @Field({nullable: true})
29928
+ @MaxLength(8)
29929
+ StartTime?: Date;
29930
+
29931
+ @Field({nullable: true})
29932
+ @MaxLength(8)
29933
+ EndTime?: Date;
29934
+
29935
+ @Field({nullable: true})
29936
+ @MaxLength(200)
29937
+ Status?: string;
29938
+
29939
+ @Field(() => Int, {nullable: true})
29940
+ ProcessedItems?: number;
29941
+
29942
+ @Field()
29943
+ @MaxLength(10)
29944
+ _mj__CreatedAt: Date;
29945
+
29946
+ @Field()
29947
+ @MaxLength(10)
29948
+ _mj__UpdatedAt: Date;
29949
+
29950
+ @Field({nullable: true})
29951
+ @MaxLength(510)
29952
+ Source?: string;
29953
+
29954
+ }
29955
+
29556
29956
  //****************************************************************************
29557
29957
  // INPUT TYPE for Content Process Runs
29558
29958
  //****************************************************************************
@@ -31481,6 +31881,247 @@ export class ContentItemTagResolver extends ResolverBase {
31481
31881
 
31482
31882
  }
31483
31883
 
31884
+ //****************************************************************************
31885
+ // ENTITY CLASS for Generated Codes
31886
+ //****************************************************************************
31887
+ @ObjectType()
31888
+ export class GeneratedCode_ {
31889
+ @Field()
31890
+ @MaxLength(16)
31891
+ ID: string;
31892
+
31893
+ @Field({description: `When the code was generated.`})
31894
+ @MaxLength(10)
31895
+ GeneratedAt: Date;
31896
+
31897
+ @Field({description: `Reference to the category of generated code.`})
31898
+ @MaxLength(16)
31899
+ CategoryID: string;
31900
+
31901
+ @Field({description: `AI model responsible for generating this code.`})
31902
+ @MaxLength(16)
31903
+ GeneratedByModelID: string;
31904
+
31905
+ @Field({description: `Descriptive name of the generated code.`})
31906
+ @MaxLength(510)
31907
+ Name: string;
31908
+
31909
+ @Field({nullable: true, description: `Optional description of the generated code.`})
31910
+ Description?: string;
31911
+
31912
+ @Field({description: `The actual generated code.`})
31913
+ Code: string;
31914
+
31915
+ @Field({description: `Source material used to generate the code, e.g., a SQL CHECK constraint.`})
31916
+ Source: string;
31917
+
31918
+ @Field({nullable: true})
31919
+ @MaxLength(16)
31920
+ LinkedEntityID?: string;
31921
+
31922
+ @Field({nullable: true})
31923
+ LinkedRecordPrimaryKey?: string;
31924
+
31925
+ @Field({description: `Status of the generated code, e.g., Pending, Approved, or Rejected.`})
31926
+ @MaxLength(40)
31927
+ Status: string;
31928
+
31929
+ @Field({description: `Programming language of the generated code (TypeScript, SQL, HTML, CSS, JavaScript, Python, or Other).`})
31930
+ @MaxLength(100)
31931
+ Language: string;
31932
+
31933
+ @Field()
31934
+ @MaxLength(10)
31935
+ _mj__CreatedAt: Date;
31936
+
31937
+ @Field()
31938
+ @MaxLength(10)
31939
+ _mj__UpdatedAt: Date;
31940
+
31941
+ @Field()
31942
+ @MaxLength(510)
31943
+ Category: string;
31944
+
31945
+ @Field()
31946
+ @MaxLength(100)
31947
+ GeneratedByModel: string;
31948
+
31949
+ @Field({nullable: true})
31950
+ @MaxLength(510)
31951
+ LinkedEntity?: string;
31952
+
31953
+ }
31954
+
31955
+ //****************************************************************************
31956
+ // INPUT TYPE for Generated Codes
31957
+ //****************************************************************************
31958
+ @InputType()
31959
+ export class CreateGeneratedCodeInput {
31960
+ @Field({ nullable: true })
31961
+ GeneratedAt?: Date;
31962
+
31963
+ @Field({ nullable: true })
31964
+ CategoryID?: string;
31965
+
31966
+ @Field({ nullable: true })
31967
+ GeneratedByModelID?: string;
31968
+
31969
+ @Field({ nullable: true })
31970
+ Name?: string;
31971
+
31972
+ @Field({ nullable: true })
31973
+ Description: string | null;
31974
+
31975
+ @Field({ nullable: true })
31976
+ Code?: string;
31977
+
31978
+ @Field({ nullable: true })
31979
+ Source?: string;
31980
+
31981
+ @Field({ nullable: true })
31982
+ LinkedEntityID: string | null;
31983
+
31984
+ @Field({ nullable: true })
31985
+ LinkedRecordPrimaryKey: string | null;
31986
+
31987
+ @Field({ nullable: true })
31988
+ Status?: string;
31989
+
31990
+ @Field({ nullable: true })
31991
+ Language?: string;
31992
+ }
31993
+
31994
+
31995
+ //****************************************************************************
31996
+ // INPUT TYPE for Generated Codes
31997
+ //****************************************************************************
31998
+ @InputType()
31999
+ export class UpdateGeneratedCodeInput {
32000
+ @Field()
32001
+ ID: string;
32002
+
32003
+ @Field({ nullable: true })
32004
+ GeneratedAt?: Date;
32005
+
32006
+ @Field({ nullable: true })
32007
+ CategoryID?: string;
32008
+
32009
+ @Field({ nullable: true })
32010
+ GeneratedByModelID?: string;
32011
+
32012
+ @Field({ nullable: true })
32013
+ Name?: string;
32014
+
32015
+ @Field({ nullable: true })
32016
+ Description?: string | null;
32017
+
32018
+ @Field({ nullable: true })
32019
+ Code?: string;
32020
+
32021
+ @Field({ nullable: true })
32022
+ Source?: string;
32023
+
32024
+ @Field({ nullable: true })
32025
+ LinkedEntityID?: string | null;
32026
+
32027
+ @Field({ nullable: true })
32028
+ LinkedRecordPrimaryKey?: string | null;
32029
+
32030
+ @Field({ nullable: true })
32031
+ Status?: string;
32032
+
32033
+ @Field({ nullable: true })
32034
+ Language?: string;
32035
+
32036
+ @Field(() => [KeyValuePairInput], { nullable: true })
32037
+ OldValues___?: KeyValuePairInput[];
32038
+ }
32039
+
32040
+ //****************************************************************************
32041
+ // RESOLVER for Generated Codes
32042
+ //****************************************************************************
32043
+ @ObjectType()
32044
+ export class RunGeneratedCodeViewResult {
32045
+ @Field(() => [GeneratedCode_])
32046
+ Results: GeneratedCode_[];
32047
+
32048
+ @Field(() => String, {nullable: true})
32049
+ UserViewRunID?: string;
32050
+
32051
+ @Field(() => Int, {nullable: true})
32052
+ RowCount: number;
32053
+
32054
+ @Field(() => Int, {nullable: true})
32055
+ TotalRowCount: number;
32056
+
32057
+ @Field(() => Int, {nullable: true})
32058
+ ExecutionTime: number;
32059
+
32060
+ @Field({nullable: true})
32061
+ ErrorMessage?: string;
32062
+
32063
+ @Field(() => Boolean, {nullable: false})
32064
+ Success: boolean;
32065
+ }
32066
+
32067
+ @Resolver(GeneratedCode_)
32068
+ export class GeneratedCodeResolver extends ResolverBase {
32069
+ @Query(() => RunGeneratedCodeViewResult)
32070
+ async RunGeneratedCodeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32071
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32072
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
32073
+ }
32074
+
32075
+ @Query(() => RunGeneratedCodeViewResult)
32076
+ async RunGeneratedCodeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32077
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32078
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
32079
+ }
32080
+
32081
+ @Query(() => RunGeneratedCodeViewResult)
32082
+ async RunGeneratedCodeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32083
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32084
+ input.EntityName = 'Generated Codes';
32085
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
32086
+ }
32087
+ @Query(() => GeneratedCode_, { nullable: true })
32088
+ async GeneratedCode(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<GeneratedCode_ | null> {
32089
+ this.CheckUserReadPermissions('Generated Codes', userPayload);
32090
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32091
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwGeneratedCodes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('Generated Codes', userPayload, EntityPermissionType.Read, 'AND');
32092
+ const result = this.MapFieldNamesToCodeNames('Generated Codes', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
32093
+ return result;
32094
+ }
32095
+
32096
+ @Mutation(() => GeneratedCode_)
32097
+ async CreateGeneratedCode(
32098
+ @Arg('input', () => CreateGeneratedCodeInput) input: CreateGeneratedCodeInput,
32099
+ @Ctx() { dataSources, userPayload }: AppContext,
32100
+ @PubSub() pubSub: PubSubEngine
32101
+ ) {
32102
+ const dataSource = GetReadWriteDataSource(dataSources);
32103
+ return this.CreateRecord('Generated Codes', input, dataSource, userPayload, pubSub)
32104
+ }
32105
+
32106
+ @Mutation(() => GeneratedCode_)
32107
+ async UpdateGeneratedCode(
32108
+ @Arg('input', () => UpdateGeneratedCodeInput) input: UpdateGeneratedCodeInput,
32109
+ @Ctx() { dataSources, userPayload }: AppContext,
32110
+ @PubSub() pubSub: PubSubEngine
32111
+ ) {
32112
+ const dataSource = GetReadWriteDataSource(dataSources);
32113
+ return this.UpdateRecord('Generated Codes', input, dataSource, userPayload, pubSub);
32114
+ }
32115
+
32116
+ @Mutation(() => GeneratedCode_)
32117
+ async DeleteGeneratedCode(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32118
+ const dataSource = GetReadWriteDataSource(dataSources);
32119
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
32120
+ return this.DeleteRecord('Generated Codes', key, options, dataSource, userPayload, pubSub);
32121
+ }
32122
+
32123
+ }
32124
+
31484
32125
  //****************************************************************************
31485
32126
  // ENTITY CLASS for AI Agent Learning Cycles
31486
32127
  //****************************************************************************
@@ -31655,4 +32296,187 @@ export class AIAgentLearningCycleResolver extends ResolverBase {
31655
32296
  return this.DeleteRecord('AI Agent Learning Cycles', key, options, dataSource, userPayload, pubSub);
31656
32297
  }
31657
32298
 
32299
+ }
32300
+
32301
+ //****************************************************************************
32302
+ // ENTITY CLASS for MJ: Report Versions
32303
+ //****************************************************************************
32304
+ @ObjectType()
32305
+ export class ReportVersion_ {
32306
+ @Field()
32307
+ @MaxLength(16)
32308
+ ID: string;
32309
+
32310
+ @Field()
32311
+ @MaxLength(16)
32312
+ ReportID: string;
32313
+
32314
+ @Field(() => Int, {description: `Report version number, sequential per report starting at 1`})
32315
+ VersionNumber: number;
32316
+
32317
+ @Field({description: `Name of this report version`})
32318
+ @MaxLength(510)
32319
+ Name: string;
32320
+
32321
+ @Field({nullable: true, description: `Description of this report version`})
32322
+ Description?: string;
32323
+
32324
+ @Field({nullable: true, description: `JSON configuration of report structure, layout and logic`})
32325
+ Configuration?: string;
32326
+
32327
+ @Field(() => Boolean, {description: `Indicates if the data context was updated in this version`})
32328
+ DataContextUpdated: boolean;
32329
+
32330
+ @Field()
32331
+ @MaxLength(10)
32332
+ _mj__CreatedAt: Date;
32333
+
32334
+ @Field()
32335
+ @MaxLength(10)
32336
+ _mj__UpdatedAt: Date;
32337
+
32338
+ @Field()
32339
+ @MaxLength(510)
32340
+ Report: string;
32341
+
32342
+ }
32343
+
32344
+ //****************************************************************************
32345
+ // INPUT TYPE for MJ: Report Versions
32346
+ //****************************************************************************
32347
+ @InputType()
32348
+ export class CreateReportVersionInput {
32349
+ @Field({ nullable: true })
32350
+ ReportID?: string;
32351
+
32352
+ @Field(() => Int, { nullable: true })
32353
+ VersionNumber?: number;
32354
+
32355
+ @Field({ nullable: true })
32356
+ Name?: string;
32357
+
32358
+ @Field({ nullable: true })
32359
+ Description: string | null;
32360
+
32361
+ @Field({ nullable: true })
32362
+ Configuration: string | null;
32363
+
32364
+ @Field(() => Boolean, { nullable: true })
32365
+ DataContextUpdated?: boolean;
32366
+ }
32367
+
32368
+
32369
+ //****************************************************************************
32370
+ // INPUT TYPE for MJ: Report Versions
32371
+ //****************************************************************************
32372
+ @InputType()
32373
+ export class UpdateReportVersionInput {
32374
+ @Field()
32375
+ ID: string;
32376
+
32377
+ @Field({ nullable: true })
32378
+ ReportID?: string;
32379
+
32380
+ @Field(() => Int, { nullable: true })
32381
+ VersionNumber?: number;
32382
+
32383
+ @Field({ nullable: true })
32384
+ Name?: string;
32385
+
32386
+ @Field({ nullable: true })
32387
+ Description?: string | null;
32388
+
32389
+ @Field({ nullable: true })
32390
+ Configuration?: string | null;
32391
+
32392
+ @Field(() => Boolean, { nullable: true })
32393
+ DataContextUpdated?: boolean;
32394
+
32395
+ @Field(() => [KeyValuePairInput], { nullable: true })
32396
+ OldValues___?: KeyValuePairInput[];
32397
+ }
32398
+
32399
+ //****************************************************************************
32400
+ // RESOLVER for MJ: Report Versions
32401
+ //****************************************************************************
32402
+ @ObjectType()
32403
+ export class RunReportVersionViewResult {
32404
+ @Field(() => [ReportVersion_])
32405
+ Results: ReportVersion_[];
32406
+
32407
+ @Field(() => String, {nullable: true})
32408
+ UserViewRunID?: string;
32409
+
32410
+ @Field(() => Int, {nullable: true})
32411
+ RowCount: number;
32412
+
32413
+ @Field(() => Int, {nullable: true})
32414
+ TotalRowCount: number;
32415
+
32416
+ @Field(() => Int, {nullable: true})
32417
+ ExecutionTime: number;
32418
+
32419
+ @Field({nullable: true})
32420
+ ErrorMessage?: string;
32421
+
32422
+ @Field(() => Boolean, {nullable: false})
32423
+ Success: boolean;
32424
+ }
32425
+
32426
+ @Resolver(ReportVersion_)
32427
+ export class ReportVersionResolver extends ResolverBase {
32428
+ @Query(() => RunReportVersionViewResult)
32429
+ async RunReportVersionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32430
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32431
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
32432
+ }
32433
+
32434
+ @Query(() => RunReportVersionViewResult)
32435
+ async RunReportVersionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32436
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32437
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
32438
+ }
32439
+
32440
+ @Query(() => RunReportVersionViewResult)
32441
+ async RunReportVersionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32442
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32443
+ input.EntityName = 'MJ: Report Versions';
32444
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
32445
+ }
32446
+ @Query(() => ReportVersion_, { nullable: true })
32447
+ async ReportVersion(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ReportVersion_ | null> {
32448
+ this.CheckUserReadPermissions('MJ: Report Versions', userPayload);
32449
+ const dataSource = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
32450
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwReportVersions] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause('MJ: Report Versions', userPayload, EntityPermissionType.Read, 'AND');
32451
+ const result = this.MapFieldNamesToCodeNames('MJ: Report Versions', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
32452
+ return result;
32453
+ }
32454
+
32455
+ @Mutation(() => ReportVersion_)
32456
+ async CreateReportVersion(
32457
+ @Arg('input', () => CreateReportVersionInput) input: CreateReportVersionInput,
32458
+ @Ctx() { dataSources, userPayload }: AppContext,
32459
+ @PubSub() pubSub: PubSubEngine
32460
+ ) {
32461
+ const dataSource = GetReadWriteDataSource(dataSources);
32462
+ return this.CreateRecord('MJ: Report Versions', input, dataSource, userPayload, pubSub)
32463
+ }
32464
+
32465
+ @Mutation(() => ReportVersion_)
32466
+ async UpdateReportVersion(
32467
+ @Arg('input', () => UpdateReportVersionInput) input: UpdateReportVersionInput,
32468
+ @Ctx() { dataSources, userPayload }: AppContext,
32469
+ @PubSub() pubSub: PubSubEngine
32470
+ ) {
32471
+ const dataSource = GetReadWriteDataSource(dataSources);
32472
+ return this.UpdateRecord('MJ: Report Versions', input, dataSource, userPayload, pubSub);
32473
+ }
32474
+
32475
+ @Mutation(() => ReportVersion_)
32476
+ async DeleteReportVersion(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSources, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
32477
+ const dataSource = GetReadWriteDataSource(dataSources);
32478
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
32479
+ return this.DeleteRecord('MJ: Report Versions', key, options, dataSource, userPayload, pubSub);
32480
+ }
32481
+
31658
32482
  }