@memberjunction/server 3.1.0 → 3.2.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 { ActionAuthorizationEntity, ActionCategoryEntity, ActionContextTypeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionFilterEntity, ActionLibraryEntity, ActionParamEntity, ActionResultCodeEntity, ActionEntity, AIActionEntity, AIAgentActionEntity, AIAgentLearningCycleEntity, AIAgentModelEntity, AIAgentNoteTypeEntity, AIAgentNoteEntity, AIAgentRequestEntity, AIAgentEntity, AIModelActionEntity, AIModelTypeEntity, AIModelEntity, AIPromptCategoryEntity, AIPromptTypeEntity, AIPromptEntity, AIResultCacheEntity, ApplicationEntityEntity, ApplicationSettingEntity, ApplicationEntity, AuditLogTypeEntity, AuditLogEntity, AuthorizationRoleEntity, AuthorizationEntity, CommunicationBaseMessageTypeEntity, CommunicationLogEntity, CommunicationProviderMessageTypeEntity, CommunicationProviderEntity, CommunicationRunEntity, CompanyEntity, CompanyIntegrationRecordMapEntity, CompanyIntegrationRunAPILogEntity, CompanyIntegrationRunDetailEntity, CompanyIntegrationRunEntity, CompanyIntegrationEntity, ContentFileTypeEntity, ContentItemAttributeEntity, ContentItemTagEntity, ContentItemEntity, ContentProcessRunEntity, ContentSourceParamEntity, ContentSourceTypeParamEntity, ContentSourceTypeEntity, ContentSourceEntity, ContentTypeAttributeEntity, ContentTypeEntity, ConversationDetailEntity, ConversationEntity, DashboardCategoryEntity, DashboardEntity, DataContextItemEntity, DataContextEntity, DatasetItemEntity, DatasetEntity, DuplicateRunDetailMatchEntity, DuplicateRunDetailEntity, DuplicateRunEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, EmployeeEntity, EntityEntity, EntityActionFilterEntity, EntityActionInvocationTypeEntity, EntityActionInvocationEntity, EntityActionParamEntity, EntityActionEntity, EntityAIActionEntity, EntityCommunicationFieldEntity, EntityCommunicationMessageTypeEntity, EntityDocumentRunEntity, EntityDocumentSettingEntity, EntityDocumentTypeEntity, EntityDocumentEntity, EntityFieldValueEntity, EntityFieldEntity, EntityPermissionEntity, EntityRecordDocumentEntity, EntityRelationshipDisplayComponentEntity, EntityRelationshipEntity, EntitySettingEntity, ErrorLogEntity, ExplorerNavigationItemEntity, FileCategoryEntity, FileEntityRecordLinkEntity, FileStorageProviderEntity, FileEntity, flyway_schema_historyEntity, GeneratedCodeCategoryEntity, GeneratedCodeEntity, IntegrationURLFormatEntity, IntegrationEntity, LibraryEntity, LibraryItemEntity, ListCategoryEntity, ListDetailEntity, ListEntity, AccessControlRuleEntity, AIAgentArtifactTypeEntity, AIAgentConfigurationEntity, AIAgentDataSourceEntity, AIAgentExampleEntity, AIAgentModalityEntity, AIAgentPermissionEntity, AIAgentPromptEntity, AIAgentRelationshipEntity, AIAgentRunMediaEntity, AIAgentRunStepEntity, AIAgentRunEntity, AIAgentStepPathEntity, AIAgentStepEntity, AIAgentTypeEntity, AIArchitectureEntity, AIConfigurationParamEntity, AIConfigurationEntity, AICredentialBindingEntity, AIModalityEntity, AIModelArchitectureEntity, AIModelCostEntity, AIModelModalityEntity, AIModelPriceTypeEntity, AIModelPriceUnitTypeEntity, AIModelVendorEntity, AIPromptModelEntity, AIPromptRunMediaEntity, AIPromptRunEntity, AIVendorTypeDefinitionEntity, AIVendorTypeEntity, AIVendorEntity, ArtifactPermissionEntity, ArtifactTypeEntity, ArtifactUseEntity, ArtifactVersionAttributeEntity, ArtifactVersionEntity, ArtifactEntity, CollectionArtifactEntity, CollectionPermissionEntity, CollectionEntity, ComponentDependencyEntity, ComponentLibraryEntity, ComponentLibraryLinkEntity, ComponentRegistryEntity, ComponentEntity, ConversationArtifactPermissionEntity, ConversationArtifactVersionEntity, ConversationArtifactEntity, ConversationDetailArtifactEntity, ConversationDetailAttachmentEntity, ConversationDetailRatingEntity, CredentialCategoryEntity, CredentialTypeEntity, CredentialEntity, DashboardCategoryLinkEntity, DashboardCategoryPermissionEntity, DashboardPartTypeEntity, DashboardPermissionEntity, DashboardUserPreferenceEntity, DashboardUserStateEntity, EncryptionAlgorithmEntity, EncryptionKeySourceEntity, EncryptionKeyEntity, EnvironmentEntity, ListInvitationEntity, ListShareEntity, ProjectEntity, PublicLinkEntity, QueryParameterEntity, RecordLinkEntity, ReportUserStateEntity, ReportVersionEntity, ScheduledJobRunEntity, ScheduledJobTypeEntity, ScheduledJobEntity, TaskDependencyEntity, TaskTypeEntity, TaskEntity, TestRubricEntity, TestRunFeedbackEntity, TestRunEntity, TestSuiteRunEntity, TestSuiteTestEntity, TestSuiteEntity, TestTypeEntity, TestEntity, UserSettingEntity, OutputDeliveryTypeEntity, OutputFormatTypeEntity, OutputTriggerTypeEntity, QueryEntity, QueryCategoryEntity, QueryEntityEntity, QueryFieldEntity, QueryPermissionEntity, QueueTaskEntity, QueueTypeEntity, QueueEntity, RecommendationItemEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationEntity, RecordChangeReplayRunEntity, RecordChangeEntity, RecordMergeDeletionLogEntity, RecordMergeLogEntity, ReportCategoryEntity, ReportSnapshotEntity, ReportEntity, ResourceLinkEntity, ResourcePermissionEntity, ResourceTypeEntity, RoleEntity, RowLevelSecurityFilterEntity, ScheduledActionParamEntity, ScheduledActionEntity, SchemaInfoEntity, SkillEntity, TaggedItemEntity, TagEntity, TemplateCategoryEntity, TemplateContentTypeEntity, TemplateContentEntity, TemplateParamEntity, TemplateEntity, UserApplicationEntityEntity, UserApplicationEntity, UserFavoriteEntity, UserNotificationEntity, UserRecordLogEntity, UserRoleEntity, UserViewCategoryEntity, UserViewRunDetailEntity, UserViewRunEntity, UserViewEntity, UserEntity, VectorDatabaseEntity, VectorIndexEntity, VersionInstallationEntity, WorkflowEngineEntity, WorkflowRunEntity, WorkflowEntity, WorkspaceItemEntity, WorkspaceEntity } from '@memberjunction/core-entities';
22
+ import { ActionAuthorizationEntity, ActionCategoryEntity, ActionContextTypeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionFilterEntity, ActionLibraryEntity, ActionParamEntity, ActionResultCodeEntity, ActionEntity, AIActionEntity, AIAgentActionEntity, AIAgentLearningCycleEntity, AIAgentModelEntity, AIAgentNoteTypeEntity, AIAgentNoteEntity, AIAgentRequestEntity, AIAgentEntity, AIModelActionEntity, AIModelTypeEntity, AIModelEntity, AIPromptCategoryEntity, AIPromptTypeEntity, AIPromptEntity, AIResultCacheEntity, ApplicationEntityEntity, ApplicationSettingEntity, ApplicationEntity, AuditLogTypeEntity, AuditLogEntity, AuthorizationRoleEntity, AuthorizationEntity, CommunicationBaseMessageTypeEntity, CommunicationLogEntity, CommunicationProviderMessageTypeEntity, CommunicationProviderEntity, CommunicationRunEntity, CompanyEntity, CompanyIntegrationRecordMapEntity, CompanyIntegrationRunAPILogEntity, CompanyIntegrationRunDetailEntity, CompanyIntegrationRunEntity, CompanyIntegrationEntity, ContentFileTypeEntity, ContentItemAttributeEntity, ContentItemTagEntity, ContentItemEntity, ContentProcessRunEntity, ContentSourceParamEntity, ContentSourceTypeParamEntity, ContentSourceTypeEntity, ContentSourceEntity, ContentTypeAttributeEntity, ContentTypeEntity, ConversationDetailEntity, ConversationEntity, DashboardCategoryEntity, DashboardEntity, DataContextItemEntity, DataContextEntity, DatasetItemEntity, DatasetEntity, DuplicateRunDetailMatchEntity, DuplicateRunDetailEntity, DuplicateRunEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, EmployeeEntity, EntityEntity, EntityActionFilterEntity, EntityActionInvocationTypeEntity, EntityActionInvocationEntity, EntityActionParamEntity, EntityActionEntity, EntityAIActionEntity, EntityCommunicationFieldEntity, EntityCommunicationMessageTypeEntity, EntityDocumentRunEntity, EntityDocumentSettingEntity, EntityDocumentTypeEntity, EntityDocumentEntity, EntityFieldValueEntity, EntityFieldEntity, EntityPermissionEntity, EntityRecordDocumentEntity, EntityRelationshipDisplayComponentEntity, EntityRelationshipEntity, EntitySettingEntity, ErrorLogEntity, ExplorerNavigationItemEntity, FileCategoryEntity, FileEntityRecordLinkEntity, FileStorageProviderEntity, FileEntity, GeneratedCodeCategoryEntity, GeneratedCodeEntity, IntegrationURLFormatEntity, IntegrationEntity, LibraryEntity, LibraryItemEntity, ListCategoryEntity, ListDetailEntity, ListEntity, AccessControlRuleEntity, AIAgentArtifactTypeEntity, AIAgentConfigurationEntity, AIAgentDataSourceEntity, AIAgentExampleEntity, AIAgentModalityEntity, AIAgentPermissionEntity, AIAgentPromptEntity, AIAgentRelationshipEntity, AIAgentRunMediaEntity, AIAgentRunStepEntity, AIAgentRunEntity, AIAgentStepPathEntity, AIAgentStepEntity, AIAgentTypeEntity, AIArchitectureEntity, AIConfigurationParamEntity, AIConfigurationEntity, AICredentialBindingEntity, AIModalityEntity, AIModelArchitectureEntity, AIModelCostEntity, AIModelModalityEntity, AIModelPriceTypeEntity, AIModelPriceUnitTypeEntity, AIModelVendorEntity, AIPromptModelEntity, AIPromptRunMediaEntity, AIPromptRunEntity, AIVendorTypeDefinitionEntity, AIVendorTypeEntity, AIVendorEntity, APIKeyScopeEntity, APIKeyUsageLogEntity, APIKeyEntity, APIScopeEntity, ArtifactPermissionEntity, ArtifactTypeEntity, ArtifactUseEntity, ArtifactVersionAttributeEntity, ArtifactVersionEntity, ArtifactEntity, CollectionArtifactEntity, CollectionPermissionEntity, CollectionEntity, ComponentDependencyEntity, ComponentLibraryEntity, ComponentLibraryLinkEntity, ComponentRegistryEntity, ComponentEntity, ConversationArtifactPermissionEntity, ConversationArtifactVersionEntity, ConversationArtifactEntity, ConversationDetailArtifactEntity, ConversationDetailAttachmentEntity, ConversationDetailRatingEntity, CredentialCategoryEntity, CredentialTypeEntity, CredentialEntity, DashboardCategoryLinkEntity, DashboardCategoryPermissionEntity, DashboardPartTypeEntity, DashboardPermissionEntity, DashboardUserPreferenceEntity, DashboardUserStateEntity, EncryptionAlgorithmEntity, EncryptionKeySourceEntity, EncryptionKeyEntity, EnvironmentEntity, FileStorageAccountEntity, ListInvitationEntity, ListShareEntity, ProjectEntity, PublicLinkEntity, QueryParameterEntity, RecordLinkEntity, ReportUserStateEntity, ReportVersionEntity, ScheduledJobRunEntity, ScheduledJobTypeEntity, ScheduledJobEntity, TaskDependencyEntity, TaskTypeEntity, TaskEntity, TestRubricEntity, TestRunFeedbackEntity, TestRunEntity, TestSuiteRunEntity, TestSuiteTestEntity, TestSuiteEntity, TestTypeEntity, TestEntity, UserNotificationPreferenceEntity, UserNotificationTypeEntity, UserSettingEntity, OutputDeliveryTypeEntity, OutputFormatTypeEntity, OutputTriggerTypeEntity, QueryEntity, QueryCategoryEntity, QueryEntityEntity, QueryFieldEntity, QueryPermissionEntity, QueueTaskEntity, QueueTypeEntity, QueueEntity, RecommendationItemEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationEntity, RecordChangeReplayRunEntity, RecordChangeEntity, RecordMergeDeletionLogEntity, RecordMergeLogEntity, ReportCategoryEntity, ReportSnapshotEntity, ReportEntity, ResourceLinkEntity, ResourcePermissionEntity, ResourceTypeEntity, RoleEntity, RowLevelSecurityFilterEntity, ScheduledActionParamEntity, ScheduledActionEntity, SchemaInfoEntity, SkillEntity, TaggedItemEntity, TagEntity, TemplateCategoryEntity, TemplateContentTypeEntity, TemplateContentEntity, TemplateParamEntity, TemplateEntity, UserApplicationEntityEntity, UserApplicationEntity, UserFavoriteEntity, UserNotificationEntity, UserRecordLogEntity, UserRoleEntity, UserViewCategoryEntity, UserViewRunDetailEntity, UserViewRunEntity, UserViewEntity, UserEntity, VectorDatabaseEntity, VectorIndexEntity, VersionInstallationEntity, WorkflowEngineEntity, WorkflowRunEntity, WorkflowEntity, WorkspaceItemEntity, WorkspaceEntity } from '@memberjunction/core-entities';
23
23
 
24
24
 
25
25
  //****************************************************************************
@@ -23282,9 +23282,18 @@ export class MJFileStorageProvider_ {
23282
23282
  @Field(() => Boolean, {description: `Indicates whether this storage provider supports native full-text search across file names and content. Providers with native search APIs (Google Drive, SharePoint, Dropbox, Box) have this set to true.`})
23283
23283
  SupportsSearch: boolean;
23284
23284
 
23285
+ @Field({nullable: true, description: `Optional JSON configuration for providers that don't use Credential Engine. Used as fallback when CredentialID is not set on FileStorageAccount.`})
23286
+ Configuration?: string;
23287
+
23288
+ @Field(() => Boolean, {description: `If true, this provider requires OAuth authentication. Enterprise OAuth integration via Credential Engine is planned but not yet implemented.`})
23289
+ RequiresOAuth: boolean;
23290
+
23285
23291
  @Field(() => [MJFile_])
23286
23292
  Files_ProviderIDArray: MJFile_[]; // Link to Files
23287
23293
 
23294
+ @Field(() => [MJFileStorageAccount_])
23295
+ MJ_FileStorageAccounts_ProviderIDArray: MJFileStorageAccount_[]; // Link to MJ_FileStorageAccounts
23296
+
23288
23297
  @Field(() => [MJAIConfiguration_])
23289
23298
  MJ_AIConfigurations_DefaultStorageProviderIDArray: MJAIConfiguration_[]; // Link to MJ_AIConfigurations
23290
23299
 
@@ -23321,6 +23330,12 @@ export class CreateMJFileStorageProviderInput {
23321
23330
 
23322
23331
  @Field(() => Boolean, { nullable: true })
23323
23332
  SupportsSearch?: boolean;
23333
+
23334
+ @Field({ nullable: true })
23335
+ Configuration: string | null;
23336
+
23337
+ @Field(() => Boolean, { nullable: true })
23338
+ RequiresOAuth?: boolean;
23324
23339
  }
23325
23340
 
23326
23341
 
@@ -23353,6 +23368,12 @@ export class UpdateMJFileStorageProviderInput {
23353
23368
  @Field(() => Boolean, { nullable: true })
23354
23369
  SupportsSearch?: boolean;
23355
23370
 
23371
+ @Field({ nullable: true })
23372
+ Configuration?: string | null;
23373
+
23374
+ @Field(() => Boolean, { nullable: true })
23375
+ RequiresOAuth?: boolean;
23376
+
23356
23377
  @Field(() => [KeyValuePairInput], { nullable: true })
23357
23378
  OldValues___?: KeyValuePairInput[];
23358
23379
  }
@@ -23426,6 +23447,17 @@ export class MJFileStorageProviderResolver extends ResolverBase {
23426
23447
  return result;
23427
23448
  }
23428
23449
 
23450
+ @FieldResolver(() => [MJFileStorageAccount_])
23451
+ async MJ_FileStorageAccounts_ProviderIDArray(@Root() mjfilestorageprovider_: MJFileStorageProvider_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
23452
+ this.CheckUserReadPermissions('MJ: File Storage Accounts', userPayload);
23453
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
23454
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
23455
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwFileStorageAccounts] WHERE [ProviderID]='${mjfilestorageprovider_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: File Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
23456
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
23457
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: File Storage Accounts', rows, this.GetUserFromPayload(userPayload));
23458
+ return result;
23459
+ }
23460
+
23429
23461
  @FieldResolver(() => [MJAIConfiguration_])
23430
23462
  async MJ_AIConfigurations_DefaultStorageProviderIDArray(@Root() mjfilestorageprovider_: MJFileStorageProvider_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
23431
23463
  this.CheckUserReadPermissions('MJ: AI Configurations', userPayload);
@@ -23738,220 +23770,6 @@ export class MJFileResolver extends ResolverBase {
23738
23770
 
23739
23771
  }
23740
23772
 
23741
- //****************************************************************************
23742
- // ENTITY CLASS for Flyway _schema _histories
23743
- //****************************************************************************
23744
- @ObjectType()
23745
- export class MJflywayschemahistory_ {
23746
- @Field(() => Int)
23747
- installed_rank: number;
23748
-
23749
- @Field({nullable: true})
23750
- @MaxLength(100)
23751
- version?: string;
23752
-
23753
- @Field({nullable: true})
23754
- @MaxLength(400)
23755
- description?: string;
23756
-
23757
- @Field()
23758
- @MaxLength(40)
23759
- type: string;
23760
-
23761
- @Field()
23762
- @MaxLength(2000)
23763
- script: string;
23764
-
23765
- @Field(() => Int, {nullable: true})
23766
- checksum?: number;
23767
-
23768
- @Field()
23769
- @MaxLength(200)
23770
- installed_by: string;
23771
-
23772
- @Field()
23773
- @MaxLength(8)
23774
- installed_on: Date;
23775
-
23776
- @Field(() => Int)
23777
- execution_time: number;
23778
-
23779
- @Field(() => Boolean)
23780
- success: boolean;
23781
-
23782
- @Field()
23783
- @MaxLength(10)
23784
- _mj__CreatedAt: Date;
23785
-
23786
- @Field()
23787
- @MaxLength(10)
23788
- _mj__UpdatedAt: Date;
23789
-
23790
- }
23791
-
23792
- //****************************************************************************
23793
- // INPUT TYPE for Flyway _schema _histories
23794
- //****************************************************************************
23795
- @InputType()
23796
- export class CreateMJflywayschemahistoryInput {
23797
- @Field(() => Int, { nullable: true })
23798
- installed_rank?: number;
23799
-
23800
- @Field({ nullable: true })
23801
- version: string | null;
23802
-
23803
- @Field({ nullable: true })
23804
- description: string | null;
23805
-
23806
- @Field({ nullable: true })
23807
- type?: string;
23808
-
23809
- @Field({ nullable: true })
23810
- script?: string;
23811
-
23812
- @Field(() => Int, { nullable: true })
23813
- checksum: number | null;
23814
-
23815
- @Field({ nullable: true })
23816
- installed_by?: string;
23817
-
23818
- @Field({ nullable: true })
23819
- installed_on?: Date;
23820
-
23821
- @Field(() => Int, { nullable: true })
23822
- execution_time?: number;
23823
-
23824
- @Field(() => Boolean, { nullable: true })
23825
- success?: boolean;
23826
- }
23827
-
23828
-
23829
- //****************************************************************************
23830
- // INPUT TYPE for Flyway _schema _histories
23831
- //****************************************************************************
23832
- @InputType()
23833
- export class UpdateMJflywayschemahistoryInput {
23834
- @Field(() => Int)
23835
- installed_rank: number;
23836
-
23837
- @Field({ nullable: true })
23838
- version?: string | null;
23839
-
23840
- @Field({ nullable: true })
23841
- description?: string | null;
23842
-
23843
- @Field({ nullable: true })
23844
- type?: string;
23845
-
23846
- @Field({ nullable: true })
23847
- script?: string;
23848
-
23849
- @Field(() => Int, { nullable: true })
23850
- checksum?: number | null;
23851
-
23852
- @Field({ nullable: true })
23853
- installed_by?: string;
23854
-
23855
- @Field({ nullable: true })
23856
- installed_on?: Date;
23857
-
23858
- @Field(() => Int, { nullable: true })
23859
- execution_time?: number;
23860
-
23861
- @Field(() => Boolean, { nullable: true })
23862
- success?: boolean;
23863
-
23864
- @Field(() => [KeyValuePairInput], { nullable: true })
23865
- OldValues___?: KeyValuePairInput[];
23866
- }
23867
-
23868
- //****************************************************************************
23869
- // RESOLVER for Flyway _schema _histories
23870
- //****************************************************************************
23871
- @ObjectType()
23872
- export class RunMJflywayschemahistoryViewResult {
23873
- @Field(() => [MJflywayschemahistory_])
23874
- Results: MJflywayschemahistory_[];
23875
-
23876
- @Field(() => String, {nullable: true})
23877
- UserViewRunID?: string;
23878
-
23879
- @Field(() => Int, {nullable: true})
23880
- RowCount: number;
23881
-
23882
- @Field(() => Int, {nullable: true})
23883
- TotalRowCount: number;
23884
-
23885
- @Field(() => Int, {nullable: true})
23886
- ExecutionTime: number;
23887
-
23888
- @Field({nullable: true})
23889
- ErrorMessage?: string;
23890
-
23891
- @Field(() => Boolean, {nullable: false})
23892
- Success: boolean;
23893
- }
23894
-
23895
- @Resolver(MJflywayschemahistory_)
23896
- export class MJflywayschemahistoryResolver extends ResolverBase {
23897
- @Query(() => RunMJflywayschemahistoryViewResult)
23898
- async RunMJflywayschemahistoryViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
23899
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
23900
- return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
23901
- }
23902
-
23903
- @Query(() => RunMJflywayschemahistoryViewResult)
23904
- async RunMJflywayschemahistoryViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
23905
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
23906
- return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
23907
- }
23908
-
23909
- @Query(() => RunMJflywayschemahistoryViewResult)
23910
- async RunMJflywayschemahistoryDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
23911
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
23912
- input.EntityName = 'Flyway _schema _histories';
23913
- return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
23914
- }
23915
- @Query(() => MJflywayschemahistory_, { nullable: true })
23916
- async MJflywayschemahistory(@Arg('installed_rank', () => Int) installed_rank: number, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJflywayschemahistory_ | null> {
23917
- this.CheckUserReadPermissions('Flyway _schema _histories', userPayload);
23918
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
23919
- const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
23920
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwFlyway_schema_histories] WHERE [installed_rank]=${installed_rank} ` + this.getRowLevelSecurityWhereClause(provider, 'Flyway _schema _histories', userPayload, EntityPermissionType.Read, 'AND');
23921
- const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
23922
- const result = await this.MapFieldNamesToCodeNames('Flyway _schema _histories', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
23923
- return result;
23924
- }
23925
-
23926
- @Mutation(() => MJflywayschemahistory_)
23927
- async CreateMJflywayschemahistory(
23928
- @Arg('input', () => CreateMJflywayschemahistoryInput) input: CreateMJflywayschemahistoryInput,
23929
- @Ctx() { providers, userPayload }: AppContext,
23930
- @PubSub() pubSub: PubSubEngine
23931
- ) {
23932
- const provider = GetReadWriteProvider(providers);
23933
- return this.CreateRecord('Flyway _schema _histories', input, provider, userPayload, pubSub)
23934
- }
23935
-
23936
- @Mutation(() => MJflywayschemahistory_)
23937
- async UpdateMJflywayschemahistory(
23938
- @Arg('input', () => UpdateMJflywayschemahistoryInput) input: UpdateMJflywayschemahistoryInput,
23939
- @Ctx() { providers, userPayload }: AppContext,
23940
- @PubSub() pubSub: PubSubEngine
23941
- ) {
23942
- const provider = GetReadWriteProvider(providers);
23943
- return this.UpdateRecord('Flyway _schema _histories', input, provider, userPayload, pubSub);
23944
- }
23945
-
23946
- @Mutation(() => MJflywayschemahistory_)
23947
- async DeleteMJflywayschemahistory(@Arg('installed_rank', () => Int) installed_rank: number, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
23948
- const provider = GetReadWriteProvider(providers);
23949
- const key = new CompositeKey([{FieldName: 'installed_rank', Value: installed_rank}]);
23950
- return this.DeleteRecord('Flyway _schema _histories', key, options, provider, userPayload, pubSub);
23951
- }
23952
-
23953
- }
23954
-
23955
23773
  //****************************************************************************
23956
23774
  // ENTITY CLASS for Generated Code Categories
23957
23775
  //****************************************************************************
@@ -34698,6 +34516,788 @@ export class MJAIVendorResolver extends ResolverBase {
34698
34516
 
34699
34517
  }
34700
34518
 
34519
+ //****************************************************************************
34520
+ // ENTITY CLASS for MJ: API Key Scopes
34521
+ //****************************************************************************
34522
+ @ObjectType({ description: `Junction table linking API keys to their assigned permission scopes. Each key can have multiple scopes, and scopes can be shared across multiple keys.` })
34523
+ export class MJAPIKeyScope_ {
34524
+ @Field()
34525
+ @MaxLength(16)
34526
+ ID: string;
34527
+
34528
+ @Field()
34529
+ @MaxLength(16)
34530
+ APIKeyID: string;
34531
+
34532
+ @Field()
34533
+ @MaxLength(16)
34534
+ ScopeID: string;
34535
+
34536
+ @Field()
34537
+ @MaxLength(10)
34538
+ _mj__CreatedAt: Date;
34539
+
34540
+ @Field()
34541
+ @MaxLength(10)
34542
+ _mj__UpdatedAt: Date;
34543
+
34544
+ @Field()
34545
+ @MaxLength(510)
34546
+ APIKey: string;
34547
+
34548
+ @Field()
34549
+ @MaxLength(200)
34550
+ Scope: string;
34551
+
34552
+ }
34553
+
34554
+ //****************************************************************************
34555
+ // INPUT TYPE for MJ: API Key Scopes
34556
+ //****************************************************************************
34557
+ @InputType()
34558
+ export class CreateMJAPIKeyScopeInput {
34559
+ @Field({ nullable: true })
34560
+ ID?: string;
34561
+
34562
+ @Field({ nullable: true })
34563
+ APIKeyID?: string;
34564
+
34565
+ @Field({ nullable: true })
34566
+ ScopeID?: string;
34567
+ }
34568
+
34569
+
34570
+ //****************************************************************************
34571
+ // INPUT TYPE for MJ: API Key Scopes
34572
+ //****************************************************************************
34573
+ @InputType()
34574
+ export class UpdateMJAPIKeyScopeInput {
34575
+ @Field()
34576
+ ID: string;
34577
+
34578
+ @Field({ nullable: true })
34579
+ APIKeyID?: string;
34580
+
34581
+ @Field({ nullable: true })
34582
+ ScopeID?: string;
34583
+
34584
+ @Field(() => [KeyValuePairInput], { nullable: true })
34585
+ OldValues___?: KeyValuePairInput[];
34586
+ }
34587
+
34588
+ //****************************************************************************
34589
+ // RESOLVER for MJ: API Key Scopes
34590
+ //****************************************************************************
34591
+ @ObjectType()
34592
+ export class RunMJAPIKeyScopeViewResult {
34593
+ @Field(() => [MJAPIKeyScope_])
34594
+ Results: MJAPIKeyScope_[];
34595
+
34596
+ @Field(() => String, {nullable: true})
34597
+ UserViewRunID?: string;
34598
+
34599
+ @Field(() => Int, {nullable: true})
34600
+ RowCount: number;
34601
+
34602
+ @Field(() => Int, {nullable: true})
34603
+ TotalRowCount: number;
34604
+
34605
+ @Field(() => Int, {nullable: true})
34606
+ ExecutionTime: number;
34607
+
34608
+ @Field({nullable: true})
34609
+ ErrorMessage?: string;
34610
+
34611
+ @Field(() => Boolean, {nullable: false})
34612
+ Success: boolean;
34613
+ }
34614
+
34615
+ @Resolver(MJAPIKeyScope_)
34616
+ export class MJAPIKeyScopeResolver extends ResolverBase {
34617
+ @Query(() => RunMJAPIKeyScopeViewResult)
34618
+ async RunMJAPIKeyScopeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34619
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34620
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
34621
+ }
34622
+
34623
+ @Query(() => RunMJAPIKeyScopeViewResult)
34624
+ async RunMJAPIKeyScopeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34625
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34626
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
34627
+ }
34628
+
34629
+ @Query(() => RunMJAPIKeyScopeViewResult)
34630
+ async RunMJAPIKeyScopeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34631
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34632
+ input.EntityName = 'MJ: API Key Scopes';
34633
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
34634
+ }
34635
+ @Query(() => MJAPIKeyScope_, { nullable: true })
34636
+ async MJAPIKeyScope(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIKeyScope_ | null> {
34637
+ this.CheckUserReadPermissions('MJ: API Key Scopes', userPayload);
34638
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34639
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
34640
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyScopes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Scopes', userPayload, EntityPermissionType.Read, 'AND');
34641
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
34642
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Key Scopes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
34643
+ return result;
34644
+ }
34645
+
34646
+ @Mutation(() => MJAPIKeyScope_)
34647
+ async CreateMJAPIKeyScope(
34648
+ @Arg('input', () => CreateMJAPIKeyScopeInput) input: CreateMJAPIKeyScopeInput,
34649
+ @Ctx() { providers, userPayload }: AppContext,
34650
+ @PubSub() pubSub: PubSubEngine
34651
+ ) {
34652
+ const provider = GetReadWriteProvider(providers);
34653
+ return this.CreateRecord('MJ: API Key Scopes', input, provider, userPayload, pubSub)
34654
+ }
34655
+
34656
+ @Mutation(() => MJAPIKeyScope_)
34657
+ async UpdateMJAPIKeyScope(
34658
+ @Arg('input', () => UpdateMJAPIKeyScopeInput) input: UpdateMJAPIKeyScopeInput,
34659
+ @Ctx() { providers, userPayload }: AppContext,
34660
+ @PubSub() pubSub: PubSubEngine
34661
+ ) {
34662
+ const provider = GetReadWriteProvider(providers);
34663
+ return this.UpdateRecord('MJ: API Key Scopes', input, provider, userPayload, pubSub);
34664
+ }
34665
+
34666
+ @Mutation(() => MJAPIKeyScope_)
34667
+ async DeleteMJAPIKeyScope(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34668
+ const provider = GetReadWriteProvider(providers);
34669
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
34670
+ return this.DeleteRecord('MJ: API Key Scopes', key, options, provider, userPayload, pubSub);
34671
+ }
34672
+
34673
+ }
34674
+
34675
+ //****************************************************************************
34676
+ // ENTITY CLASS for MJ: API Key Usage Logs
34677
+ //****************************************************************************
34678
+ @ObjectType({ description: `Audit log tracking all API key usage for analytics, debugging, and security monitoring. Records each request including endpoint, response status, timing, and client information.` })
34679
+ export class MJAPIKeyUsageLog_ {
34680
+ @Field()
34681
+ @MaxLength(16)
34682
+ ID: string;
34683
+
34684
+ @Field()
34685
+ @MaxLength(16)
34686
+ APIKeyID: string;
34687
+
34688
+ @Field({description: `The API endpoint path that was accessed (e.g., /mcp, /graphql, /api/v1/entities).`})
34689
+ @MaxLength(1000)
34690
+ Endpoint: string;
34691
+
34692
+ @Field({nullable: true, description: `The specific operation performed, such as the GraphQL operation name or MCP tool invoked (e.g., Get_Users_Record, Run_Agent).`})
34693
+ @MaxLength(510)
34694
+ Operation?: string;
34695
+
34696
+ @Field({description: `HTTP method used for the request (GET, POST, PUT, DELETE, etc.).`})
34697
+ @MaxLength(20)
34698
+ Method: string;
34699
+
34700
+ @Field(() => Int, {description: `HTTP response status code returned to the client (e.g., 200 for success, 401 for unauthorized, 500 for server error).`})
34701
+ StatusCode: number;
34702
+
34703
+ @Field(() => Int, {nullable: true, description: `Total time in milliseconds to process the request and return a response. Useful for performance monitoring.`})
34704
+ ResponseTimeMs?: number;
34705
+
34706
+ @Field({nullable: true, description: `Client IP address that made the request. Supports both IPv4 and IPv6 addresses (up to 45 characters).`})
34707
+ @MaxLength(90)
34708
+ IPAddress?: string;
34709
+
34710
+ @Field({nullable: true, description: `User-Agent header from the HTTP request, identifying the client application or library making the API call.`})
34711
+ @MaxLength(1000)
34712
+ UserAgent?: string;
34713
+
34714
+ @Field()
34715
+ @MaxLength(10)
34716
+ _mj__CreatedAt: Date;
34717
+
34718
+ @Field()
34719
+ @MaxLength(10)
34720
+ _mj__UpdatedAt: Date;
34721
+
34722
+ @Field()
34723
+ @MaxLength(510)
34724
+ APIKey: string;
34725
+
34726
+ }
34727
+
34728
+ //****************************************************************************
34729
+ // INPUT TYPE for MJ: API Key Usage Logs
34730
+ //****************************************************************************
34731
+ @InputType()
34732
+ export class CreateMJAPIKeyUsageLogInput {
34733
+ @Field({ nullable: true })
34734
+ ID?: string;
34735
+
34736
+ @Field({ nullable: true })
34737
+ APIKeyID?: string;
34738
+
34739
+ @Field({ nullable: true })
34740
+ Endpoint?: string;
34741
+
34742
+ @Field({ nullable: true })
34743
+ Operation: string | null;
34744
+
34745
+ @Field({ nullable: true })
34746
+ Method?: string;
34747
+
34748
+ @Field(() => Int, { nullable: true })
34749
+ StatusCode?: number;
34750
+
34751
+ @Field(() => Int, { nullable: true })
34752
+ ResponseTimeMs: number | null;
34753
+
34754
+ @Field({ nullable: true })
34755
+ IPAddress: string | null;
34756
+
34757
+ @Field({ nullable: true })
34758
+ UserAgent: string | null;
34759
+ }
34760
+
34761
+
34762
+ //****************************************************************************
34763
+ // INPUT TYPE for MJ: API Key Usage Logs
34764
+ //****************************************************************************
34765
+ @InputType()
34766
+ export class UpdateMJAPIKeyUsageLogInput {
34767
+ @Field()
34768
+ ID: string;
34769
+
34770
+ @Field({ nullable: true })
34771
+ APIKeyID?: string;
34772
+
34773
+ @Field({ nullable: true })
34774
+ Endpoint?: string;
34775
+
34776
+ @Field({ nullable: true })
34777
+ Operation?: string | null;
34778
+
34779
+ @Field({ nullable: true })
34780
+ Method?: string;
34781
+
34782
+ @Field(() => Int, { nullable: true })
34783
+ StatusCode?: number;
34784
+
34785
+ @Field(() => Int, { nullable: true })
34786
+ ResponseTimeMs?: number | null;
34787
+
34788
+ @Field({ nullable: true })
34789
+ IPAddress?: string | null;
34790
+
34791
+ @Field({ nullable: true })
34792
+ UserAgent?: string | null;
34793
+
34794
+ @Field(() => [KeyValuePairInput], { nullable: true })
34795
+ OldValues___?: KeyValuePairInput[];
34796
+ }
34797
+
34798
+ //****************************************************************************
34799
+ // RESOLVER for MJ: API Key Usage Logs
34800
+ //****************************************************************************
34801
+ @ObjectType()
34802
+ export class RunMJAPIKeyUsageLogViewResult {
34803
+ @Field(() => [MJAPIKeyUsageLog_])
34804
+ Results: MJAPIKeyUsageLog_[];
34805
+
34806
+ @Field(() => String, {nullable: true})
34807
+ UserViewRunID?: string;
34808
+
34809
+ @Field(() => Int, {nullable: true})
34810
+ RowCount: number;
34811
+
34812
+ @Field(() => Int, {nullable: true})
34813
+ TotalRowCount: number;
34814
+
34815
+ @Field(() => Int, {nullable: true})
34816
+ ExecutionTime: number;
34817
+
34818
+ @Field({nullable: true})
34819
+ ErrorMessage?: string;
34820
+
34821
+ @Field(() => Boolean, {nullable: false})
34822
+ Success: boolean;
34823
+ }
34824
+
34825
+ @Resolver(MJAPIKeyUsageLog_)
34826
+ export class MJAPIKeyUsageLogResolver extends ResolverBase {
34827
+ @Query(() => RunMJAPIKeyUsageLogViewResult)
34828
+ async RunMJAPIKeyUsageLogViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34829
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34830
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
34831
+ }
34832
+
34833
+ @Query(() => RunMJAPIKeyUsageLogViewResult)
34834
+ async RunMJAPIKeyUsageLogViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34835
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34836
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
34837
+ }
34838
+
34839
+ @Query(() => RunMJAPIKeyUsageLogViewResult)
34840
+ async RunMJAPIKeyUsageLogDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34841
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34842
+ input.EntityName = 'MJ: API Key Usage Logs';
34843
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
34844
+ }
34845
+ @Query(() => MJAPIKeyUsageLog_, { nullable: true })
34846
+ async MJAPIKeyUsageLog(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIKeyUsageLog_ | null> {
34847
+ this.CheckUserReadPermissions('MJ: API Key Usage Logs', userPayload);
34848
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34849
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
34850
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyUsageLogs] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Usage Logs', userPayload, EntityPermissionType.Read, 'AND');
34851
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
34852
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Key Usage Logs', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
34853
+ return result;
34854
+ }
34855
+
34856
+ @Mutation(() => MJAPIKeyUsageLog_)
34857
+ async CreateMJAPIKeyUsageLog(
34858
+ @Arg('input', () => CreateMJAPIKeyUsageLogInput) input: CreateMJAPIKeyUsageLogInput,
34859
+ @Ctx() { providers, userPayload }: AppContext,
34860
+ @PubSub() pubSub: PubSubEngine
34861
+ ) {
34862
+ const provider = GetReadWriteProvider(providers);
34863
+ return this.CreateRecord('MJ: API Key Usage Logs', input, provider, userPayload, pubSub)
34864
+ }
34865
+
34866
+ @Mutation(() => MJAPIKeyUsageLog_)
34867
+ async UpdateMJAPIKeyUsageLog(
34868
+ @Arg('input', () => UpdateMJAPIKeyUsageLogInput) input: UpdateMJAPIKeyUsageLogInput,
34869
+ @Ctx() { providers, userPayload }: AppContext,
34870
+ @PubSub() pubSub: PubSubEngine
34871
+ ) {
34872
+ const provider = GetReadWriteProvider(providers);
34873
+ return this.UpdateRecord('MJ: API Key Usage Logs', input, provider, userPayload, pubSub);
34874
+ }
34875
+
34876
+ @Mutation(() => MJAPIKeyUsageLog_)
34877
+ async DeleteMJAPIKeyUsageLog(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34878
+ const provider = GetReadWriteProvider(providers);
34879
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
34880
+ return this.DeleteRecord('MJ: API Key Usage Logs', key, options, provider, userPayload, pubSub);
34881
+ }
34882
+
34883
+ }
34884
+
34885
+ //****************************************************************************
34886
+ // ENTITY CLASS for MJ: API Keys
34887
+ //****************************************************************************
34888
+ @ObjectType({ description: `Stores API keys for programmatic access to MemberJunction services. Keys are stored as SHA-256 hashes for security. Each key is associated with a user context and can have multiple permission scopes assigned.` })
34889
+ export class MJAPIKey_ {
34890
+ @Field()
34891
+ @MaxLength(16)
34892
+ ID: string;
34893
+
34894
+ @Field({description: `SHA-256 hash of the raw API key (64 hexadecimal characters). The raw key is only shown once at creation time and cannot be recovered.`})
34895
+ @MaxLength(128)
34896
+ Hash: string;
34897
+
34898
+ @Field()
34899
+ @MaxLength(16)
34900
+ UserID: string;
34901
+
34902
+ @Field({description: `User-friendly name for identifying the key purpose (e.g., Cowork Integration, CI/CD Pipeline, Mobile App).`})
34903
+ @MaxLength(510)
34904
+ Label: string;
34905
+
34906
+ @Field({nullable: true, description: `Optional detailed description of the key's intended use, integration details, or other notes.`})
34907
+ @MaxLength(2000)
34908
+ Description?: string;
34909
+
34910
+ @Field({description: `Current lifecycle status of the key. Active keys can be used for authentication; Revoked keys are permanently disabled.`})
34911
+ @MaxLength(40)
34912
+ Status: string;
34913
+
34914
+ @Field({nullable: true, description: `Optional expiration timestamp. Keys with NULL expiration never expire. Expired keys are rejected during authentication.`})
34915
+ @MaxLength(10)
34916
+ ExpiresAt?: Date;
34917
+
34918
+ @Field({nullable: true, description: `Timestamp of the most recent successful authentication using this key. Updated on each valid API request.`})
34919
+ @MaxLength(10)
34920
+ LastUsedAt?: Date;
34921
+
34922
+ @Field()
34923
+ @MaxLength(16)
34924
+ CreatedByUserID: string;
34925
+
34926
+ @Field()
34927
+ @MaxLength(10)
34928
+ _mj__CreatedAt: Date;
34929
+
34930
+ @Field()
34931
+ @MaxLength(10)
34932
+ _mj__UpdatedAt: Date;
34933
+
34934
+ @Field()
34935
+ @MaxLength(200)
34936
+ User: string;
34937
+
34938
+ @Field()
34939
+ @MaxLength(200)
34940
+ CreatedByUser: string;
34941
+
34942
+ @Field(() => [MJAPIKeyUsageLog_])
34943
+ MJ_APIKeyUsageLogs_APIKeyIDArray: MJAPIKeyUsageLog_[]; // Link to MJ_APIKeyUsageLogs
34944
+
34945
+ @Field(() => [MJAPIKeyScope_])
34946
+ MJ_APIKeyScopes_APIKeyIDArray: MJAPIKeyScope_[]; // Link to MJ_APIKeyScopes
34947
+
34948
+ }
34949
+
34950
+ //****************************************************************************
34951
+ // INPUT TYPE for MJ: API Keys
34952
+ //****************************************************************************
34953
+ @InputType()
34954
+ export class CreateMJAPIKeyInput {
34955
+ @Field({ nullable: true })
34956
+ ID?: string;
34957
+
34958
+ @Field({ nullable: true })
34959
+ Hash?: string;
34960
+
34961
+ @Field({ nullable: true })
34962
+ UserID?: string;
34963
+
34964
+ @Field({ nullable: true })
34965
+ Label?: string;
34966
+
34967
+ @Field({ nullable: true })
34968
+ Description: string | null;
34969
+
34970
+ @Field({ nullable: true })
34971
+ Status?: string;
34972
+
34973
+ @Field({ nullable: true })
34974
+ ExpiresAt: Date | null;
34975
+
34976
+ @Field({ nullable: true })
34977
+ LastUsedAt: Date | null;
34978
+
34979
+ @Field({ nullable: true })
34980
+ CreatedByUserID?: string;
34981
+ }
34982
+
34983
+
34984
+ //****************************************************************************
34985
+ // INPUT TYPE for MJ: API Keys
34986
+ //****************************************************************************
34987
+ @InputType()
34988
+ export class UpdateMJAPIKeyInput {
34989
+ @Field()
34990
+ ID: string;
34991
+
34992
+ @Field({ nullable: true })
34993
+ Hash?: string;
34994
+
34995
+ @Field({ nullable: true })
34996
+ UserID?: string;
34997
+
34998
+ @Field({ nullable: true })
34999
+ Label?: string;
35000
+
35001
+ @Field({ nullable: true })
35002
+ Description?: string | null;
35003
+
35004
+ @Field({ nullable: true })
35005
+ Status?: string;
35006
+
35007
+ @Field({ nullable: true })
35008
+ ExpiresAt?: Date | null;
35009
+
35010
+ @Field({ nullable: true })
35011
+ LastUsedAt?: Date | null;
35012
+
35013
+ @Field({ nullable: true })
35014
+ CreatedByUserID?: string;
35015
+
35016
+ @Field(() => [KeyValuePairInput], { nullable: true })
35017
+ OldValues___?: KeyValuePairInput[];
35018
+ }
35019
+
35020
+ //****************************************************************************
35021
+ // RESOLVER for MJ: API Keys
35022
+ //****************************************************************************
35023
+ @ObjectType()
35024
+ export class RunMJAPIKeyViewResult {
35025
+ @Field(() => [MJAPIKey_])
35026
+ Results: MJAPIKey_[];
35027
+
35028
+ @Field(() => String, {nullable: true})
35029
+ UserViewRunID?: string;
35030
+
35031
+ @Field(() => Int, {nullable: true})
35032
+ RowCount: number;
35033
+
35034
+ @Field(() => Int, {nullable: true})
35035
+ TotalRowCount: number;
35036
+
35037
+ @Field(() => Int, {nullable: true})
35038
+ ExecutionTime: number;
35039
+
35040
+ @Field({nullable: true})
35041
+ ErrorMessage?: string;
35042
+
35043
+ @Field(() => Boolean, {nullable: false})
35044
+ Success: boolean;
35045
+ }
35046
+
35047
+ @Resolver(MJAPIKey_)
35048
+ export class MJAPIKeyResolver extends ResolverBase {
35049
+ @Query(() => RunMJAPIKeyViewResult)
35050
+ async RunMJAPIKeyViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35051
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35052
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
35053
+ }
35054
+
35055
+ @Query(() => RunMJAPIKeyViewResult)
35056
+ async RunMJAPIKeyViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35057
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35058
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
35059
+ }
35060
+
35061
+ @Query(() => RunMJAPIKeyViewResult)
35062
+ async RunMJAPIKeyDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35063
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35064
+ input.EntityName = 'MJ: API Keys';
35065
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
35066
+ }
35067
+ @Query(() => MJAPIKey_, { nullable: true })
35068
+ async MJAPIKey(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIKey_ | null> {
35069
+ this.CheckUserReadPermissions('MJ: API Keys', userPayload);
35070
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35071
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35072
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeys] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Keys', userPayload, EntityPermissionType.Read, 'AND');
35073
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35074
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Keys', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35075
+ return result;
35076
+ }
35077
+
35078
+ @FieldResolver(() => [MJAPIKeyUsageLog_])
35079
+ async MJ_APIKeyUsageLogs_APIKeyIDArray(@Root() mjapikey_: MJAPIKey_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35080
+ this.CheckUserReadPermissions('MJ: API Key Usage Logs', userPayload);
35081
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35082
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35083
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyUsageLogs] WHERE [APIKeyID]='${mjapikey_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Usage Logs', userPayload, EntityPermissionType.Read, 'AND');
35084
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35085
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Usage Logs', rows, this.GetUserFromPayload(userPayload));
35086
+ return result;
35087
+ }
35088
+
35089
+ @FieldResolver(() => [MJAPIKeyScope_])
35090
+ async MJ_APIKeyScopes_APIKeyIDArray(@Root() mjapikey_: MJAPIKey_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35091
+ this.CheckUserReadPermissions('MJ: API Key Scopes', userPayload);
35092
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35093
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35094
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyScopes] WHERE [APIKeyID]='${mjapikey_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Scopes', userPayload, EntityPermissionType.Read, 'AND');
35095
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35096
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Scopes', rows, this.GetUserFromPayload(userPayload));
35097
+ return result;
35098
+ }
35099
+
35100
+ @Mutation(() => MJAPIKey_)
35101
+ async CreateMJAPIKey(
35102
+ @Arg('input', () => CreateMJAPIKeyInput) input: CreateMJAPIKeyInput,
35103
+ @Ctx() { providers, userPayload }: AppContext,
35104
+ @PubSub() pubSub: PubSubEngine
35105
+ ) {
35106
+ const provider = GetReadWriteProvider(providers);
35107
+ return this.CreateRecord('MJ: API Keys', input, provider, userPayload, pubSub)
35108
+ }
35109
+
35110
+ @Mutation(() => MJAPIKey_)
35111
+ async UpdateMJAPIKey(
35112
+ @Arg('input', () => UpdateMJAPIKeyInput) input: UpdateMJAPIKeyInput,
35113
+ @Ctx() { providers, userPayload }: AppContext,
35114
+ @PubSub() pubSub: PubSubEngine
35115
+ ) {
35116
+ const provider = GetReadWriteProvider(providers);
35117
+ return this.UpdateRecord('MJ: API Keys', input, provider, userPayload, pubSub);
35118
+ }
35119
+
35120
+ @Mutation(() => MJAPIKey_)
35121
+ async DeleteMJAPIKey(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35122
+ const provider = GetReadWriteProvider(providers);
35123
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
35124
+ return this.DeleteRecord('MJ: API Keys', key, options, provider, userPayload, pubSub);
35125
+ }
35126
+
35127
+ }
35128
+
35129
+ //****************************************************************************
35130
+ // ENTITY CLASS for MJ: API Scopes
35131
+ //****************************************************************************
35132
+ @ObjectType({ description: `Defines reusable permission scopes that can be assigned to API keys. Scopes follow a hierarchical naming convention (e.g., entities:read, agents:execute, admin:*) and are grouped by category for organizational purposes.` })
35133
+ export class MJAPIScope_ {
35134
+ @Field()
35135
+ @MaxLength(16)
35136
+ ID: string;
35137
+
35138
+ @Field({description: `Unique scope identifier following the pattern category:permission (e.g., entities:read, agents:execute, admin:*). Supports wildcard (*) for broad permissions.`})
35139
+ @MaxLength(200)
35140
+ Name: string;
35141
+
35142
+ @Field({description: `Grouping category for the scope (e.g., Entities, Agents, Admin). Used for organizing and filtering scopes in the UI.`})
35143
+ @MaxLength(200)
35144
+ Category: string;
35145
+
35146
+ @Field({nullable: true, description: `Human-readable description explaining what permissions this scope grants.`})
35147
+ @MaxLength(1000)
35148
+ Description?: string;
35149
+
35150
+ @Field()
35151
+ @MaxLength(10)
35152
+ _mj__CreatedAt: Date;
35153
+
35154
+ @Field()
35155
+ @MaxLength(10)
35156
+ _mj__UpdatedAt: Date;
35157
+
35158
+ @Field(() => [MJAPIKeyScope_])
35159
+ MJ_APIKeyScopes_ScopeIDArray: MJAPIKeyScope_[]; // Link to MJ_APIKeyScopes
35160
+
35161
+ }
35162
+
35163
+ //****************************************************************************
35164
+ // INPUT TYPE for MJ: API Scopes
35165
+ //****************************************************************************
35166
+ @InputType()
35167
+ export class CreateMJAPIScopeInput {
35168
+ @Field({ nullable: true })
35169
+ ID?: string;
35170
+
35171
+ @Field({ nullable: true })
35172
+ Name?: string;
35173
+
35174
+ @Field({ nullable: true })
35175
+ Category?: string;
35176
+
35177
+ @Field({ nullable: true })
35178
+ Description: string | null;
35179
+ }
35180
+
35181
+
35182
+ //****************************************************************************
35183
+ // INPUT TYPE for MJ: API Scopes
35184
+ //****************************************************************************
35185
+ @InputType()
35186
+ export class UpdateMJAPIScopeInput {
35187
+ @Field()
35188
+ ID: string;
35189
+
35190
+ @Field({ nullable: true })
35191
+ Name?: string;
35192
+
35193
+ @Field({ nullable: true })
35194
+ Category?: string;
35195
+
35196
+ @Field({ nullable: true })
35197
+ Description?: string | null;
35198
+
35199
+ @Field(() => [KeyValuePairInput], { nullable: true })
35200
+ OldValues___?: KeyValuePairInput[];
35201
+ }
35202
+
35203
+ //****************************************************************************
35204
+ // RESOLVER for MJ: API Scopes
35205
+ //****************************************************************************
35206
+ @ObjectType()
35207
+ export class RunMJAPIScopeViewResult {
35208
+ @Field(() => [MJAPIScope_])
35209
+ Results: MJAPIScope_[];
35210
+
35211
+ @Field(() => String, {nullable: true})
35212
+ UserViewRunID?: string;
35213
+
35214
+ @Field(() => Int, {nullable: true})
35215
+ RowCount: number;
35216
+
35217
+ @Field(() => Int, {nullable: true})
35218
+ TotalRowCount: number;
35219
+
35220
+ @Field(() => Int, {nullable: true})
35221
+ ExecutionTime: number;
35222
+
35223
+ @Field({nullable: true})
35224
+ ErrorMessage?: string;
35225
+
35226
+ @Field(() => Boolean, {nullable: false})
35227
+ Success: boolean;
35228
+ }
35229
+
35230
+ @Resolver(MJAPIScope_)
35231
+ export class MJAPIScopeResolver extends ResolverBase {
35232
+ @Query(() => RunMJAPIScopeViewResult)
35233
+ async RunMJAPIScopeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35234
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35235
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
35236
+ }
35237
+
35238
+ @Query(() => RunMJAPIScopeViewResult)
35239
+ async RunMJAPIScopeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35240
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35241
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
35242
+ }
35243
+
35244
+ @Query(() => RunMJAPIScopeViewResult)
35245
+ async RunMJAPIScopeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35246
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35247
+ input.EntityName = 'MJ: API Scopes';
35248
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
35249
+ }
35250
+ @Query(() => MJAPIScope_, { nullable: true })
35251
+ async MJAPIScope(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIScope_ | null> {
35252
+ this.CheckUserReadPermissions('MJ: API Scopes', userPayload);
35253
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35254
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35255
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIScopes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Scopes', userPayload, EntityPermissionType.Read, 'AND');
35256
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35257
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Scopes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35258
+ return result;
35259
+ }
35260
+
35261
+ @FieldResolver(() => [MJAPIKeyScope_])
35262
+ async MJ_APIKeyScopes_ScopeIDArray(@Root() mjapiscope_: MJAPIScope_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35263
+ this.CheckUserReadPermissions('MJ: API Key Scopes', userPayload);
35264
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35265
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35266
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyScopes] WHERE [ScopeID]='${mjapiscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Scopes', userPayload, EntityPermissionType.Read, 'AND');
35267
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35268
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Scopes', rows, this.GetUserFromPayload(userPayload));
35269
+ return result;
35270
+ }
35271
+
35272
+ @Mutation(() => MJAPIScope_)
35273
+ async CreateMJAPIScope(
35274
+ @Arg('input', () => CreateMJAPIScopeInput) input: CreateMJAPIScopeInput,
35275
+ @Ctx() { providers, userPayload }: AppContext,
35276
+ @PubSub() pubSub: PubSubEngine
35277
+ ) {
35278
+ const provider = GetReadWriteProvider(providers);
35279
+ return this.CreateRecord('MJ: API Scopes', input, provider, userPayload, pubSub)
35280
+ }
35281
+
35282
+ @Mutation(() => MJAPIScope_)
35283
+ async UpdateMJAPIScope(
35284
+ @Arg('input', () => UpdateMJAPIScopeInput) input: UpdateMJAPIScopeInput,
35285
+ @Ctx() { providers, userPayload }: AppContext,
35286
+ @PubSub() pubSub: PubSubEngine
35287
+ ) {
35288
+ const provider = GetReadWriteProvider(providers);
35289
+ return this.UpdateRecord('MJ: API Scopes', input, provider, userPayload, pubSub);
35290
+ }
35291
+
35292
+ @Mutation(() => MJAPIScope_)
35293
+ async DeleteMJAPIScope(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35294
+ const provider = GetReadWriteProvider(providers);
35295
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
35296
+ return this.DeleteRecord('MJ: API Scopes', key, options, provider, userPayload, pubSub);
35297
+ }
35298
+
35299
+ }
35300
+
34701
35301
  //****************************************************************************
34702
35302
  // ENTITY CLASS for MJ: Artifact Permissions
34703
35303
  //****************************************************************************
@@ -39577,6 +40177,9 @@ export class MJCredential_ {
39577
40177
  @MaxLength(200)
39578
40178
  Category?: string;
39579
40179
 
40180
+ @Field(() => [MJFileStorageAccount_])
40181
+ MJ_FileStorageAccounts_CredentialIDArray: MJFileStorageAccount_[]; // Link to MJ_FileStorageAccounts
40182
+
39580
40183
  @Field(() => [MJAICredentialBinding_])
39581
40184
  MJ_AICredentialBindings_CredentialIDArray: MJAICredentialBinding_[]; // Link to MJ_AICredentialBindings
39582
40185
 
@@ -39728,6 +40331,17 @@ export class MJCredentialResolver extends ResolverBase {
39728
40331
  return result;
39729
40332
  }
39730
40333
 
40334
+ @FieldResolver(() => [MJFileStorageAccount_])
40335
+ async MJ_FileStorageAccounts_CredentialIDArray(@Root() mjcredential_: MJCredential_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
40336
+ this.CheckUserReadPermissions('MJ: File Storage Accounts', userPayload);
40337
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
40338
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
40339
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwFileStorageAccounts] WHERE [CredentialID]='${mjcredential_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: File Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
40340
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
40341
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: File Storage Accounts', rows, this.GetUserFromPayload(userPayload));
40342
+ return result;
40343
+ }
40344
+
39731
40345
  @FieldResolver(() => [MJAICredentialBinding_])
39732
40346
  async MJ_AICredentialBindings_CredentialIDArray(@Root() mjcredential_: MJCredential_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
39733
40347
  this.CheckUserReadPermissions('MJ: AI Credential Bindings', userPayload);
@@ -41864,6 +42478,181 @@ export class MJEnvironmentResolver extends ResolverBase {
41864
42478
 
41865
42479
  }
41866
42480
 
42481
+ //****************************************************************************
42482
+ // ENTITY CLASS for MJ: File Storage Accounts
42483
+ //****************************************************************************
42484
+ @ObjectType({ description: `Enterprise-level file storage accounts. Each account represents a configured connection to a storage provider (e.g., Marketing Dropbox, Engineering Google Drive) with credentials managed centrally.` })
42485
+ export class MJFileStorageAccount_ {
42486
+ @Field({description: `Primary key`})
42487
+ @MaxLength(16)
42488
+ ID: string;
42489
+
42490
+ @Field({description: `Display name for the storage account (e.g., Marketing Files, Engineering Docs). Must be unique per provider.`})
42491
+ @MaxLength(400)
42492
+ Name: string;
42493
+
42494
+ @Field({nullable: true, description: `Optional description providing additional context about the account purpose or contents.`})
42495
+ Description?: string;
42496
+
42497
+ @Field({description: `Foreign key to FileStorageProvider indicating which storage service this account uses (Dropbox, Google Drive, S3, etc.).`})
42498
+ @MaxLength(16)
42499
+ ProviderID: string;
42500
+
42501
+ @Field({description: `Foreign key to Credential containing the authentication details (OAuth tokens, API keys, etc.) for this account. Credentials are decrypted at runtime by the Credential Engine.`})
42502
+ @MaxLength(16)
42503
+ CredentialID: string;
42504
+
42505
+ @Field()
42506
+ @MaxLength(10)
42507
+ _mj__CreatedAt: Date;
42508
+
42509
+ @Field()
42510
+ @MaxLength(10)
42511
+ _mj__UpdatedAt: Date;
42512
+
42513
+ @Field()
42514
+ @MaxLength(100)
42515
+ Provider: string;
42516
+
42517
+ @Field()
42518
+ @MaxLength(400)
42519
+ Credential: string;
42520
+
42521
+ }
42522
+
42523
+ //****************************************************************************
42524
+ // INPUT TYPE for MJ: File Storage Accounts
42525
+ //****************************************************************************
42526
+ @InputType()
42527
+ export class CreateMJFileStorageAccountInput {
42528
+ @Field({ nullable: true })
42529
+ ID?: string;
42530
+
42531
+ @Field({ nullable: true })
42532
+ Name?: string;
42533
+
42534
+ @Field({ nullable: true })
42535
+ Description: string | null;
42536
+
42537
+ @Field({ nullable: true })
42538
+ ProviderID?: string;
42539
+
42540
+ @Field({ nullable: true })
42541
+ CredentialID?: string;
42542
+ }
42543
+
42544
+
42545
+ //****************************************************************************
42546
+ // INPUT TYPE for MJ: File Storage Accounts
42547
+ //****************************************************************************
42548
+ @InputType()
42549
+ export class UpdateMJFileStorageAccountInput {
42550
+ @Field()
42551
+ ID: string;
42552
+
42553
+ @Field({ nullable: true })
42554
+ Name?: string;
42555
+
42556
+ @Field({ nullable: true })
42557
+ Description?: string | null;
42558
+
42559
+ @Field({ nullable: true })
42560
+ ProviderID?: string;
42561
+
42562
+ @Field({ nullable: true })
42563
+ CredentialID?: string;
42564
+
42565
+ @Field(() => [KeyValuePairInput], { nullable: true })
42566
+ OldValues___?: KeyValuePairInput[];
42567
+ }
42568
+
42569
+ //****************************************************************************
42570
+ // RESOLVER for MJ: File Storage Accounts
42571
+ //****************************************************************************
42572
+ @ObjectType()
42573
+ export class RunMJFileStorageAccountViewResult {
42574
+ @Field(() => [MJFileStorageAccount_])
42575
+ Results: MJFileStorageAccount_[];
42576
+
42577
+ @Field(() => String, {nullable: true})
42578
+ UserViewRunID?: string;
42579
+
42580
+ @Field(() => Int, {nullable: true})
42581
+ RowCount: number;
42582
+
42583
+ @Field(() => Int, {nullable: true})
42584
+ TotalRowCount: number;
42585
+
42586
+ @Field(() => Int, {nullable: true})
42587
+ ExecutionTime: number;
42588
+
42589
+ @Field({nullable: true})
42590
+ ErrorMessage?: string;
42591
+
42592
+ @Field(() => Boolean, {nullable: false})
42593
+ Success: boolean;
42594
+ }
42595
+
42596
+ @Resolver(MJFileStorageAccount_)
42597
+ export class MJFileStorageAccountResolver extends ResolverBase {
42598
+ @Query(() => RunMJFileStorageAccountViewResult)
42599
+ async RunMJFileStorageAccountViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42600
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42601
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
42602
+ }
42603
+
42604
+ @Query(() => RunMJFileStorageAccountViewResult)
42605
+ async RunMJFileStorageAccountViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42606
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42607
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
42608
+ }
42609
+
42610
+ @Query(() => RunMJFileStorageAccountViewResult)
42611
+ async RunMJFileStorageAccountDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42612
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42613
+ input.EntityName = 'MJ: File Storage Accounts';
42614
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
42615
+ }
42616
+ @Query(() => MJFileStorageAccount_, { nullable: true })
42617
+ async MJFileStorageAccount(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJFileStorageAccount_ | null> {
42618
+ this.CheckUserReadPermissions('MJ: File Storage Accounts', userPayload);
42619
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
42620
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
42621
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwFileStorageAccounts] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: File Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
42622
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
42623
+ const result = await this.MapFieldNamesToCodeNames('MJ: File Storage Accounts', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
42624
+ return result;
42625
+ }
42626
+
42627
+ @Mutation(() => MJFileStorageAccount_)
42628
+ async CreateMJFileStorageAccount(
42629
+ @Arg('input', () => CreateMJFileStorageAccountInput) input: CreateMJFileStorageAccountInput,
42630
+ @Ctx() { providers, userPayload }: AppContext,
42631
+ @PubSub() pubSub: PubSubEngine
42632
+ ) {
42633
+ const provider = GetReadWriteProvider(providers);
42634
+ return this.CreateRecord('MJ: File Storage Accounts', input, provider, userPayload, pubSub)
42635
+ }
42636
+
42637
+ @Mutation(() => MJFileStorageAccount_)
42638
+ async UpdateMJFileStorageAccount(
42639
+ @Arg('input', () => UpdateMJFileStorageAccountInput) input: UpdateMJFileStorageAccountInput,
42640
+ @Ctx() { providers, userPayload }: AppContext,
42641
+ @PubSub() pubSub: PubSubEngine
42642
+ ) {
42643
+ const provider = GetReadWriteProvider(providers);
42644
+ return this.UpdateRecord('MJ: File Storage Accounts', input, provider, userPayload, pubSub);
42645
+ }
42646
+
42647
+ @Mutation(() => MJFileStorageAccount_)
42648
+ async DeleteMJFileStorageAccount(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
42649
+ const provider = GetReadWriteProvider(providers);
42650
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
42651
+ return this.DeleteRecord('MJ: File Storage Accounts', key, options, provider, userPayload, pubSub);
42652
+ }
42653
+
42654
+ }
42655
+
41867
42656
  //****************************************************************************
41868
42657
  // ENTITY CLASS for MJ: List Invitations
41869
42658
  //****************************************************************************
@@ -47212,6 +48001,476 @@ export class MJTestResolver extends ResolverBase {
47212
48001
 
47213
48002
  }
47214
48003
 
48004
+ //****************************************************************************
48005
+ // ENTITY CLASS for MJ: User Notification Preferences
48006
+ //****************************************************************************
48007
+ @ObjectType({ description: `Per-user preferences for each notification type (delivery method overrides)` })
48008
+ export class MJUserNotificationPreference_ {
48009
+ @Field()
48010
+ @MaxLength(16)
48011
+ ID: string;
48012
+
48013
+ @Field()
48014
+ @MaxLength(16)
48015
+ UserID: string;
48016
+
48017
+ @Field()
48018
+ @MaxLength(16)
48019
+ NotificationTypeID: string;
48020
+
48021
+ @Field(() => Boolean, {nullable: true, description: `User preference for in-app notifications (NULL = use default)`})
48022
+ InAppEnabled?: boolean;
48023
+
48024
+ @Field(() => Boolean, {nullable: true, description: `User preference for email notifications (NULL = use default)`})
48025
+ EmailEnabled?: boolean;
48026
+
48027
+ @Field(() => Boolean, {nullable: true, description: `User preference for SMS notifications (NULL = use default)`})
48028
+ SMSEnabled?: boolean;
48029
+
48030
+ @Field(() => Boolean, {nullable: true})
48031
+ Enabled?: boolean;
48032
+
48033
+ @Field()
48034
+ @MaxLength(10)
48035
+ _mj__CreatedAt: Date;
48036
+
48037
+ @Field()
48038
+ @MaxLength(10)
48039
+ _mj__UpdatedAt: Date;
48040
+
48041
+ @Field()
48042
+ @MaxLength(200)
48043
+ User: string;
48044
+
48045
+ @Field()
48046
+ @MaxLength(200)
48047
+ NotificationType: string;
48048
+
48049
+ }
48050
+
48051
+ //****************************************************************************
48052
+ // INPUT TYPE for MJ: User Notification Preferences
48053
+ //****************************************************************************
48054
+ @InputType()
48055
+ export class CreateMJUserNotificationPreferenceInput {
48056
+ @Field({ nullable: true })
48057
+ ID?: string;
48058
+
48059
+ @Field({ nullable: true })
48060
+ UserID?: string;
48061
+
48062
+ @Field({ nullable: true })
48063
+ NotificationTypeID?: string;
48064
+
48065
+ @Field(() => Boolean, { nullable: true })
48066
+ InAppEnabled: boolean | null;
48067
+
48068
+ @Field(() => Boolean, { nullable: true })
48069
+ EmailEnabled: boolean | null;
48070
+
48071
+ @Field(() => Boolean, { nullable: true })
48072
+ SMSEnabled: boolean | null;
48073
+
48074
+ @Field(() => Boolean, { nullable: true })
48075
+ Enabled?: boolean | null;
48076
+ }
48077
+
48078
+
48079
+ //****************************************************************************
48080
+ // INPUT TYPE for MJ: User Notification Preferences
48081
+ //****************************************************************************
48082
+ @InputType()
48083
+ export class UpdateMJUserNotificationPreferenceInput {
48084
+ @Field()
48085
+ ID: string;
48086
+
48087
+ @Field({ nullable: true })
48088
+ UserID?: string;
48089
+
48090
+ @Field({ nullable: true })
48091
+ NotificationTypeID?: string;
48092
+
48093
+ @Field(() => Boolean, { nullable: true })
48094
+ InAppEnabled?: boolean | null;
48095
+
48096
+ @Field(() => Boolean, { nullable: true })
48097
+ EmailEnabled?: boolean | null;
48098
+
48099
+ @Field(() => Boolean, { nullable: true })
48100
+ SMSEnabled?: boolean | null;
48101
+
48102
+ @Field(() => Boolean, { nullable: true })
48103
+ Enabled?: boolean | null;
48104
+
48105
+ @Field(() => [KeyValuePairInput], { nullable: true })
48106
+ OldValues___?: KeyValuePairInput[];
48107
+ }
48108
+
48109
+ //****************************************************************************
48110
+ // RESOLVER for MJ: User Notification Preferences
48111
+ //****************************************************************************
48112
+ @ObjectType()
48113
+ export class RunMJUserNotificationPreferenceViewResult {
48114
+ @Field(() => [MJUserNotificationPreference_])
48115
+ Results: MJUserNotificationPreference_[];
48116
+
48117
+ @Field(() => String, {nullable: true})
48118
+ UserViewRunID?: string;
48119
+
48120
+ @Field(() => Int, {nullable: true})
48121
+ RowCount: number;
48122
+
48123
+ @Field(() => Int, {nullable: true})
48124
+ TotalRowCount: number;
48125
+
48126
+ @Field(() => Int, {nullable: true})
48127
+ ExecutionTime: number;
48128
+
48129
+ @Field({nullable: true})
48130
+ ErrorMessage?: string;
48131
+
48132
+ @Field(() => Boolean, {nullable: false})
48133
+ Success: boolean;
48134
+ }
48135
+
48136
+ @Resolver(MJUserNotificationPreference_)
48137
+ export class MJUserNotificationPreferenceResolver extends ResolverBase {
48138
+ @Query(() => RunMJUserNotificationPreferenceViewResult)
48139
+ async RunMJUserNotificationPreferenceViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
48140
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48141
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
48142
+ }
48143
+
48144
+ @Query(() => RunMJUserNotificationPreferenceViewResult)
48145
+ async RunMJUserNotificationPreferenceViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
48146
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48147
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
48148
+ }
48149
+
48150
+ @Query(() => RunMJUserNotificationPreferenceViewResult)
48151
+ async RunMJUserNotificationPreferenceDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
48152
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48153
+ input.EntityName = 'MJ: User Notification Preferences';
48154
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
48155
+ }
48156
+ @Query(() => MJUserNotificationPreference_, { nullable: true })
48157
+ async MJUserNotificationPreference(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJUserNotificationPreference_ | null> {
48158
+ this.CheckUserReadPermissions('MJ: User Notification Preferences', userPayload);
48159
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48160
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
48161
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationPreferences] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Preferences', userPayload, EntityPermissionType.Read, 'AND');
48162
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
48163
+ const result = await this.MapFieldNamesToCodeNames('MJ: User Notification Preferences', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
48164
+ return result;
48165
+ }
48166
+
48167
+ @Mutation(() => MJUserNotificationPreference_)
48168
+ async CreateMJUserNotificationPreference(
48169
+ @Arg('input', () => CreateMJUserNotificationPreferenceInput) input: CreateMJUserNotificationPreferenceInput,
48170
+ @Ctx() { providers, userPayload }: AppContext,
48171
+ @PubSub() pubSub: PubSubEngine
48172
+ ) {
48173
+ const provider = GetReadWriteProvider(providers);
48174
+ return this.CreateRecord('MJ: User Notification Preferences', input, provider, userPayload, pubSub)
48175
+ }
48176
+
48177
+ @Mutation(() => MJUserNotificationPreference_)
48178
+ async UpdateMJUserNotificationPreference(
48179
+ @Arg('input', () => UpdateMJUserNotificationPreferenceInput) input: UpdateMJUserNotificationPreferenceInput,
48180
+ @Ctx() { providers, userPayload }: AppContext,
48181
+ @PubSub() pubSub: PubSubEngine
48182
+ ) {
48183
+ const provider = GetReadWriteProvider(providers);
48184
+ return this.UpdateRecord('MJ: User Notification Preferences', input, provider, userPayload, pubSub);
48185
+ }
48186
+
48187
+ @Mutation(() => MJUserNotificationPreference_)
48188
+ async DeleteMJUserNotificationPreference(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
48189
+ const provider = GetReadWriteProvider(providers);
48190
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
48191
+ return this.DeleteRecord('MJ: User Notification Preferences', key, options, provider, userPayload, pubSub);
48192
+ }
48193
+
48194
+ }
48195
+
48196
+ //****************************************************************************
48197
+ // ENTITY CLASS for MJ: User Notification Types
48198
+ //****************************************************************************
48199
+ @ObjectType({ description: `Defines categories of notifications with delivery configuration and template associations` })
48200
+ export class MJUserNotificationType_ {
48201
+ @Field()
48202
+ @MaxLength(16)
48203
+ ID: string;
48204
+
48205
+ @Field({description: `Unique name for the notification type (e.g., 'Agent Completion')`})
48206
+ @MaxLength(200)
48207
+ Name: string;
48208
+
48209
+ @Field({nullable: true})
48210
+ @MaxLength(1000)
48211
+ Description?: string;
48212
+
48213
+ @Field(() => Boolean, {description: `Whether in-app notifications are enabled by default for this type`})
48214
+ DefaultInApp: boolean;
48215
+
48216
+ @Field(() => Boolean, {description: `Whether email notifications are enabled by default for this type`})
48217
+ DefaultEmail: boolean;
48218
+
48219
+ @Field(() => Boolean, {description: `Whether SMS notifications are enabled by default for this type`})
48220
+ DefaultSMS: boolean;
48221
+
48222
+ @Field(() => Boolean, {nullable: true, description: `Whether users can override the default delivery method`})
48223
+ AllowUserPreference?: boolean;
48224
+
48225
+ @Field({nullable: true})
48226
+ @MaxLength(16)
48227
+ EmailTemplateID?: string;
48228
+
48229
+ @Field({nullable: true})
48230
+ @MaxLength(16)
48231
+ SMSTemplateID?: string;
48232
+
48233
+ @Field({nullable: true})
48234
+ @MaxLength(200)
48235
+ Icon?: string;
48236
+
48237
+ @Field({nullable: true})
48238
+ @MaxLength(100)
48239
+ Color?: string;
48240
+
48241
+ @Field(() => Int, {nullable: true})
48242
+ AutoExpireDays?: number;
48243
+
48244
+ @Field(() => Int, {nullable: true})
48245
+ Priority?: number;
48246
+
48247
+ @Field()
48248
+ @MaxLength(10)
48249
+ _mj__CreatedAt: Date;
48250
+
48251
+ @Field()
48252
+ @MaxLength(10)
48253
+ _mj__UpdatedAt: Date;
48254
+
48255
+ @Field({nullable: true})
48256
+ @MaxLength(510)
48257
+ EmailTemplate?: string;
48258
+
48259
+ @Field({nullable: true})
48260
+ @MaxLength(510)
48261
+ SMSTemplate?: string;
48262
+
48263
+ @Field(() => [MJUserNotification_])
48264
+ UserNotifications_NotificationTypeIDArray: MJUserNotification_[]; // Link to UserNotifications
48265
+
48266
+ @Field(() => [MJUserNotificationPreference_])
48267
+ MJ_UserNotificationPreferences_NotificationTypeIDArray: MJUserNotificationPreference_[]; // Link to MJ_UserNotificationPreferences
48268
+
48269
+ }
48270
+
48271
+ //****************************************************************************
48272
+ // INPUT TYPE for MJ: User Notification Types
48273
+ //****************************************************************************
48274
+ @InputType()
48275
+ export class CreateMJUserNotificationTypeInput {
48276
+ @Field({ nullable: true })
48277
+ ID?: string;
48278
+
48279
+ @Field({ nullable: true })
48280
+ Name?: string;
48281
+
48282
+ @Field({ nullable: true })
48283
+ Description: string | null;
48284
+
48285
+ @Field(() => Boolean, { nullable: true })
48286
+ DefaultInApp?: boolean;
48287
+
48288
+ @Field(() => Boolean, { nullable: true })
48289
+ DefaultEmail?: boolean;
48290
+
48291
+ @Field(() => Boolean, { nullable: true })
48292
+ DefaultSMS?: boolean;
48293
+
48294
+ @Field(() => Boolean, { nullable: true })
48295
+ AllowUserPreference?: boolean | null;
48296
+
48297
+ @Field({ nullable: true })
48298
+ EmailTemplateID: string | null;
48299
+
48300
+ @Field({ nullable: true })
48301
+ SMSTemplateID: string | null;
48302
+
48303
+ @Field({ nullable: true })
48304
+ Icon: string | null;
48305
+
48306
+ @Field({ nullable: true })
48307
+ Color: string | null;
48308
+
48309
+ @Field(() => Int, { nullable: true })
48310
+ AutoExpireDays: number | null;
48311
+
48312
+ @Field(() => Int, { nullable: true })
48313
+ Priority?: number | null;
48314
+ }
48315
+
48316
+
48317
+ //****************************************************************************
48318
+ // INPUT TYPE for MJ: User Notification Types
48319
+ //****************************************************************************
48320
+ @InputType()
48321
+ export class UpdateMJUserNotificationTypeInput {
48322
+ @Field()
48323
+ ID: string;
48324
+
48325
+ @Field({ nullable: true })
48326
+ Name?: string;
48327
+
48328
+ @Field({ nullable: true })
48329
+ Description?: string | null;
48330
+
48331
+ @Field(() => Boolean, { nullable: true })
48332
+ DefaultInApp?: boolean;
48333
+
48334
+ @Field(() => Boolean, { nullable: true })
48335
+ DefaultEmail?: boolean;
48336
+
48337
+ @Field(() => Boolean, { nullable: true })
48338
+ DefaultSMS?: boolean;
48339
+
48340
+ @Field(() => Boolean, { nullable: true })
48341
+ AllowUserPreference?: boolean | null;
48342
+
48343
+ @Field({ nullable: true })
48344
+ EmailTemplateID?: string | null;
48345
+
48346
+ @Field({ nullable: true })
48347
+ SMSTemplateID?: string | null;
48348
+
48349
+ @Field({ nullable: true })
48350
+ Icon?: string | null;
48351
+
48352
+ @Field({ nullable: true })
48353
+ Color?: string | null;
48354
+
48355
+ @Field(() => Int, { nullable: true })
48356
+ AutoExpireDays?: number | null;
48357
+
48358
+ @Field(() => Int, { nullable: true })
48359
+ Priority?: number | null;
48360
+
48361
+ @Field(() => [KeyValuePairInput], { nullable: true })
48362
+ OldValues___?: KeyValuePairInput[];
48363
+ }
48364
+
48365
+ //****************************************************************************
48366
+ // RESOLVER for MJ: User Notification Types
48367
+ //****************************************************************************
48368
+ @ObjectType()
48369
+ export class RunMJUserNotificationTypeViewResult {
48370
+ @Field(() => [MJUserNotificationType_])
48371
+ Results: MJUserNotificationType_[];
48372
+
48373
+ @Field(() => String, {nullable: true})
48374
+ UserViewRunID?: string;
48375
+
48376
+ @Field(() => Int, {nullable: true})
48377
+ RowCount: number;
48378
+
48379
+ @Field(() => Int, {nullable: true})
48380
+ TotalRowCount: number;
48381
+
48382
+ @Field(() => Int, {nullable: true})
48383
+ ExecutionTime: number;
48384
+
48385
+ @Field({nullable: true})
48386
+ ErrorMessage?: string;
48387
+
48388
+ @Field(() => Boolean, {nullable: false})
48389
+ Success: boolean;
48390
+ }
48391
+
48392
+ @Resolver(MJUserNotificationType_)
48393
+ export class MJUserNotificationTypeResolver extends ResolverBase {
48394
+ @Query(() => RunMJUserNotificationTypeViewResult)
48395
+ async RunMJUserNotificationTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
48396
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48397
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
48398
+ }
48399
+
48400
+ @Query(() => RunMJUserNotificationTypeViewResult)
48401
+ async RunMJUserNotificationTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
48402
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48403
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
48404
+ }
48405
+
48406
+ @Query(() => RunMJUserNotificationTypeViewResult)
48407
+ async RunMJUserNotificationTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
48408
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48409
+ input.EntityName = 'MJ: User Notification Types';
48410
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
48411
+ }
48412
+ @Query(() => MJUserNotificationType_, { nullable: true })
48413
+ async MJUserNotificationType(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJUserNotificationType_ | null> {
48414
+ this.CheckUserReadPermissions('MJ: User Notification Types', userPayload);
48415
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48416
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
48417
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationTypes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Types', userPayload, EntityPermissionType.Read, 'AND');
48418
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
48419
+ const result = await this.MapFieldNamesToCodeNames('MJ: User Notification Types', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
48420
+ return result;
48421
+ }
48422
+
48423
+ @FieldResolver(() => [MJUserNotification_])
48424
+ async UserNotifications_NotificationTypeIDArray(@Root() mjusernotificationtype_: MJUserNotificationType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
48425
+ this.CheckUserReadPermissions('User Notifications', userPayload);
48426
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48427
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
48428
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotifications] WHERE [NotificationTypeID]='${mjusernotificationtype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'User Notifications', userPayload, EntityPermissionType.Read, 'AND');
48429
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
48430
+ const result = await this.ArrayMapFieldNamesToCodeNames('User Notifications', rows, this.GetUserFromPayload(userPayload));
48431
+ return result;
48432
+ }
48433
+
48434
+ @FieldResolver(() => [MJUserNotificationPreference_])
48435
+ async MJ_UserNotificationPreferences_NotificationTypeIDArray(@Root() mjusernotificationtype_: MJUserNotificationType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
48436
+ this.CheckUserReadPermissions('MJ: User Notification Preferences', userPayload);
48437
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
48438
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
48439
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationPreferences] WHERE [NotificationTypeID]='${mjusernotificationtype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Preferences', userPayload, EntityPermissionType.Read, 'AND');
48440
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
48441
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Preferences', rows, this.GetUserFromPayload(userPayload));
48442
+ return result;
48443
+ }
48444
+
48445
+ @Mutation(() => MJUserNotificationType_)
48446
+ async CreateMJUserNotificationType(
48447
+ @Arg('input', () => CreateMJUserNotificationTypeInput) input: CreateMJUserNotificationTypeInput,
48448
+ @Ctx() { providers, userPayload }: AppContext,
48449
+ @PubSub() pubSub: PubSubEngine
48450
+ ) {
48451
+ const provider = GetReadWriteProvider(providers);
48452
+ return this.CreateRecord('MJ: User Notification Types', input, provider, userPayload, pubSub)
48453
+ }
48454
+
48455
+ @Mutation(() => MJUserNotificationType_)
48456
+ async UpdateMJUserNotificationType(
48457
+ @Arg('input', () => UpdateMJUserNotificationTypeInput) input: UpdateMJUserNotificationTypeInput,
48458
+ @Ctx() { providers, userPayload }: AppContext,
48459
+ @PubSub() pubSub: PubSubEngine
48460
+ ) {
48461
+ const provider = GetReadWriteProvider(providers);
48462
+ return this.UpdateRecord('MJ: User Notification Types', input, provider, userPayload, pubSub);
48463
+ }
48464
+
48465
+ @Mutation(() => MJUserNotificationType_)
48466
+ async DeleteMJUserNotificationType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
48467
+ const provider = GetReadWriteProvider(providers);
48468
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
48469
+ return this.DeleteRecord('MJ: User Notification Types', key, options, provider, userPayload, pubSub);
48470
+ }
48471
+
48472
+ }
48473
+
47215
48474
  //****************************************************************************
47216
48475
  // ENTITY CLASS for MJ: User Settings
47217
48476
  //****************************************************************************
@@ -55395,9 +56654,15 @@ export class MJTemplate_ {
55395
56654
  @Field(() => [MJTemplateContent_])
55396
56655
  TemplateContents_TemplateIDArray: MJTemplateContent_[]; // Link to TemplateContents
55397
56656
 
56657
+ @Field(() => [MJUserNotificationType_])
56658
+ MJ_UserNotificationTypes_SMSTemplateIDArray: MJUserNotificationType_[]; // Link to MJ_UserNotificationTypes
56659
+
55398
56660
  @Field(() => [MJAIPrompt_])
55399
56661
  AIPrompts_TemplateIDArray: MJAIPrompt_[]; // Link to AIPrompts
55400
56662
 
56663
+ @Field(() => [MJUserNotificationType_])
56664
+ MJ_UserNotificationTypes_EmailTemplateIDArray: MJUserNotificationType_[]; // Link to MJ_UserNotificationTypes
56665
+
55401
56666
  @Field(() => [MJEntityDocument_])
55402
56667
  EntityDocuments_TemplateIDArray: MJEntityDocument_[]; // Link to EntityDocuments
55403
56668
 
@@ -55553,6 +56818,17 @@ export class MJTemplateResolver extends ResolverBase {
55553
56818
  return result;
55554
56819
  }
55555
56820
 
56821
+ @FieldResolver(() => [MJUserNotificationType_])
56822
+ async MJ_UserNotificationTypes_SMSTemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
56823
+ this.CheckUserReadPermissions('MJ: User Notification Types', userPayload);
56824
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
56825
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
56826
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationTypes] WHERE [SMSTemplateID]='${mjtemplate_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Types', userPayload, EntityPermissionType.Read, 'AND');
56827
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
56828
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Types', rows, this.GetUserFromPayload(userPayload));
56829
+ return result;
56830
+ }
56831
+
55556
56832
  @FieldResolver(() => [MJAIPrompt_])
55557
56833
  async AIPrompts_TemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
55558
56834
  this.CheckUserReadPermissions('AI Prompts', userPayload);
@@ -55564,6 +56840,17 @@ export class MJTemplateResolver extends ResolverBase {
55564
56840
  return result;
55565
56841
  }
55566
56842
 
56843
+ @FieldResolver(() => [MJUserNotificationType_])
56844
+ async MJ_UserNotificationTypes_EmailTemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
56845
+ this.CheckUserReadPermissions('MJ: User Notification Types', userPayload);
56846
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
56847
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
56848
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationTypes] WHERE [EmailTemplateID]='${mjtemplate_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Types', userPayload, EntityPermissionType.Read, 'AND');
56849
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
56850
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Types', rows, this.GetUserFromPayload(userPayload));
56851
+ return result;
56852
+ }
56853
+
55567
56854
  @FieldResolver(() => [MJEntityDocument_])
55568
56855
  async EntityDocuments_TemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
55569
56856
  this.CheckUserReadPermissions('Entity Documents', userPayload);
@@ -56177,6 +57464,10 @@ export class MJUserNotification_ {
56177
57464
  @MaxLength(16)
56178
57465
  ResourceRecordID?: string;
56179
57466
 
57467
+ @Field({nullable: true, description: `Optional reference to notification type for categorization and delivery preferences`})
57468
+ @MaxLength(16)
57469
+ NotificationTypeID?: string;
57470
+
56180
57471
  @Field()
56181
57472
  @MaxLength(200)
56182
57473
  User: string;
@@ -56185,6 +57476,10 @@ export class MJUserNotification_ {
56185
57476
  @MaxLength(510)
56186
57477
  ResourceType?: string;
56187
57478
 
57479
+ @Field({nullable: true})
57480
+ @MaxLength(200)
57481
+ NotificationType?: string;
57482
+
56188
57483
  }
56189
57484
 
56190
57485
  //****************************************************************************
@@ -56218,6 +57513,9 @@ export class CreateMJUserNotificationInput {
56218
57513
 
56219
57514
  @Field({ nullable: true })
56220
57515
  ResourceRecordID: string | null;
57516
+
57517
+ @Field({ nullable: true })
57518
+ NotificationTypeID: string | null;
56221
57519
  }
56222
57520
 
56223
57521
 
@@ -56253,6 +57551,9 @@ export class UpdateMJUserNotificationInput {
56253
57551
  @Field({ nullable: true })
56254
57552
  ResourceRecordID?: string | null;
56255
57553
 
57554
+ @Field({ nullable: true })
57555
+ NotificationTypeID?: string | null;
57556
+
56256
57557
  @Field(() => [KeyValuePairInput], { nullable: true })
56257
57558
  OldValues___?: KeyValuePairInput[];
56258
57559
  }
@@ -57918,6 +59219,12 @@ export class MJUser_ {
57918
59219
  @Field(() => [MJDashboardPermission_])
57919
59220
  MJ_DashboardPermissions_SharedByUserIDArray: MJDashboardPermission_[]; // Link to MJ_DashboardPermissions
57920
59221
 
59222
+ @Field(() => [MJUserNotificationPreference_])
59223
+ MJ_UserNotificationPreferences_UserIDArray: MJUserNotificationPreference_[]; // Link to MJ_UserNotificationPreferences
59224
+
59225
+ @Field(() => [MJAPIKey_])
59226
+ MJ_APIKeys_UserIDArray: MJAPIKey_[]; // Link to MJ_APIKeys
59227
+
57921
59228
  @Field(() => [MJResourcePermission_])
57922
59229
  ResourcePermissions_UserIDArray: MJResourcePermission_[]; // Link to ResourcePermissions
57923
59230
 
@@ -57951,6 +59258,9 @@ export class MJUser_ {
57951
59258
  @Field(() => [MJDashboardCategoryPermission_])
57952
59259
  MJ_DashboardCategoryPermissions_SharedByUserIDArray: MJDashboardCategoryPermission_[]; // Link to MJ_DashboardCategoryPermissions
57953
59260
 
59261
+ @Field(() => [MJAPIKey_])
59262
+ MJ_APIKeys_CreatedByUserIDArray: MJAPIKey_[]; // Link to MJ_APIKeys
59263
+
57954
59264
  @Field(() => [MJAIAgentRun_])
57955
59265
  MJ_AIAgentRuns_UserIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
57956
59266
 
@@ -58726,6 +60036,28 @@ export class MJUserResolverBase extends ResolverBase {
58726
60036
  return result;
58727
60037
  }
58728
60038
 
60039
+ @FieldResolver(() => [MJUserNotificationPreference_])
60040
+ async MJ_UserNotificationPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
60041
+ this.CheckUserReadPermissions('MJ: User Notification Preferences', userPayload);
60042
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
60043
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
60044
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Preferences', userPayload, EntityPermissionType.Read, 'AND');
60045
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
60046
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Preferences', rows, this.GetUserFromPayload(userPayload));
60047
+ return result;
60048
+ }
60049
+
60050
+ @FieldResolver(() => [MJAPIKey_])
60051
+ async MJ_APIKeys_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
60052
+ this.CheckUserReadPermissions('MJ: API Keys', userPayload);
60053
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
60054
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
60055
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeys] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Keys', userPayload, EntityPermissionType.Read, 'AND');
60056
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
60057
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Keys', rows, this.GetUserFromPayload(userPayload));
60058
+ return result;
60059
+ }
60060
+
58729
60061
  @FieldResolver(() => [MJResourcePermission_])
58730
60062
  async ResourcePermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
58731
60063
  this.CheckUserReadPermissions('Resource Permissions', userPayload);
@@ -58847,6 +60179,17 @@ export class MJUserResolverBase extends ResolverBase {
58847
60179
  return result;
58848
60180
  }
58849
60181
 
60182
+ @FieldResolver(() => [MJAPIKey_])
60183
+ async MJ_APIKeys_CreatedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
60184
+ this.CheckUserReadPermissions('MJ: API Keys', userPayload);
60185
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
60186
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
60187
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeys] WHERE [CreatedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Keys', userPayload, EntityPermissionType.Read, 'AND');
60188
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
60189
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Keys', rows, this.GetUserFromPayload(userPayload));
60190
+ return result;
60191
+ }
60192
+
58850
60193
  @FieldResolver(() => [MJAIAgentRun_])
58851
60194
  async MJ_AIAgentRuns_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
58852
60195
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);