@memberjunction/server 3.1.1 → 3.3.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.
Files changed (72) hide show
  1. package/README.md +47 -1
  2. package/dist/agents/skip-sdk.d.ts.map +1 -1
  3. package/dist/agents/skip-sdk.js +26 -1
  4. package/dist/agents/skip-sdk.js.map +1 -1
  5. package/dist/auth/APIKeyScopeAuth.d.ts +51 -0
  6. package/dist/auth/APIKeyScopeAuth.d.ts.map +1 -0
  7. package/dist/auth/APIKeyScopeAuth.js +163 -0
  8. package/dist/auth/APIKeyScopeAuth.js.map +1 -0
  9. package/dist/auth/index.d.ts +1 -0
  10. package/dist/auth/index.d.ts.map +1 -1
  11. package/dist/auth/index.js +1 -0
  12. package/dist/auth/index.js.map +1 -1
  13. package/dist/context.d.ts +8 -1
  14. package/dist/context.d.ts.map +1 -1
  15. package/dist/context.js +44 -7
  16. package/dist/context.js.map +1 -1
  17. package/dist/generated/generated.d.ts +634 -57
  18. package/dist/generated/generated.d.ts.map +1 -1
  19. package/dist/generated/generated.js +13728 -10072
  20. package/dist/generated/generated.js.map +1 -1
  21. package/dist/generic/ResolverBase.d.ts +2 -2
  22. package/dist/generic/ResolverBase.d.ts.map +1 -1
  23. package/dist/generic/ResolverBase.js +22 -4
  24. package/dist/generic/ResolverBase.js.map +1 -1
  25. package/dist/generic/RunViewResolver.d.ts +29 -1
  26. package/dist/generic/RunViewResolver.d.ts.map +1 -1
  27. package/dist/generic/RunViewResolver.js +143 -0
  28. package/dist/generic/RunViewResolver.js.map +1 -1
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +6 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/resolvers/APIKeyResolver.d.ts +23 -0
  34. package/dist/resolvers/APIKeyResolver.d.ts.map +1 -0
  35. package/dist/resolvers/APIKeyResolver.js +191 -0
  36. package/dist/resolvers/APIKeyResolver.js.map +1 -0
  37. package/dist/resolvers/FileResolver.d.ts +130 -1
  38. package/dist/resolvers/FileResolver.d.ts.map +1 -1
  39. package/dist/resolvers/FileResolver.js +784 -9
  40. package/dist/resolvers/FileResolver.js.map +1 -1
  41. package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
  42. package/dist/resolvers/RunAIAgentResolver.js +52 -31
  43. package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
  44. package/dist/resolvers/SqlLoggingConfigResolver.d.ts +10 -0
  45. package/dist/resolvers/SqlLoggingConfigResolver.d.ts.map +1 -1
  46. package/dist/resolvers/SqlLoggingConfigResolver.js +72 -7
  47. package/dist/resolvers/SqlLoggingConfigResolver.js.map +1 -1
  48. package/dist/resolvers/UserResolver.d.ts.map +1 -1
  49. package/dist/resolvers/UserResolver.js +31 -1
  50. package/dist/resolvers/UserResolver.js.map +1 -1
  51. package/dist/types.d.ts +4 -1
  52. package/dist/types.d.ts.map +1 -1
  53. package/dist/types.js.map +1 -1
  54. package/dist/util.d.ts.map +1 -1
  55. package/dist/util.js +36 -14
  56. package/dist/util.js.map +1 -1
  57. package/package.json +46 -44
  58. package/src/agents/skip-sdk.ts +31 -1
  59. package/src/auth/APIKeyScopeAuth.ts +366 -0
  60. package/src/auth/index.ts +1 -0
  61. package/src/context.ts +91 -9
  62. package/src/generated/generated.ts +2920 -604
  63. package/src/generic/ResolverBase.ts +38 -5
  64. package/src/generic/RunViewResolver.ts +132 -5
  65. package/src/index.ts +10 -0
  66. package/src/resolvers/APIKeyResolver.ts +234 -0
  67. package/src/resolvers/FileResolver.ts +701 -29
  68. package/src/resolvers/RunAIAgentResolver.ts +57 -47
  69. package/src/resolvers/SqlLoggingConfigResolver.ts +86 -13
  70. package/src/resolvers/UserResolver.ts +37 -1
  71. package/src/types.ts +7 -2
  72. package/src/util.ts +47 -17
@@ -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, APIApplicationScopeEntity, APIApplicationEntity, APIKeyApplicationEntity, 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
  //****************************************************************************
@@ -3240,6 +3240,28 @@ export class MJAIAgentNote_ {
3240
3240
  @MaxLength(16)
3241
3241
  EmbeddingModelID?: string;
3242
3242
 
3243
+ @Field({nullable: true, description: `Foreign key to Entity table identifying which entity type is used for primary scoping. NULL means this is a global note.`})
3244
+ @MaxLength(16)
3245
+ PrimaryScopeEntityID?: string;
3246
+
3247
+ @Field({nullable: true, description: `The record ID within the primary scope entity. NULL means global note. When set with empty SecondaryScopes, indicates primary-scope-only note.`})
3248
+ @MaxLength(200)
3249
+ PrimaryScopeRecordID?: string;
3250
+
3251
+ @Field({nullable: true, description: `JSON object containing additional scope dimensions. Empty/NULL with PrimaryScopeRecordID set = org-level note. Populated = fully-scoped note.`})
3252
+ SecondaryScopes?: string;
3253
+
3254
+ @Field({nullable: true, description: `Timestamp of when this note was last accessed/injected into agent context. Used for lifecycle management and cleanup.`})
3255
+ @MaxLength(10)
3256
+ LastAccessedAt?: Date;
3257
+
3258
+ @Field(() => Int, {description: `Number of times this note has been accessed/injected into agent context. Used for analytics and determining note value.`})
3259
+ AccessCount: number;
3260
+
3261
+ @Field({nullable: true, description: `Optional expiration timestamp. Notes past this date are candidates for archival. NULL means no expiration.`})
3262
+ @MaxLength(10)
3263
+ ExpiresAt?: Date;
3264
+
3243
3265
  @Field({nullable: true})
3244
3266
  @MaxLength(510)
3245
3267
  Agent?: string;
@@ -3271,6 +3293,10 @@ export class MJAIAgentNote_ {
3271
3293
  @MaxLength(100)
3272
3294
  EmbeddingModel?: string;
3273
3295
 
3296
+ @Field({nullable: true})
3297
+ @MaxLength(510)
3298
+ PrimaryScopeEntity?: string;
3299
+
3274
3300
  }
3275
3301
 
3276
3302
  //****************************************************************************
@@ -3322,6 +3348,24 @@ export class CreateMJAIAgentNoteInput {
3322
3348
 
3323
3349
  @Field({ nullable: true })
3324
3350
  EmbeddingModelID: string | null;
3351
+
3352
+ @Field({ nullable: true })
3353
+ PrimaryScopeEntityID: string | null;
3354
+
3355
+ @Field({ nullable: true })
3356
+ PrimaryScopeRecordID: string | null;
3357
+
3358
+ @Field({ nullable: true })
3359
+ SecondaryScopes: string | null;
3360
+
3361
+ @Field({ nullable: true })
3362
+ LastAccessedAt: Date | null;
3363
+
3364
+ @Field(() => Int, { nullable: true })
3365
+ AccessCount?: number;
3366
+
3367
+ @Field({ nullable: true })
3368
+ ExpiresAt: Date | null;
3325
3369
  }
3326
3370
 
3327
3371
 
@@ -3375,6 +3419,24 @@ export class UpdateMJAIAgentNoteInput {
3375
3419
  @Field({ nullable: true })
3376
3420
  EmbeddingModelID?: string | null;
3377
3421
 
3422
+ @Field({ nullable: true })
3423
+ PrimaryScopeEntityID?: string | null;
3424
+
3425
+ @Field({ nullable: true })
3426
+ PrimaryScopeRecordID?: string | null;
3427
+
3428
+ @Field({ nullable: true })
3429
+ SecondaryScopes?: string | null;
3430
+
3431
+ @Field({ nullable: true })
3432
+ LastAccessedAt?: Date | null;
3433
+
3434
+ @Field(() => Int, { nullable: true })
3435
+ AccessCount?: number;
3436
+
3437
+ @Field({ nullable: true })
3438
+ ExpiresAt?: Date | null;
3439
+
3378
3440
  @Field(() => [KeyValuePairInput], { nullable: true })
3379
3441
  OldValues___?: KeyValuePairInput[];
3380
3442
  }
@@ -3898,6 +3960,21 @@ if this limit is exceeded.`})
3898
3960
  @Field({nullable: true, description: `JSON object containing parameter values that customize how this agent's type-level system prompt is rendered. The schema is defined by the agent type's PromptParamsSchema field. Allows per-agent control over which prompt sections are included, enabling token savings by excluding unused documentation.`})
3899
3961
  AgentTypePromptParams?: string;
3900
3962
 
3963
+ @Field({nullable: true, description: `JSON configuration defining scope dimensions for multi-tenant deployments. Example: {"dimensions":[{"name":"OrganizationID","entityId":"...","isPrimary":true,"required":true},{"name":"ContactID","entityId":"...","isPrimary":false,"required":false}],"inheritanceMode":"cascading"}`})
3964
+ ScopeConfig?: string;
3965
+
3966
+ @Field(() => Int, {nullable: true, description: `Number of days to retain notes before archiving due to inactivity. Default 90. NULL means use system default.`})
3967
+ NoteRetentionDays?: number;
3968
+
3969
+ @Field(() => Int, {nullable: true, description: `Number of days to retain examples before archiving due to inactivity. Default 180. NULL means use system default.`})
3970
+ ExampleRetentionDays?: number;
3971
+
3972
+ @Field(() => Boolean, {description: `Whether automatic archival of stale notes/examples is enabled for this agent. Default true.`})
3973
+ AutoArchiveEnabled: boolean;
3974
+
3975
+ @Field({nullable: true, description: `JSON configuration for optional reranking of retrieved memory items. Schema: { enabled: boolean, rerankerModelId: string, retrievalMultiplier: number (default 3), minRelevanceThreshold: number (default 0.5), rerankPromptId?: string, contextFields?: string[], fallbackOnError: boolean (default true) }. When null or disabled, vector search results are used directly without reranking.`})
3976
+ RerankerConfiguration?: string;
3977
+
3901
3978
  @Field({nullable: true})
3902
3979
  @MaxLength(510)
3903
3980
  Parent?: string;
@@ -4160,6 +4237,21 @@ export class CreateMJAIAgentInput {
4160
4237
 
4161
4238
  @Field({ nullable: true })
4162
4239
  AgentTypePromptParams: string | null;
4240
+
4241
+ @Field({ nullable: true })
4242
+ ScopeConfig: string | null;
4243
+
4244
+ @Field(() => Int, { nullable: true })
4245
+ NoteRetentionDays?: number | null;
4246
+
4247
+ @Field(() => Int, { nullable: true })
4248
+ ExampleRetentionDays?: number | null;
4249
+
4250
+ @Field(() => Boolean, { nullable: true })
4251
+ AutoArchiveEnabled?: boolean;
4252
+
4253
+ @Field({ nullable: true })
4254
+ RerankerConfiguration: string | null;
4163
4255
  }
4164
4256
 
4165
4257
 
@@ -4330,6 +4422,21 @@ export class UpdateMJAIAgentInput {
4330
4422
  @Field({ nullable: true })
4331
4423
  AgentTypePromptParams?: string | null;
4332
4424
 
4425
+ @Field({ nullable: true })
4426
+ ScopeConfig?: string | null;
4427
+
4428
+ @Field(() => Int, { nullable: true })
4429
+ NoteRetentionDays?: number | null;
4430
+
4431
+ @Field(() => Int, { nullable: true })
4432
+ ExampleRetentionDays?: number | null;
4433
+
4434
+ @Field(() => Boolean, { nullable: true })
4435
+ AutoArchiveEnabled?: boolean;
4436
+
4437
+ @Field({ nullable: true })
4438
+ RerankerConfiguration?: string | null;
4439
+
4333
4440
  @Field(() => [KeyValuePairInput], { nullable: true })
4334
4441
  OldValues___?: KeyValuePairInput[];
4335
4442
  }
@@ -17261,6 +17368,12 @@ export class MJEntity_ {
17261
17368
  @Field(() => [MJRecordLink_])
17262
17369
  MJ_RecordLinks_SourceEntityIDArray: MJRecordLink_[]; // Link to MJ_RecordLinks
17263
17370
 
17371
+ @Field(() => [MJAIAgentExample_])
17372
+ MJ_AIAgentExamples_PrimaryScopeEntityIDArray: MJAIAgentExample_[]; // Link to MJ_AIAgentExamples
17373
+
17374
+ @Field(() => [MJAIAgentNote_])
17375
+ AIAgentNotes_PrimaryScopeEntityIDArray: MJAIAgentNote_[]; // Link to AIAgentNotes
17376
+
17264
17377
  @Field(() => [MJGeneratedCode_])
17265
17378
  GeneratedCodes_LinkedEntityIDArray: MJGeneratedCode_[]; // Link to GeneratedCodes
17266
17379
 
@@ -17270,6 +17383,9 @@ export class MJEntity_ {
17270
17383
  @Field(() => [MJTestRun_])
17271
17384
  MJ_TestRuns_TargetLogEntityIDArray: MJTestRun_[]; // Link to MJ_TestRuns
17272
17385
 
17386
+ @Field(() => [MJAIAgentRun_])
17387
+ MJ_AIAgentRuns_PrimaryScopeEntityIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
17388
+
17273
17389
  }
17274
17390
 
17275
17391
  //****************************************************************************
@@ -18093,6 +18209,28 @@ export class MJEntityResolverBase extends ResolverBase {
18093
18209
  return result;
18094
18210
  }
18095
18211
 
18212
+ @FieldResolver(() => [MJAIAgentExample_])
18213
+ async MJ_AIAgentExamples_PrimaryScopeEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
18214
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
18215
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
18216
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
18217
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [PrimaryScopeEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
18218
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
18219
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Examples', rows, this.GetUserFromPayload(userPayload));
18220
+ return result;
18221
+ }
18222
+
18223
+ @FieldResolver(() => [MJAIAgentNote_])
18224
+ async AIAgentNotes_PrimaryScopeEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
18225
+ this.CheckUserReadPermissions('AI Agent Notes', userPayload);
18226
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
18227
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
18228
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentNotes] WHERE [PrimaryScopeEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Notes', userPayload, EntityPermissionType.Read, 'AND');
18229
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
18230
+ const result = await this.ArrayMapFieldNamesToCodeNames('AI Agent Notes', rows, this.GetUserFromPayload(userPayload));
18231
+ return result;
18232
+ }
18233
+
18096
18234
  @FieldResolver(() => [MJGeneratedCode_])
18097
18235
  async GeneratedCodes_LinkedEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
18098
18236
  this.CheckUserReadPermissions('Generated Codes', userPayload);
@@ -18126,6 +18264,17 @@ export class MJEntityResolverBase extends ResolverBase {
18126
18264
  return result;
18127
18265
  }
18128
18266
 
18267
+ @FieldResolver(() => [MJAIAgentRun_])
18268
+ async MJ_AIAgentRuns_PrimaryScopeEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
18269
+ this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
18270
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
18271
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
18272
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRuns] WHERE [PrimaryScopeEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
18273
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
18274
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows, this.GetUserFromPayload(userPayload));
18275
+ return result;
18276
+ }
18277
+
18129
18278
  @Mutation(() => MJEntity_)
18130
18279
  async CreateMJEntity(
18131
18280
  @Arg('input', () => CreateMJEntityInput) input: CreateMJEntityInput,
@@ -23282,9 +23431,18 @@ export class MJFileStorageProvider_ {
23282
23431
  @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
23432
  SupportsSearch: boolean;
23284
23433
 
23434
+ @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.`})
23435
+ Configuration?: string;
23436
+
23437
+ @Field(() => Boolean, {description: `If true, this provider requires OAuth authentication. Enterprise OAuth integration via Credential Engine is planned but not yet implemented.`})
23438
+ RequiresOAuth: boolean;
23439
+
23285
23440
  @Field(() => [MJFile_])
23286
23441
  Files_ProviderIDArray: MJFile_[]; // Link to Files
23287
23442
 
23443
+ @Field(() => [MJFileStorageAccount_])
23444
+ MJ_FileStorageAccounts_ProviderIDArray: MJFileStorageAccount_[]; // Link to MJ_FileStorageAccounts
23445
+
23288
23446
  @Field(() => [MJAIConfiguration_])
23289
23447
  MJ_AIConfigurations_DefaultStorageProviderIDArray: MJAIConfiguration_[]; // Link to MJ_AIConfigurations
23290
23448
 
@@ -23321,6 +23479,12 @@ export class CreateMJFileStorageProviderInput {
23321
23479
 
23322
23480
  @Field(() => Boolean, { nullable: true })
23323
23481
  SupportsSearch?: boolean;
23482
+
23483
+ @Field({ nullable: true })
23484
+ Configuration: string | null;
23485
+
23486
+ @Field(() => Boolean, { nullable: true })
23487
+ RequiresOAuth?: boolean;
23324
23488
  }
23325
23489
 
23326
23490
 
@@ -23353,6 +23517,12 @@ export class UpdateMJFileStorageProviderInput {
23353
23517
  @Field(() => Boolean, { nullable: true })
23354
23518
  SupportsSearch?: boolean;
23355
23519
 
23520
+ @Field({ nullable: true })
23521
+ Configuration?: string | null;
23522
+
23523
+ @Field(() => Boolean, { nullable: true })
23524
+ RequiresOAuth?: boolean;
23525
+
23356
23526
  @Field(() => [KeyValuePairInput], { nullable: true })
23357
23527
  OldValues___?: KeyValuePairInput[];
23358
23528
  }
@@ -23426,6 +23596,17 @@ export class MJFileStorageProviderResolver extends ResolverBase {
23426
23596
  return result;
23427
23597
  }
23428
23598
 
23599
+ @FieldResolver(() => [MJFileStorageAccount_])
23600
+ async MJ_FileStorageAccounts_ProviderIDArray(@Root() mjfilestorageprovider_: MJFileStorageProvider_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
23601
+ this.CheckUserReadPermissions('MJ: File Storage Accounts', userPayload);
23602
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
23603
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
23604
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwFileStorageAccounts] WHERE [ProviderID]='${mjfilestorageprovider_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: File Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
23605
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
23606
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: File Storage Accounts', rows, this.GetUserFromPayload(userPayload));
23607
+ return result;
23608
+ }
23609
+
23429
23610
  @FieldResolver(() => [MJAIConfiguration_])
23430
23611
  async MJ_AIConfigurations_DefaultStorageProviderIDArray(@Root() mjfilestorageprovider_: MJFileStorageProvider_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
23431
23612
  this.CheckUserReadPermissions('MJ: AI Configurations', userPayload);
@@ -23738,220 +23919,6 @@ export class MJFileResolver extends ResolverBase {
23738
23919
 
23739
23920
  }
23740
23921
 
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
23922
  //****************************************************************************
23956
23923
  // ENTITY CLASS for Generated Code Categories
23957
23924
  //****************************************************************************
@@ -26856,6 +26823,28 @@ export class MJAIAgentExample_ {
26856
26823
  @MaxLength(16)
26857
26824
  EmbeddingModelID?: string;
26858
26825
 
26826
+ @Field({nullable: true, description: `Foreign key to Entity table identifying which entity type is used for primary scoping. NULL means this is a global example.`})
26827
+ @MaxLength(16)
26828
+ PrimaryScopeEntityID?: string;
26829
+
26830
+ @Field({nullable: true, description: `The record ID within the primary scope entity. NULL means global example. When set with empty SecondaryScopes, indicates primary-scope-only example.`})
26831
+ @MaxLength(200)
26832
+ PrimaryScopeRecordID?: string;
26833
+
26834
+ @Field({nullable: true, description: `JSON object containing additional scope dimensions. Empty/NULL with PrimaryScopeRecordID set = org-level example. Populated = fully-scoped example.`})
26835
+ SecondaryScopes?: string;
26836
+
26837
+ @Field({nullable: true, description: `Timestamp of when this example was last accessed/used for agent context. Used for lifecycle management and cleanup.`})
26838
+ @MaxLength(10)
26839
+ LastAccessedAt?: Date;
26840
+
26841
+ @Field(() => Int, {description: `Number of times this example has been accessed/used. Used for analytics and determining example value.`})
26842
+ AccessCount: number;
26843
+
26844
+ @Field({nullable: true, description: `Optional expiration timestamp. Examples past this date are candidates for archival. NULL means no expiration.`})
26845
+ @MaxLength(10)
26846
+ ExpiresAt?: Date;
26847
+
26859
26848
  @Field({nullable: true})
26860
26849
  @MaxLength(510)
26861
26850
  Agent?: string;
@@ -26883,6 +26872,10 @@ export class MJAIAgentExample_ {
26883
26872
  @MaxLength(100)
26884
26873
  EmbeddingModel?: string;
26885
26874
 
26875
+ @Field({nullable: true})
26876
+ @MaxLength(510)
26877
+ PrimaryScopeEntity?: string;
26878
+
26886
26879
  }
26887
26880
 
26888
26881
  //****************************************************************************
@@ -26937,6 +26930,24 @@ export class CreateMJAIAgentExampleInput {
26937
26930
 
26938
26931
  @Field({ nullable: true })
26939
26932
  EmbeddingModelID: string | null;
26933
+
26934
+ @Field({ nullable: true })
26935
+ PrimaryScopeEntityID: string | null;
26936
+
26937
+ @Field({ nullable: true })
26938
+ PrimaryScopeRecordID: string | null;
26939
+
26940
+ @Field({ nullable: true })
26941
+ SecondaryScopes: string | null;
26942
+
26943
+ @Field({ nullable: true })
26944
+ LastAccessedAt: Date | null;
26945
+
26946
+ @Field(() => Int, { nullable: true })
26947
+ AccessCount?: number;
26948
+
26949
+ @Field({ nullable: true })
26950
+ ExpiresAt: Date | null;
26940
26951
  }
26941
26952
 
26942
26953
 
@@ -26993,6 +27004,24 @@ export class UpdateMJAIAgentExampleInput {
26993
27004
  @Field({ nullable: true })
26994
27005
  EmbeddingModelID?: string | null;
26995
27006
 
27007
+ @Field({ nullable: true })
27008
+ PrimaryScopeEntityID?: string | null;
27009
+
27010
+ @Field({ nullable: true })
27011
+ PrimaryScopeRecordID?: string | null;
27012
+
27013
+ @Field({ nullable: true })
27014
+ SecondaryScopes?: string | null;
27015
+
27016
+ @Field({ nullable: true })
27017
+ LastAccessedAt?: Date | null;
27018
+
27019
+ @Field(() => Int, { nullable: true })
27020
+ AccessCount?: number;
27021
+
27022
+ @Field({ nullable: true })
27023
+ ExpiresAt?: Date | null;
27024
+
26996
27025
  @Field(() => [KeyValuePairInput], { nullable: true })
26997
27026
  OldValues___?: KeyValuePairInput[];
26998
27027
  }
@@ -28703,6 +28732,17 @@ each time the agent processes a prompt step.`})
28703
28732
  @MaxLength(16)
28704
28733
  TestRunID?: string;
28705
28734
 
28735
+ @Field({nullable: true, description: `Foreign key to Entity table identifying which entity type is used for primary scoping (e.g., Organizations, Tenants)`})
28736
+ @MaxLength(16)
28737
+ PrimaryScopeEntityID?: string;
28738
+
28739
+ @Field({nullable: true, description: `The record ID within the primary scope entity (e.g., the specific OrganizationID). Indexed for fast multi-tenant filtering.`})
28740
+ @MaxLength(200)
28741
+ PrimaryScopeRecordID?: string;
28742
+
28743
+ @Field({nullable: true, description: `JSON object containing additional scope dimensions beyond the primary scope. Example: {"ContactID":"abc-123","TeamID":"team-456"}`})
28744
+ SecondaryScopes?: string;
28745
+
28706
28746
  @Field({nullable: true})
28707
28747
  @MaxLength(510)
28708
28748
  Agent?: string;
@@ -28746,6 +28786,10 @@ each time the agent processes a prompt step.`})
28746
28786
  @MaxLength(510)
28747
28787
  TestRun?: string;
28748
28788
 
28789
+ @Field({nullable: true})
28790
+ @MaxLength(510)
28791
+ PrimaryScopeEntity?: string;
28792
+
28749
28793
  @Field({nullable: true})
28750
28794
  @MaxLength(16)
28751
28795
  RootParentRunID?: string;
@@ -28895,6 +28939,15 @@ export class CreateMJAIAgentRunInput {
28895
28939
 
28896
28940
  @Field({ nullable: true })
28897
28941
  TestRunID: string | null;
28942
+
28943
+ @Field({ nullable: true })
28944
+ PrimaryScopeEntityID: string | null;
28945
+
28946
+ @Field({ nullable: true })
28947
+ PrimaryScopeRecordID: string | null;
28948
+
28949
+ @Field({ nullable: true })
28950
+ SecondaryScopes: string | null;
28898
28951
  }
28899
28952
 
28900
28953
 
@@ -29020,6 +29073,15 @@ export class UpdateMJAIAgentRunInput {
29020
29073
  @Field({ nullable: true })
29021
29074
  TestRunID?: string | null;
29022
29075
 
29076
+ @Field({ nullable: true })
29077
+ PrimaryScopeEntityID?: string | null;
29078
+
29079
+ @Field({ nullable: true })
29080
+ PrimaryScopeRecordID?: string | null;
29081
+
29082
+ @Field({ nullable: true })
29083
+ SecondaryScopes?: string | null;
29084
+
29023
29085
  @Field(() => [KeyValuePairInput], { nullable: true })
29024
29086
  OldValues___?: KeyValuePairInput[];
29025
29087
  }
@@ -34699,37 +34761,35 @@ export class MJAIVendorResolver extends ResolverBase {
34699
34761
  }
34700
34762
 
34701
34763
  //****************************************************************************
34702
- // ENTITY CLASS for MJ: Artifact Permissions
34764
+ // ENTITY CLASS for MJ: API Application Scopes
34703
34765
  //****************************************************************************
34704
- @ObjectType({ description: `Manages user permissions for artifacts with granular access control (Read, Edit, Delete, Share)` })
34705
- export class MJArtifactPermission_ {
34766
+ @ObjectType({ description: `Defines the scope ceiling for each application with pattern-based rules. Controls which scopes and resource patterns an application can use, regardless of what API keys grant.` })
34767
+ export class MJAPIApplicationScope_ {
34706
34768
  @Field()
34707
34769
  @MaxLength(16)
34708
34770
  ID: string;
34709
34771
 
34710
- @Field()
34772
+ @Field({description: `Reference to the application this ceiling rule applies to.`})
34711
34773
  @MaxLength(16)
34712
- ArtifactID: string;
34774
+ ApplicationID: string;
34713
34775
 
34714
- @Field()
34776
+ @Field({description: `Reference to the scope this rule applies to.`})
34715
34777
  @MaxLength(16)
34716
- UserID: string;
34778
+ ScopeID: string;
34717
34779
 
34718
- @Field(() => Boolean, {description: `Whether the user can view/read the artifact`})
34719
- CanRead: boolean;
34720
-
34721
- @Field(() => Boolean, {description: `Whether the user can modify the artifact or create new versions`})
34722
- CanEdit: boolean;
34780
+ @Field({nullable: true, description: `Glob pattern for matching resources (e.g., Users,Accounts or Skip* or *). NULL means match all resources.`})
34781
+ @MaxLength(1500)
34782
+ ResourcePattern?: string;
34723
34783
 
34724
- @Field(() => Boolean, {description: `Whether the user can delete the artifact`})
34725
- CanDelete: boolean;
34784
+ @Field({description: `How to interpret the pattern: Include (grant if matches) or Exclude (grant if does NOT match).`})
34785
+ @MaxLength(40)
34786
+ PatternType: string;
34726
34787
 
34727
- @Field(() => Boolean, {description: `Whether the user can share the artifact with other users`})
34728
- CanShare: boolean;
34788
+ @Field(() => Boolean, {description: `If true, this rule explicitly DENIES access. Deny rules trump allow rules at the same priority level.`})
34789
+ IsDeny: boolean;
34729
34790
 
34730
- @Field({nullable: true, description: `Foreign key to the User who shared this artifact (if shared)`})
34731
- @MaxLength(16)
34732
- SharedByUserID?: string;
34791
+ @Field(() => Int, {description: `Rule evaluation order. Higher priority rules are evaluated first. Within same priority, deny rules are evaluated before allow rules.`})
34792
+ Priority: number;
34733
34793
 
34734
34794
  @Field()
34735
34795
  @MaxLength(10)
@@ -34739,91 +34799,81 @@ export class MJArtifactPermission_ {
34739
34799
  @MaxLength(10)
34740
34800
  _mj__UpdatedAt: Date;
34741
34801
 
34742
- @Field()
34743
- @MaxLength(510)
34744
- Artifact: string;
34745
-
34746
34802
  @Field()
34747
34803
  @MaxLength(200)
34748
- User: string;
34804
+ Application: string;
34749
34805
 
34750
- @Field({nullable: true})
34806
+ @Field()
34751
34807
  @MaxLength(200)
34752
- SharedByUser?: string;
34808
+ Scope: string;
34753
34809
 
34754
34810
  }
34755
34811
 
34756
34812
  //****************************************************************************
34757
- // INPUT TYPE for MJ: Artifact Permissions
34813
+ // INPUT TYPE for MJ: API Application Scopes
34758
34814
  //****************************************************************************
34759
34815
  @InputType()
34760
- export class CreateMJArtifactPermissionInput {
34816
+ export class CreateMJAPIApplicationScopeInput {
34761
34817
  @Field({ nullable: true })
34762
34818
  ID?: string;
34763
34819
 
34764
34820
  @Field({ nullable: true })
34765
- ArtifactID?: string;
34821
+ ApplicationID?: string;
34766
34822
 
34767
34823
  @Field({ nullable: true })
34768
- UserID?: string;
34769
-
34770
- @Field(() => Boolean, { nullable: true })
34771
- CanRead?: boolean;
34824
+ ScopeID?: string;
34772
34825
 
34773
- @Field(() => Boolean, { nullable: true })
34774
- CanEdit?: boolean;
34826
+ @Field({ nullable: true })
34827
+ ResourcePattern: string | null;
34775
34828
 
34776
- @Field(() => Boolean, { nullable: true })
34777
- CanDelete?: boolean;
34829
+ @Field({ nullable: true })
34830
+ PatternType?: string;
34778
34831
 
34779
34832
  @Field(() => Boolean, { nullable: true })
34780
- CanShare?: boolean;
34833
+ IsDeny?: boolean;
34781
34834
 
34782
- @Field({ nullable: true })
34783
- SharedByUserID: string | null;
34835
+ @Field(() => Int, { nullable: true })
34836
+ Priority?: number;
34784
34837
  }
34785
34838
 
34786
34839
 
34787
34840
  //****************************************************************************
34788
- // INPUT TYPE for MJ: Artifact Permissions
34841
+ // INPUT TYPE for MJ: API Application Scopes
34789
34842
  //****************************************************************************
34790
34843
  @InputType()
34791
- export class UpdateMJArtifactPermissionInput {
34844
+ export class UpdateMJAPIApplicationScopeInput {
34792
34845
  @Field()
34793
34846
  ID: string;
34794
34847
 
34795
34848
  @Field({ nullable: true })
34796
- ArtifactID?: string;
34849
+ ApplicationID?: string;
34797
34850
 
34798
34851
  @Field({ nullable: true })
34799
- UserID?: string;
34800
-
34801
- @Field(() => Boolean, { nullable: true })
34802
- CanRead?: boolean;
34852
+ ScopeID?: string;
34803
34853
 
34804
- @Field(() => Boolean, { nullable: true })
34805
- CanEdit?: boolean;
34854
+ @Field({ nullable: true })
34855
+ ResourcePattern?: string | null;
34806
34856
 
34807
- @Field(() => Boolean, { nullable: true })
34808
- CanDelete?: boolean;
34857
+ @Field({ nullable: true })
34858
+ PatternType?: string;
34809
34859
 
34810
34860
  @Field(() => Boolean, { nullable: true })
34811
- CanShare?: boolean;
34861
+ IsDeny?: boolean;
34812
34862
 
34813
- @Field({ nullable: true })
34814
- SharedByUserID?: string | null;
34863
+ @Field(() => Int, { nullable: true })
34864
+ Priority?: number;
34815
34865
 
34816
34866
  @Field(() => [KeyValuePairInput], { nullable: true })
34817
34867
  OldValues___?: KeyValuePairInput[];
34818
34868
  }
34819
34869
 
34820
34870
  //****************************************************************************
34821
- // RESOLVER for MJ: Artifact Permissions
34871
+ // RESOLVER for MJ: API Application Scopes
34822
34872
  //****************************************************************************
34823
34873
  @ObjectType()
34824
- export class RunMJArtifactPermissionViewResult {
34825
- @Field(() => [MJArtifactPermission_])
34826
- Results: MJArtifactPermission_[];
34874
+ export class RunMJAPIApplicationScopeViewResult {
34875
+ @Field(() => [MJAPIApplicationScope_])
34876
+ Results: MJAPIApplicationScope_[];
34827
34877
 
34828
34878
  @Field(() => String, {nullable: true})
34829
34879
  UserViewRunID?: string;
@@ -34844,88 +34894,85 @@ export class RunMJArtifactPermissionViewResult {
34844
34894
  Success: boolean;
34845
34895
  }
34846
34896
 
34847
- @Resolver(MJArtifactPermission_)
34848
- export class MJArtifactPermissionResolver extends ResolverBase {
34849
- @Query(() => RunMJArtifactPermissionViewResult)
34850
- async RunMJArtifactPermissionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34897
+ @Resolver(MJAPIApplicationScope_)
34898
+ export class MJAPIApplicationScopeResolver extends ResolverBase {
34899
+ @Query(() => RunMJAPIApplicationScopeViewResult)
34900
+ async RunMJAPIApplicationScopeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34851
34901
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34852
34902
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
34853
34903
  }
34854
34904
 
34855
- @Query(() => RunMJArtifactPermissionViewResult)
34856
- async RunMJArtifactPermissionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34905
+ @Query(() => RunMJAPIApplicationScopeViewResult)
34906
+ async RunMJAPIApplicationScopeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34857
34907
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34858
34908
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
34859
34909
  }
34860
34910
 
34861
- @Query(() => RunMJArtifactPermissionViewResult)
34862
- async RunMJArtifactPermissionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34911
+ @Query(() => RunMJAPIApplicationScopeViewResult)
34912
+ async RunMJAPIApplicationScopeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34863
34913
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34864
- input.EntityName = 'MJ: Artifact Permissions';
34914
+ input.EntityName = 'MJ: API Application Scopes';
34865
34915
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
34866
34916
  }
34867
- @Query(() => MJArtifactPermission_, { nullable: true })
34868
- async MJArtifactPermission(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactPermission_ | null> {
34869
- this.CheckUserReadPermissions('MJ: Artifact Permissions', userPayload);
34917
+ @Query(() => MJAPIApplicationScope_, { nullable: true })
34918
+ async MJAPIApplicationScope(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIApplicationScope_ | null> {
34919
+ this.CheckUserReadPermissions('MJ: API Application Scopes', userPayload);
34870
34920
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
34871
34921
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
34872
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactPermissions] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Permissions', userPayload, EntityPermissionType.Read, 'AND');
34922
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIApplicationScopes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Application Scopes', userPayload, EntityPermissionType.Read, 'AND');
34873
34923
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
34874
- const result = await this.MapFieldNamesToCodeNames('MJ: Artifact Permissions', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
34924
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Application Scopes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
34875
34925
  return result;
34876
34926
  }
34877
34927
 
34878
- @Mutation(() => MJArtifactPermission_)
34879
- async CreateMJArtifactPermission(
34880
- @Arg('input', () => CreateMJArtifactPermissionInput) input: CreateMJArtifactPermissionInput,
34928
+ @Mutation(() => MJAPIApplicationScope_)
34929
+ async CreateMJAPIApplicationScope(
34930
+ @Arg('input', () => CreateMJAPIApplicationScopeInput) input: CreateMJAPIApplicationScopeInput,
34881
34931
  @Ctx() { providers, userPayload }: AppContext,
34882
34932
  @PubSub() pubSub: PubSubEngine
34883
34933
  ) {
34884
34934
  const provider = GetReadWriteProvider(providers);
34885
- return this.CreateRecord('MJ: Artifact Permissions', input, provider, userPayload, pubSub)
34935
+ return this.CreateRecord('MJ: API Application Scopes', input, provider, userPayload, pubSub)
34886
34936
  }
34887
34937
 
34888
- @Mutation(() => MJArtifactPermission_)
34889
- async UpdateMJArtifactPermission(
34890
- @Arg('input', () => UpdateMJArtifactPermissionInput) input: UpdateMJArtifactPermissionInput,
34938
+ @Mutation(() => MJAPIApplicationScope_)
34939
+ async UpdateMJAPIApplicationScope(
34940
+ @Arg('input', () => UpdateMJAPIApplicationScopeInput) input: UpdateMJAPIApplicationScopeInput,
34891
34941
  @Ctx() { providers, userPayload }: AppContext,
34892
34942
  @PubSub() pubSub: PubSubEngine
34893
34943
  ) {
34894
34944
  const provider = GetReadWriteProvider(providers);
34895
- return this.UpdateRecord('MJ: Artifact Permissions', input, provider, userPayload, pubSub);
34945
+ return this.UpdateRecord('MJ: API Application Scopes', input, provider, userPayload, pubSub);
34896
34946
  }
34897
34947
 
34898
- @Mutation(() => MJArtifactPermission_)
34899
- async DeleteMJArtifactPermission(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34948
+ @Mutation(() => MJAPIApplicationScope_)
34949
+ async DeleteMJAPIApplicationScope(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
34900
34950
  const provider = GetReadWriteProvider(providers);
34901
34951
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
34902
- return this.DeleteRecord('MJ: Artifact Permissions', key, options, provider, userPayload, pubSub);
34952
+ return this.DeleteRecord('MJ: API Application Scopes', key, options, provider, userPayload, pubSub);
34903
34953
  }
34904
34954
 
34905
34955
  }
34906
34956
 
34907
34957
  //****************************************************************************
34908
- // ENTITY CLASS for MJ: Artifact Types
34958
+ // ENTITY CLASS for MJ: API Applications
34909
34959
  //****************************************************************************
34910
- @ObjectType({ description: `Defines the types of artifacts that can be created within conversations` })
34911
- export class MJArtifactType_ {
34960
+ @ObjectType({ description: `Registry of applications that can consume MemberJunction APIs. Each application defines a scope ceiling that limits what API keys can access when used with that application.` })
34961
+ export class MJAPIApplication_ {
34912
34962
  @Field()
34913
34963
  @MaxLength(16)
34914
34964
  ID: string;
34915
34965
 
34916
- @Field({description: `Display name of the artifact type`})
34966
+ @Field({description: `Unique name identifying the application (e.g., MJAPI, MCPServer, Portal, CLI).`})
34917
34967
  @MaxLength(200)
34918
34968
  Name: string;
34919
34969
 
34920
- @Field({nullable: true, description: `Detailed description of the artifact type`})
34970
+ @Field({nullable: true, description: `Human-readable description of the application and its purpose.`})
34971
+ @MaxLength(1000)
34921
34972
  Description?: string;
34922
34973
 
34923
- @Field({description: `MIME type or content identifier for this artifact type`})
34924
- @MaxLength(200)
34925
- ContentType: string;
34926
-
34927
- @Field(() => Boolean, {description: `Indicates if this artifact type is currently available for use`})
34928
- IsEnabled: boolean;
34974
+ @Field(() => Boolean, {description: `Whether this application is currently active. Inactive applications reject all API key authentication.`})
34975
+ IsActive: boolean;
34929
34976
 
34930
34977
  @Field()
34931
34978
  @MaxLength(10)
@@ -34935,51 +34982,22 @@ export class MJArtifactType_ {
34935
34982
  @MaxLength(10)
34936
34983
  _mj__UpdatedAt: Date;
34937
34984
 
34938
- @Field({nullable: true, description: `Parent artifact type ID for hierarchical artifact type organization. Child types inherit ExtractRules from parent but can override.`})
34939
- @MaxLength(16)
34940
- ParentID?: string;
34941
-
34942
- @Field({nullable: true, description: `JSON array of extraction rules defining how to extract attributes from artifact content. Each rule has: name (string), description (string), type (TypeScript type), standardProperty ('name'|'description'|'displayMarkdown'|'displayHtml'|null), extractor (JavaScript code string). Child types inherit parent rules and can override by name.`})
34943
- ExtractRules?: string;
34944
-
34945
- @Field({nullable: true, description: `Driver class name for the artifact viewer plugin. References Angular component registered with @RegisterClass decorator.`})
34946
- @MaxLength(510)
34947
- DriverClass?: string;
34948
-
34949
- @Field({nullable: true, description: `Font Awesome icon class name for displaying this artifact type in the UI (e.g., fa-file-code, fa-chart-line)`})
34950
- @MaxLength(510)
34951
- Icon?: string;
34952
-
34953
- @Field({nullable: true})
34954
- @MaxLength(200)
34955
- Parent?: string;
34956
-
34957
- @Field({nullable: true})
34958
- @MaxLength(16)
34959
- RootParentID?: string;
34960
-
34961
- @Field(() => [MJConversationArtifact_])
34962
- MJ_ConversationArtifacts_ArtifactTypeIDArray: MJConversationArtifact_[]; // Link to MJ_ConversationArtifacts
34963
-
34964
- @Field(() => [MJAIAgentArtifactType_])
34965
- MJ_AIAgentArtifactTypes_ArtifactTypeIDArray: MJAIAgentArtifactType_[]; // Link to MJ_AIAgentArtifactTypes
34966
-
34967
- @Field(() => [MJArtifact_])
34968
- MJ_Artifacts_TypeIDArray: MJArtifact_[]; // Link to MJ_Artifacts
34985
+ @Field(() => [MJAPIApplicationScope_])
34986
+ MJ_APIApplicationScopes_ApplicationIDArray: MJAPIApplicationScope_[]; // Link to MJ_APIApplicationScopes
34969
34987
 
34970
- @Field(() => [MJArtifactType_])
34971
- MJ_ArtifactTypes_ParentIDArray: MJArtifactType_[]; // Link to MJ_ArtifactTypes
34988
+ @Field(() => [MJAPIKeyUsageLog_])
34989
+ MJ_APIKeyUsageLogs_ApplicationIDArray: MJAPIKeyUsageLog_[]; // Link to MJ_APIKeyUsageLogs
34972
34990
 
34973
- @Field(() => [MJAIAgent_])
34974
- AIAgents_DefaultArtifactTypeIDArray: MJAIAgent_[]; // Link to AIAgents
34991
+ @Field(() => [MJAPIKeyApplication_])
34992
+ MJ_APIKeyApplications_ApplicationIDArray: MJAPIKeyApplication_[]; // Link to MJ_APIKeyApplications
34975
34993
 
34976
34994
  }
34977
34995
 
34978
34996
  //****************************************************************************
34979
- // INPUT TYPE for MJ: Artifact Types
34997
+ // INPUT TYPE for MJ: API Applications
34980
34998
  //****************************************************************************
34981
34999
  @InputType()
34982
- export class CreateMJArtifactTypeInput {
35000
+ export class CreateMJAPIApplicationInput {
34983
35001
  @Field({ nullable: true })
34984
35002
  ID?: string;
34985
35003
 
@@ -34989,31 +35007,16 @@ export class CreateMJArtifactTypeInput {
34989
35007
  @Field({ nullable: true })
34990
35008
  Description: string | null;
34991
35009
 
34992
- @Field({ nullable: true })
34993
- ContentType?: string;
34994
-
34995
35010
  @Field(() => Boolean, { nullable: true })
34996
- IsEnabled?: boolean;
34997
-
34998
- @Field({ nullable: true })
34999
- ParentID: string | null;
35000
-
35001
- @Field({ nullable: true })
35002
- ExtractRules: string | null;
35003
-
35004
- @Field({ nullable: true })
35005
- DriverClass: string | null;
35006
-
35007
- @Field({ nullable: true })
35008
- Icon: string | null;
35011
+ IsActive?: boolean;
35009
35012
  }
35010
35013
 
35011
35014
 
35012
35015
  //****************************************************************************
35013
- // INPUT TYPE for MJ: Artifact Types
35016
+ // INPUT TYPE for MJ: API Applications
35014
35017
  //****************************************************************************
35015
35018
  @InputType()
35016
- export class UpdateMJArtifactTypeInput {
35019
+ export class UpdateMJAPIApplicationInput {
35017
35020
  @Field()
35018
35021
  ID: string;
35019
35022
 
@@ -35023,35 +35026,20 @@ export class UpdateMJArtifactTypeInput {
35023
35026
  @Field({ nullable: true })
35024
35027
  Description?: string | null;
35025
35028
 
35026
- @Field({ nullable: true })
35027
- ContentType?: string;
35028
-
35029
35029
  @Field(() => Boolean, { nullable: true })
35030
- IsEnabled?: boolean;
35031
-
35032
- @Field({ nullable: true })
35033
- ParentID?: string | null;
35034
-
35035
- @Field({ nullable: true })
35036
- ExtractRules?: string | null;
35037
-
35038
- @Field({ nullable: true })
35039
- DriverClass?: string | null;
35040
-
35041
- @Field({ nullable: true })
35042
- Icon?: string | null;
35030
+ IsActive?: boolean;
35043
35031
 
35044
35032
  @Field(() => [KeyValuePairInput], { nullable: true })
35045
35033
  OldValues___?: KeyValuePairInput[];
35046
35034
  }
35047
35035
 
35048
35036
  //****************************************************************************
35049
- // RESOLVER for MJ: Artifact Types
35037
+ // RESOLVER for MJ: API Applications
35050
35038
  //****************************************************************************
35051
35039
  @ObjectType()
35052
- export class RunMJArtifactTypeViewResult {
35053
- @Field(() => [MJArtifactType_])
35054
- Results: MJArtifactType_[];
35040
+ export class RunMJAPIApplicationViewResult {
35041
+ @Field(() => [MJAPIApplication_])
35042
+ Results: MJAPIApplication_[];
35055
35043
 
35056
35044
  @Field(() => String, {nullable: true})
35057
35045
  UserViewRunID?: string;
@@ -35072,144 +35060,115 @@ export class RunMJArtifactTypeViewResult {
35072
35060
  Success: boolean;
35073
35061
  }
35074
35062
 
35075
- @Resolver(MJArtifactType_)
35076
- export class MJArtifactTypeResolver extends ResolverBase {
35077
- @Query(() => RunMJArtifactTypeViewResult)
35078
- async RunMJArtifactTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35063
+ @Resolver(MJAPIApplication_)
35064
+ export class MJAPIApplicationResolver extends ResolverBase {
35065
+ @Query(() => RunMJAPIApplicationViewResult)
35066
+ async RunMJAPIApplicationViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35079
35067
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35080
35068
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
35081
35069
  }
35082
35070
 
35083
- @Query(() => RunMJArtifactTypeViewResult)
35084
- async RunMJArtifactTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35071
+ @Query(() => RunMJAPIApplicationViewResult)
35072
+ async RunMJAPIApplicationViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35085
35073
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35086
35074
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
35087
35075
  }
35088
35076
 
35089
- @Query(() => RunMJArtifactTypeViewResult)
35090
- async RunMJArtifactTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35077
+ @Query(() => RunMJAPIApplicationViewResult)
35078
+ async RunMJAPIApplicationDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35091
35079
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35092
- input.EntityName = 'MJ: Artifact Types';
35080
+ input.EntityName = 'MJ: API Applications';
35093
35081
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
35094
35082
  }
35095
- @Query(() => MJArtifactType_, { nullable: true })
35096
- async MJArtifactType(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactType_ | null> {
35097
- this.CheckUserReadPermissions('MJ: Artifact Types', userPayload);
35083
+ @Query(() => MJAPIApplication_, { nullable: true })
35084
+ async MJAPIApplication(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIApplication_ | null> {
35085
+ this.CheckUserReadPermissions('MJ: API Applications', userPayload);
35098
35086
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35099
35087
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35100
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactTypes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Types', userPayload, EntityPermissionType.Read, 'AND');
35088
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIApplications] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Applications', userPayload, EntityPermissionType.Read, 'AND');
35101
35089
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35102
- const result = await this.MapFieldNamesToCodeNames('MJ: Artifact Types', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35090
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Applications', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35103
35091
  return result;
35104
35092
  }
35105
35093
 
35106
- @FieldResolver(() => [MJConversationArtifact_])
35107
- async MJ_ConversationArtifacts_ArtifactTypeIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35108
- this.CheckUserReadPermissions('MJ: Conversation Artifacts', userPayload);
35109
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35110
- const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35111
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwConversationArtifacts] WHERE [ArtifactTypeID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Artifacts', userPayload, EntityPermissionType.Read, 'AND');
35112
- const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35113
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Artifacts', rows, this.GetUserFromPayload(userPayload));
35114
- return result;
35115
- }
35116
-
35117
- @FieldResolver(() => [MJAIAgentArtifactType_])
35118
- async MJ_AIAgentArtifactTypes_ArtifactTypeIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35119
- this.CheckUserReadPermissions('MJ: AI Agent Artifact Types', userPayload);
35120
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35121
- const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35122
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentArtifactTypes] WHERE [ArtifactTypeID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Artifact Types', userPayload, EntityPermissionType.Read, 'AND');
35123
- const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35124
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Artifact Types', rows, this.GetUserFromPayload(userPayload));
35125
- return result;
35126
- }
35127
-
35128
- @FieldResolver(() => [MJArtifact_])
35129
- async MJ_Artifacts_TypeIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35130
- this.CheckUserReadPermissions('MJ: Artifacts', userPayload);
35094
+ @FieldResolver(() => [MJAPIApplicationScope_])
35095
+ async MJ_APIApplicationScopes_ApplicationIDArray(@Root() mjapiapplication_: MJAPIApplication_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35096
+ this.CheckUserReadPermissions('MJ: API Application Scopes', userPayload);
35131
35097
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35132
35098
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35133
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifacts] WHERE [TypeID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifacts', userPayload, EntityPermissionType.Read, 'AND');
35099
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIApplicationScopes] WHERE [ApplicationID]='${mjapiapplication_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Application Scopes', userPayload, EntityPermissionType.Read, 'AND');
35134
35100
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35135
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Artifacts', rows, this.GetUserFromPayload(userPayload));
35101
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Application Scopes', rows, this.GetUserFromPayload(userPayload));
35136
35102
  return result;
35137
35103
  }
35138
35104
 
35139
- @FieldResolver(() => [MJArtifactType_])
35140
- async MJ_ArtifactTypes_ParentIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35141
- this.CheckUserReadPermissions('MJ: Artifact Types', userPayload);
35105
+ @FieldResolver(() => [MJAPIKeyUsageLog_])
35106
+ async MJ_APIKeyUsageLogs_ApplicationIDArray(@Root() mjapiapplication_: MJAPIApplication_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35107
+ this.CheckUserReadPermissions('MJ: API Key Usage Logs', userPayload);
35142
35108
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35143
35109
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35144
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactTypes] WHERE [ParentID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Types', userPayload, EntityPermissionType.Read, 'AND');
35110
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyUsageLogs] WHERE [ApplicationID]='${mjapiapplication_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Usage Logs', userPayload, EntityPermissionType.Read, 'AND');
35145
35111
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35146
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Artifact Types', rows, this.GetUserFromPayload(userPayload));
35112
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Usage Logs', rows, this.GetUserFromPayload(userPayload));
35147
35113
  return result;
35148
35114
  }
35149
35115
 
35150
- @FieldResolver(() => [MJAIAgent_])
35151
- async AIAgents_DefaultArtifactTypeIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35152
- this.CheckUserReadPermissions('AI Agents', userPayload);
35116
+ @FieldResolver(() => [MJAPIKeyApplication_])
35117
+ async MJ_APIKeyApplications_ApplicationIDArray(@Root() mjapiapplication_: MJAPIApplication_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35118
+ this.CheckUserReadPermissions('MJ: API Key Applications', userPayload);
35153
35119
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35154
35120
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35155
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgents] WHERE [DefaultArtifactTypeID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agents', userPayload, EntityPermissionType.Read, 'AND');
35121
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyApplications] WHERE [ApplicationID]='${mjapiapplication_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Applications', userPayload, EntityPermissionType.Read, 'AND');
35156
35122
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35157
- const result = await this.ArrayMapFieldNamesToCodeNames('AI Agents', rows, this.GetUserFromPayload(userPayload));
35123
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Applications', rows, this.GetUserFromPayload(userPayload));
35158
35124
  return result;
35159
35125
  }
35160
35126
 
35161
- @Mutation(() => MJArtifactType_)
35162
- async CreateMJArtifactType(
35163
- @Arg('input', () => CreateMJArtifactTypeInput) input: CreateMJArtifactTypeInput,
35127
+ @Mutation(() => MJAPIApplication_)
35128
+ async CreateMJAPIApplication(
35129
+ @Arg('input', () => CreateMJAPIApplicationInput) input: CreateMJAPIApplicationInput,
35164
35130
  @Ctx() { providers, userPayload }: AppContext,
35165
35131
  @PubSub() pubSub: PubSubEngine
35166
35132
  ) {
35167
35133
  const provider = GetReadWriteProvider(providers);
35168
- return this.CreateRecord('MJ: Artifact Types', input, provider, userPayload, pubSub)
35134
+ return this.CreateRecord('MJ: API Applications', input, provider, userPayload, pubSub)
35169
35135
  }
35170
35136
 
35171
- @Mutation(() => MJArtifactType_)
35172
- async UpdateMJArtifactType(
35173
- @Arg('input', () => UpdateMJArtifactTypeInput) input: UpdateMJArtifactTypeInput,
35137
+ @Mutation(() => MJAPIApplication_)
35138
+ async UpdateMJAPIApplication(
35139
+ @Arg('input', () => UpdateMJAPIApplicationInput) input: UpdateMJAPIApplicationInput,
35174
35140
  @Ctx() { providers, userPayload }: AppContext,
35175
35141
  @PubSub() pubSub: PubSubEngine
35176
35142
  ) {
35177
35143
  const provider = GetReadWriteProvider(providers);
35178
- return this.UpdateRecord('MJ: Artifact Types', input, provider, userPayload, pubSub);
35144
+ return this.UpdateRecord('MJ: API Applications', input, provider, userPayload, pubSub);
35179
35145
  }
35180
35146
 
35181
- @Mutation(() => MJArtifactType_)
35182
- async DeleteMJArtifactType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35147
+ @Mutation(() => MJAPIApplication_)
35148
+ async DeleteMJAPIApplication(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35183
35149
  const provider = GetReadWriteProvider(providers);
35184
35150
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
35185
- return this.DeleteRecord('MJ: Artifact Types', key, options, provider, userPayload, pubSub);
35151
+ return this.DeleteRecord('MJ: API Applications', key, options, provider, userPayload, pubSub);
35186
35152
  }
35187
35153
 
35188
35154
  }
35189
35155
 
35190
35156
  //****************************************************************************
35191
- // ENTITY CLASS for MJ: Artifact Uses
35157
+ // ENTITY CLASS for MJ: API Key Applications
35192
35158
  //****************************************************************************
35193
- @ObjectType({ description: `Audit trail of artifact usage for security and analytics. Tracks each time an artifact is viewed, opened, shared, saved, or exported by users.` })
35194
- export class MJArtifactUse_ {
35159
+ @ObjectType({ description: `Optional binding of API keys to specific applications. If no records exist for a key, it works with all applications. If records exist, the key only works with those specific applications.` })
35160
+ export class MJAPIKeyApplication_ {
35195
35161
  @Field()
35196
35162
  @MaxLength(16)
35197
35163
  ID: string;
35198
35164
 
35199
- @Field({description: `The specific version of the artifact being used.`})
35165
+ @Field({description: `Reference to the API key being bound to an application.`})
35200
35166
  @MaxLength(16)
35201
- ArtifactVersionID: string;
35167
+ APIKeyID: string;
35202
35168
 
35203
- @Field({description: `The user performing the action.`})
35169
+ @Field({description: `Reference to the application this key is authorized to use.`})
35204
35170
  @MaxLength(16)
35205
- UserID: string;
35206
-
35207
- @Field({description: `Type of usage: Viewed (artifact displayed), Opened (artifact accessed), Shared (artifact shared with others), Saved (artifact bookmarked), or Exported (artifact downloaded).`})
35208
- @MaxLength(40)
35209
- UsageType: string;
35210
-
35211
- @Field({nullable: true, description: `Optional JSON context with additional metadata about the usage event (e.g., source page, referrer, device info).`})
35212
- UsageContext?: string;
35171
+ ApplicationID: string;
35213
35172
 
35214
35173
  @Field()
35215
35174
  @MaxLength(10)
@@ -35219,69 +35178,57 @@ export class MJArtifactUse_ {
35219
35178
  @MaxLength(10)
35220
35179
  _mj__UpdatedAt: Date;
35221
35180
 
35222
- @Field({nullable: true})
35181
+ @Field()
35223
35182
  @MaxLength(510)
35224
- ArtifactVersion?: string;
35183
+ APIKey: string;
35225
35184
 
35226
35185
  @Field()
35227
35186
  @MaxLength(200)
35228
- User: string;
35187
+ Application: string;
35229
35188
 
35230
35189
  }
35231
35190
 
35232
35191
  //****************************************************************************
35233
- // INPUT TYPE for MJ: Artifact Uses
35192
+ // INPUT TYPE for MJ: API Key Applications
35234
35193
  //****************************************************************************
35235
35194
  @InputType()
35236
- export class CreateMJArtifactUseInput {
35195
+ export class CreateMJAPIKeyApplicationInput {
35237
35196
  @Field({ nullable: true })
35238
35197
  ID?: string;
35239
35198
 
35240
35199
  @Field({ nullable: true })
35241
- ArtifactVersionID?: string;
35242
-
35243
- @Field({ nullable: true })
35244
- UserID?: string;
35245
-
35246
- @Field({ nullable: true })
35247
- UsageType?: string;
35200
+ APIKeyID?: string;
35248
35201
 
35249
35202
  @Field({ nullable: true })
35250
- UsageContext: string | null;
35203
+ ApplicationID?: string;
35251
35204
  }
35252
35205
 
35253
35206
 
35254
35207
  //****************************************************************************
35255
- // INPUT TYPE for MJ: Artifact Uses
35208
+ // INPUT TYPE for MJ: API Key Applications
35256
35209
  //****************************************************************************
35257
35210
  @InputType()
35258
- export class UpdateMJArtifactUseInput {
35211
+ export class UpdateMJAPIKeyApplicationInput {
35259
35212
  @Field()
35260
35213
  ID: string;
35261
35214
 
35262
35215
  @Field({ nullable: true })
35263
- ArtifactVersionID?: string;
35264
-
35265
- @Field({ nullable: true })
35266
- UserID?: string;
35267
-
35268
- @Field({ nullable: true })
35269
- UsageType?: string;
35216
+ APIKeyID?: string;
35270
35217
 
35271
35218
  @Field({ nullable: true })
35272
- UsageContext?: string | null;
35219
+ ApplicationID?: string;
35273
35220
 
35274
35221
  @Field(() => [KeyValuePairInput], { nullable: true })
35275
35222
  OldValues___?: KeyValuePairInput[];
35276
35223
  }
35277
35224
 
35278
35225
  //****************************************************************************
35279
- // RESOLVER for MJ: Artifact Uses
35226
+ // RESOLVER for MJ: API Key Applications
35280
35227
  //****************************************************************************
35281
35228
  @ObjectType()
35282
- export class RunMJArtifactUseViewResult {
35283
- @Field(() => [MJArtifactUse_])
35284
- Results: MJArtifactUse_[];
35229
+ export class RunMJAPIKeyApplicationViewResult {
35230
+ @Field(() => [MJAPIKeyApplication_])
35231
+ Results: MJAPIKeyApplication_[];
35285
35232
 
35286
35233
  @Field(() => String, {nullable: true})
35287
35234
  UserViewRunID?: string;
@@ -35302,93 +35249,82 @@ export class RunMJArtifactUseViewResult {
35302
35249
  Success: boolean;
35303
35250
  }
35304
35251
 
35305
- @Resolver(MJArtifactUse_)
35306
- export class MJArtifactUseResolver extends ResolverBase {
35307
- @Query(() => RunMJArtifactUseViewResult)
35308
- async RunMJArtifactUseViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35252
+ @Resolver(MJAPIKeyApplication_)
35253
+ export class MJAPIKeyApplicationResolver extends ResolverBase {
35254
+ @Query(() => RunMJAPIKeyApplicationViewResult)
35255
+ async RunMJAPIKeyApplicationViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35309
35256
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35310
35257
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
35311
35258
  }
35312
35259
 
35313
- @Query(() => RunMJArtifactUseViewResult)
35314
- async RunMJArtifactUseViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35260
+ @Query(() => RunMJAPIKeyApplicationViewResult)
35261
+ async RunMJAPIKeyApplicationViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35315
35262
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35316
35263
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
35317
35264
  }
35318
35265
 
35319
- @Query(() => RunMJArtifactUseViewResult)
35320
- async RunMJArtifactUseDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35266
+ @Query(() => RunMJAPIKeyApplicationViewResult)
35267
+ async RunMJAPIKeyApplicationDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35321
35268
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35322
- input.EntityName = 'MJ: Artifact Uses';
35269
+ input.EntityName = 'MJ: API Key Applications';
35323
35270
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
35324
35271
  }
35325
- @Query(() => MJArtifactUse_, { nullable: true })
35326
- async MJArtifactUse(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactUse_ | null> {
35327
- this.CheckUserReadPermissions('MJ: Artifact Uses', userPayload);
35272
+ @Query(() => MJAPIKeyApplication_, { nullable: true })
35273
+ async MJAPIKeyApplication(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIKeyApplication_ | null> {
35274
+ this.CheckUserReadPermissions('MJ: API Key Applications', userPayload);
35328
35275
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35329
35276
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35330
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactUses] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Uses', userPayload, EntityPermissionType.Read, 'AND');
35277
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyApplications] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Applications', userPayload, EntityPermissionType.Read, 'AND');
35331
35278
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35332
- const result = await this.MapFieldNamesToCodeNames('MJ: Artifact Uses', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35279
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Key Applications', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35333
35280
  return result;
35334
35281
  }
35335
35282
 
35336
- @Mutation(() => MJArtifactUse_)
35337
- async CreateMJArtifactUse(
35338
- @Arg('input', () => CreateMJArtifactUseInput) input: CreateMJArtifactUseInput,
35283
+ @Mutation(() => MJAPIKeyApplication_)
35284
+ async CreateMJAPIKeyApplication(
35285
+ @Arg('input', () => CreateMJAPIKeyApplicationInput) input: CreateMJAPIKeyApplicationInput,
35339
35286
  @Ctx() { providers, userPayload }: AppContext,
35340
35287
  @PubSub() pubSub: PubSubEngine
35341
35288
  ) {
35342
35289
  const provider = GetReadWriteProvider(providers);
35343
- return this.CreateRecord('MJ: Artifact Uses', input, provider, userPayload, pubSub)
35290
+ return this.CreateRecord('MJ: API Key Applications', input, provider, userPayload, pubSub)
35344
35291
  }
35345
35292
 
35346
- @Mutation(() => MJArtifactUse_)
35347
- async UpdateMJArtifactUse(
35348
- @Arg('input', () => UpdateMJArtifactUseInput) input: UpdateMJArtifactUseInput,
35293
+ @Mutation(() => MJAPIKeyApplication_)
35294
+ async UpdateMJAPIKeyApplication(
35295
+ @Arg('input', () => UpdateMJAPIKeyApplicationInput) input: UpdateMJAPIKeyApplicationInput,
35349
35296
  @Ctx() { providers, userPayload }: AppContext,
35350
35297
  @PubSub() pubSub: PubSubEngine
35351
35298
  ) {
35352
35299
  const provider = GetReadWriteProvider(providers);
35353
- return this.UpdateRecord('MJ: Artifact Uses', input, provider, userPayload, pubSub);
35300
+ return this.UpdateRecord('MJ: API Key Applications', input, provider, userPayload, pubSub);
35354
35301
  }
35355
35302
 
35356
- @Mutation(() => MJArtifactUse_)
35357
- async DeleteMJArtifactUse(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35303
+ @Mutation(() => MJAPIKeyApplication_)
35304
+ async DeleteMJAPIKeyApplication(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35358
35305
  const provider = GetReadWriteProvider(providers);
35359
35306
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
35360
- return this.DeleteRecord('MJ: Artifact Uses', key, options, provider, userPayload, pubSub);
35307
+ return this.DeleteRecord('MJ: API Key Applications', key, options, provider, userPayload, pubSub);
35361
35308
  }
35362
35309
 
35363
35310
  }
35364
35311
 
35365
35312
  //****************************************************************************
35366
- // ENTITY CLASS for MJ: Artifact Version Attributes
35313
+ // ENTITY CLASS for MJ: API Key Scopes
35367
35314
  //****************************************************************************
35368
- @ObjectType({ description: `Stores extracted attribute values from artifact content based on ArtifactType ExtractRules. Prevents re-running extraction logic on every access.` })
35369
- export class MJArtifactVersionAttribute_ {
35315
+ @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.` })
35316
+ export class MJAPIKeyScope_ {
35370
35317
  @Field()
35371
35318
  @MaxLength(16)
35372
35319
  ID: string;
35373
35320
 
35374
- @Field({description: `The artifact version this attribute belongs to`})
35321
+ @Field()
35375
35322
  @MaxLength(16)
35376
- ArtifactVersionID: string;
35377
-
35378
- @Field({description: `Name of the extracted attribute (matches ExtractRule.name)`})
35379
- @MaxLength(510)
35380
- Name: string;
35381
-
35382
- @Field({description: `TypeScript type definition of the value (e.g., 'string', 'number', 'Date', 'Array<{x: number, y: string}>')`})
35383
- @MaxLength(1000)
35384
- Type: string;
35385
-
35386
- @Field({nullable: true, description: `JSON-serialized extracted value`})
35387
- Value?: string;
35323
+ APIKeyID: string;
35388
35324
 
35389
- @Field({nullable: true, description: `Maps this attribute to a standard property for UI rendering: 'name', 'description', 'displayMarkdown', 'displayHtml', or NULL for custom attributes`})
35390
- @MaxLength(100)
35391
- StandardProperty?: string;
35325
+ @Field()
35326
+ @MaxLength(16)
35327
+ ScopeID: string;
35392
35328
 
35393
35329
  @Field()
35394
35330
  @MaxLength(10)
@@ -35398,71 +35334,95 @@ export class MJArtifactVersionAttribute_ {
35398
35334
  @MaxLength(10)
35399
35335
  _mj__UpdatedAt: Date;
35400
35336
 
35401
- @Field({nullable: true})
35337
+ @Field({nullable: true, description: `Glob pattern for matching resources (e.g., Users,Accounts or Skip* or *). NULL means match all resources under this scope.`})
35338
+ @MaxLength(1500)
35339
+ ResourcePattern?: string;
35340
+
35341
+ @Field({description: `How to interpret the pattern: Include (grant if matches) or Exclude (grant if does NOT match).`})
35342
+ @MaxLength(40)
35343
+ PatternType: string;
35344
+
35345
+ @Field(() => Boolean, {description: `If true, this rule explicitly DENIES access. Deny rules trump allow rules at the same priority level.`})
35346
+ IsDeny: boolean;
35347
+
35348
+ @Field(() => Int, {description: `Rule evaluation order. Higher priority rules are evaluated first. Within same priority, deny rules are evaluated before allow rules.`})
35349
+ Priority: number;
35350
+
35351
+ @Field()
35402
35352
  @MaxLength(510)
35403
- ArtifactVersion?: string;
35353
+ APIKey: string;
35354
+
35355
+ @Field()
35356
+ @MaxLength(200)
35357
+ Scope: string;
35404
35358
 
35405
35359
  }
35406
35360
 
35407
35361
  //****************************************************************************
35408
- // INPUT TYPE for MJ: Artifact Version Attributes
35362
+ // INPUT TYPE for MJ: API Key Scopes
35409
35363
  //****************************************************************************
35410
35364
  @InputType()
35411
- export class CreateMJArtifactVersionAttributeInput {
35365
+ export class CreateMJAPIKeyScopeInput {
35412
35366
  @Field({ nullable: true })
35413
35367
  ID?: string;
35414
35368
 
35415
35369
  @Field({ nullable: true })
35416
- ArtifactVersionID?: string;
35370
+ APIKeyID?: string;
35417
35371
 
35418
35372
  @Field({ nullable: true })
35419
- Name?: string;
35373
+ ScopeID?: string;
35420
35374
 
35421
35375
  @Field({ nullable: true })
35422
- Type?: string;
35376
+ ResourcePattern: string | null;
35423
35377
 
35424
35378
  @Field({ nullable: true })
35425
- Value: string | null;
35379
+ PatternType?: string;
35426
35380
 
35427
- @Field({ nullable: true })
35428
- StandardProperty: string | null;
35381
+ @Field(() => Boolean, { nullable: true })
35382
+ IsDeny?: boolean;
35383
+
35384
+ @Field(() => Int, { nullable: true })
35385
+ Priority?: number;
35429
35386
  }
35430
35387
 
35431
35388
 
35432
35389
  //****************************************************************************
35433
- // INPUT TYPE for MJ: Artifact Version Attributes
35390
+ // INPUT TYPE for MJ: API Key Scopes
35434
35391
  //****************************************************************************
35435
35392
  @InputType()
35436
- export class UpdateMJArtifactVersionAttributeInput {
35393
+ export class UpdateMJAPIKeyScopeInput {
35437
35394
  @Field()
35438
35395
  ID: string;
35439
35396
 
35440
35397
  @Field({ nullable: true })
35441
- ArtifactVersionID?: string;
35398
+ APIKeyID?: string;
35442
35399
 
35443
35400
  @Field({ nullable: true })
35444
- Name?: string;
35401
+ ScopeID?: string;
35445
35402
 
35446
35403
  @Field({ nullable: true })
35447
- Type?: string;
35404
+ ResourcePattern?: string | null;
35448
35405
 
35449
35406
  @Field({ nullable: true })
35450
- Value?: string | null;
35407
+ PatternType?: string;
35451
35408
 
35452
- @Field({ nullable: true })
35453
- StandardProperty?: string | null;
35409
+ @Field(() => Boolean, { nullable: true })
35410
+ IsDeny?: boolean;
35411
+
35412
+ @Field(() => Int, { nullable: true })
35413
+ Priority?: number;
35454
35414
 
35455
35415
  @Field(() => [KeyValuePairInput], { nullable: true })
35456
35416
  OldValues___?: KeyValuePairInput[];
35457
35417
  }
35458
35418
 
35459
35419
  //****************************************************************************
35460
- // RESOLVER for MJ: Artifact Version Attributes
35420
+ // RESOLVER for MJ: API Key Scopes
35461
35421
  //****************************************************************************
35462
35422
  @ObjectType()
35463
- export class RunMJArtifactVersionAttributeViewResult {
35464
- @Field(() => [MJArtifactVersionAttribute_])
35465
- Results: MJArtifactVersionAttribute_[];
35423
+ export class RunMJAPIKeyScopeViewResult {
35424
+ @Field(() => [MJAPIKeyScope_])
35425
+ Results: MJAPIKeyScope_[];
35466
35426
 
35467
35427
  @Field(() => String, {nullable: true})
35468
35428
  UserViewRunID?: string;
@@ -35483,94 +35443,104 @@ export class RunMJArtifactVersionAttributeViewResult {
35483
35443
  Success: boolean;
35484
35444
  }
35485
35445
 
35486
- @Resolver(MJArtifactVersionAttribute_)
35487
- export class MJArtifactVersionAttributeResolver extends ResolverBase {
35488
- @Query(() => RunMJArtifactVersionAttributeViewResult)
35489
- async RunMJArtifactVersionAttributeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35446
+ @Resolver(MJAPIKeyScope_)
35447
+ export class MJAPIKeyScopeResolver extends ResolverBase {
35448
+ @Query(() => RunMJAPIKeyScopeViewResult)
35449
+ async RunMJAPIKeyScopeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35490
35450
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35491
35451
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
35492
35452
  }
35493
35453
 
35494
- @Query(() => RunMJArtifactVersionAttributeViewResult)
35495
- async RunMJArtifactVersionAttributeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35454
+ @Query(() => RunMJAPIKeyScopeViewResult)
35455
+ async RunMJAPIKeyScopeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35496
35456
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35497
35457
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
35498
35458
  }
35499
35459
 
35500
- @Query(() => RunMJArtifactVersionAttributeViewResult)
35501
- async RunMJArtifactVersionAttributeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35460
+ @Query(() => RunMJAPIKeyScopeViewResult)
35461
+ async RunMJAPIKeyScopeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35502
35462
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35503
- input.EntityName = 'MJ: Artifact Version Attributes';
35463
+ input.EntityName = 'MJ: API Key Scopes';
35504
35464
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
35505
35465
  }
35506
- @Query(() => MJArtifactVersionAttribute_, { nullable: true })
35507
- async MJArtifactVersionAttribute(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactVersionAttribute_ | null> {
35508
- this.CheckUserReadPermissions('MJ: Artifact Version Attributes', userPayload);
35466
+ @Query(() => MJAPIKeyScope_, { nullable: true })
35467
+ async MJAPIKeyScope(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIKeyScope_ | null> {
35468
+ this.CheckUserReadPermissions('MJ: API Key Scopes', userPayload);
35509
35469
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35510
35470
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35511
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactVersionAttributes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Version Attributes', userPayload, EntityPermissionType.Read, 'AND');
35471
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyScopes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Scopes', userPayload, EntityPermissionType.Read, 'AND');
35512
35472
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35513
- const result = await this.MapFieldNamesToCodeNames('MJ: Artifact Version Attributes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35473
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Key Scopes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35514
35474
  return result;
35515
35475
  }
35516
35476
 
35517
- @Mutation(() => MJArtifactVersionAttribute_)
35518
- async CreateMJArtifactVersionAttribute(
35519
- @Arg('input', () => CreateMJArtifactVersionAttributeInput) input: CreateMJArtifactVersionAttributeInput,
35477
+ @Mutation(() => MJAPIKeyScope_)
35478
+ async CreateMJAPIKeyScope(
35479
+ @Arg('input', () => CreateMJAPIKeyScopeInput) input: CreateMJAPIKeyScopeInput,
35520
35480
  @Ctx() { providers, userPayload }: AppContext,
35521
35481
  @PubSub() pubSub: PubSubEngine
35522
35482
  ) {
35523
35483
  const provider = GetReadWriteProvider(providers);
35524
- return this.CreateRecord('MJ: Artifact Version Attributes', input, provider, userPayload, pubSub)
35484
+ return this.CreateRecord('MJ: API Key Scopes', input, provider, userPayload, pubSub)
35525
35485
  }
35526
35486
 
35527
- @Mutation(() => MJArtifactVersionAttribute_)
35528
- async UpdateMJArtifactVersionAttribute(
35529
- @Arg('input', () => UpdateMJArtifactVersionAttributeInput) input: UpdateMJArtifactVersionAttributeInput,
35487
+ @Mutation(() => MJAPIKeyScope_)
35488
+ async UpdateMJAPIKeyScope(
35489
+ @Arg('input', () => UpdateMJAPIKeyScopeInput) input: UpdateMJAPIKeyScopeInput,
35530
35490
  @Ctx() { providers, userPayload }: AppContext,
35531
35491
  @PubSub() pubSub: PubSubEngine
35532
35492
  ) {
35533
35493
  const provider = GetReadWriteProvider(providers);
35534
- return this.UpdateRecord('MJ: Artifact Version Attributes', input, provider, userPayload, pubSub);
35494
+ return this.UpdateRecord('MJ: API Key Scopes', input, provider, userPayload, pubSub);
35535
35495
  }
35536
35496
 
35537
- @Mutation(() => MJArtifactVersionAttribute_)
35538
- async DeleteMJArtifactVersionAttribute(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35497
+ @Mutation(() => MJAPIKeyScope_)
35498
+ async DeleteMJAPIKeyScope(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35539
35499
  const provider = GetReadWriteProvider(providers);
35540
35500
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
35541
- return this.DeleteRecord('MJ: Artifact Version Attributes', key, options, provider, userPayload, pubSub);
35501
+ return this.DeleteRecord('MJ: API Key Scopes', key, options, provider, userPayload, pubSub);
35542
35502
  }
35543
35503
 
35544
35504
  }
35545
35505
 
35546
35506
  //****************************************************************************
35547
- // ENTITY CLASS for MJ: Artifact Versions
35507
+ // ENTITY CLASS for MJ: API Key Usage Logs
35548
35508
  //****************************************************************************
35549
- @ObjectType({ description: `Version history for artifacts, tracking all changes over time` })
35550
- export class MJArtifactVersion_ {
35509
+ @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.` })
35510
+ export class MJAPIKeyUsageLog_ {
35551
35511
  @Field()
35552
35512
  @MaxLength(16)
35553
35513
  ID: string;
35554
35514
 
35555
35515
  @Field()
35556
35516
  @MaxLength(16)
35557
- ArtifactID: string;
35517
+ APIKeyID: string;
35558
35518
 
35559
- @Field(() => Int, {description: `Sequential version number for this artifact`})
35560
- VersionNumber: number;
35519
+ @Field({description: `The API endpoint path that was accessed (e.g., /mcp, /graphql, /api/v1/entities).`})
35520
+ @MaxLength(1000)
35521
+ Endpoint: string;
35561
35522
 
35562
- @Field({nullable: true, description: `The content of the artifact at this version`})
35563
- Content?: string;
35523
+ @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).`})
35524
+ @MaxLength(510)
35525
+ Operation?: string;
35564
35526
 
35565
- @Field({nullable: true, description: `JSON configuration for this version`})
35566
- Configuration?: string;
35527
+ @Field({description: `HTTP method used for the request (GET, POST, PUT, DELETE, etc.).`})
35528
+ @MaxLength(20)
35529
+ Method: string;
35567
35530
 
35568
- @Field({nullable: true, description: `User comments specific to this version`})
35569
- Comments?: string;
35531
+ @Field(() => Int, {description: `HTTP response status code returned to the client (e.g., 200 for success, 401 for unauthorized, 500 for server error).`})
35532
+ StatusCode: number;
35570
35533
 
35571
- @Field()
35572
- @MaxLength(16)
35573
- UserID: string;
35534
+ @Field(() => Int, {nullable: true, description: `Total time in milliseconds to process the request and return a response. Useful for performance monitoring.`})
35535
+ ResponseTimeMs?: number;
35536
+
35537
+ @Field({nullable: true, description: `Client IP address that made the request. Supports both IPv4 and IPv6 addresses (up to 45 characters).`})
35538
+ @MaxLength(90)
35539
+ IPAddress?: string;
35540
+
35541
+ @Field({nullable: true, description: `User-Agent header from the HTTP request, identifying the client application or library making the API call.`})
35542
+ @MaxLength(1000)
35543
+ UserAgent?: string;
35574
35544
 
35575
35545
  @Field()
35576
35546
  @MaxLength(10)
@@ -35580,26 +35550,1629 @@ export class MJArtifactVersion_ {
35580
35550
  @MaxLength(10)
35581
35551
  _mj__UpdatedAt: Date;
35582
35552
 
35583
- @Field({nullable: true, description: `SHA-256 hash of the Content field for duplicate detection and version comparison`})
35553
+ @Field({nullable: true, description: `The application through which this request was made (MJAPI, MCPServer, etc.).`})
35554
+ @MaxLength(16)
35555
+ ApplicationID?: string;
35556
+
35557
+ @Field({nullable: true, description: `The specific resource that was requested (e.g., entity name, agent name, query name).`})
35584
35558
  @MaxLength(1000)
35585
- ContentHash?: string;
35559
+ RequestedResource?: string;
35586
35560
 
35587
- @Field({nullable: true, description: `Name of this artifact version. Can differ from Artifact.Name as it may evolve with versions.`})
35588
- @MaxLength(510)
35589
- Name?: string;
35561
+ @Field({nullable: true, description: `JSON array containing detailed evaluation of each scope rule checked during authorization.`})
35562
+ ScopesEvaluated?: string;
35590
35563
 
35591
- @Field({nullable: true, description: `Description of this artifact version. Can differ from Artifact.Description as it may evolve with versions.`})
35592
- Description?: string;
35564
+ @Field({description: `Final authorization result: Allowed, Denied, or NoScopesRequired (for operations that do not require scope checks).`})
35565
+ @MaxLength(40)
35566
+ AuthorizationResult: string;
35567
+
35568
+ @Field({nullable: true, description: `When authorization is denied, explains why (e.g., app ceiling blocked, no matching key scope, explicit deny rule).`})
35569
+ @MaxLength(1000)
35570
+ DeniedReason?: string;
35593
35571
 
35594
35572
  @Field()
35595
35573
  @MaxLength(510)
35596
- Artifact: string;
35574
+ APIKey: string;
35597
35575
 
35598
- @Field()
35576
+ @Field({nullable: true})
35599
35577
  @MaxLength(200)
35600
- User: string;
35578
+ Application?: string;
35601
35579
 
35602
- @Field(() => [MJArtifactVersionAttribute_])
35580
+ }
35581
+
35582
+ //****************************************************************************
35583
+ // INPUT TYPE for MJ: API Key Usage Logs
35584
+ //****************************************************************************
35585
+ @InputType()
35586
+ export class CreateMJAPIKeyUsageLogInput {
35587
+ @Field({ nullable: true })
35588
+ ID?: string;
35589
+
35590
+ @Field({ nullable: true })
35591
+ APIKeyID?: string;
35592
+
35593
+ @Field({ nullable: true })
35594
+ Endpoint?: string;
35595
+
35596
+ @Field({ nullable: true })
35597
+ Operation: string | null;
35598
+
35599
+ @Field({ nullable: true })
35600
+ Method?: string;
35601
+
35602
+ @Field(() => Int, { nullable: true })
35603
+ StatusCode?: number;
35604
+
35605
+ @Field(() => Int, { nullable: true })
35606
+ ResponseTimeMs: number | null;
35607
+
35608
+ @Field({ nullable: true })
35609
+ IPAddress: string | null;
35610
+
35611
+ @Field({ nullable: true })
35612
+ UserAgent: string | null;
35613
+
35614
+ @Field({ nullable: true })
35615
+ ApplicationID: string | null;
35616
+
35617
+ @Field({ nullable: true })
35618
+ RequestedResource: string | null;
35619
+
35620
+ @Field({ nullable: true })
35621
+ ScopesEvaluated: string | null;
35622
+
35623
+ @Field({ nullable: true })
35624
+ AuthorizationResult?: string;
35625
+
35626
+ @Field({ nullable: true })
35627
+ DeniedReason: string | null;
35628
+ }
35629
+
35630
+
35631
+ //****************************************************************************
35632
+ // INPUT TYPE for MJ: API Key Usage Logs
35633
+ //****************************************************************************
35634
+ @InputType()
35635
+ export class UpdateMJAPIKeyUsageLogInput {
35636
+ @Field()
35637
+ ID: string;
35638
+
35639
+ @Field({ nullable: true })
35640
+ APIKeyID?: string;
35641
+
35642
+ @Field({ nullable: true })
35643
+ Endpoint?: string;
35644
+
35645
+ @Field({ nullable: true })
35646
+ Operation?: string | null;
35647
+
35648
+ @Field({ nullable: true })
35649
+ Method?: string;
35650
+
35651
+ @Field(() => Int, { nullable: true })
35652
+ StatusCode?: number;
35653
+
35654
+ @Field(() => Int, { nullable: true })
35655
+ ResponseTimeMs?: number | null;
35656
+
35657
+ @Field({ nullable: true })
35658
+ IPAddress?: string | null;
35659
+
35660
+ @Field({ nullable: true })
35661
+ UserAgent?: string | null;
35662
+
35663
+ @Field({ nullable: true })
35664
+ ApplicationID?: string | null;
35665
+
35666
+ @Field({ nullable: true })
35667
+ RequestedResource?: string | null;
35668
+
35669
+ @Field({ nullable: true })
35670
+ ScopesEvaluated?: string | null;
35671
+
35672
+ @Field({ nullable: true })
35673
+ AuthorizationResult?: string;
35674
+
35675
+ @Field({ nullable: true })
35676
+ DeniedReason?: string | null;
35677
+
35678
+ @Field(() => [KeyValuePairInput], { nullable: true })
35679
+ OldValues___?: KeyValuePairInput[];
35680
+ }
35681
+
35682
+ //****************************************************************************
35683
+ // RESOLVER for MJ: API Key Usage Logs
35684
+ //****************************************************************************
35685
+ @ObjectType()
35686
+ export class RunMJAPIKeyUsageLogViewResult {
35687
+ @Field(() => [MJAPIKeyUsageLog_])
35688
+ Results: MJAPIKeyUsageLog_[];
35689
+
35690
+ @Field(() => String, {nullable: true})
35691
+ UserViewRunID?: string;
35692
+
35693
+ @Field(() => Int, {nullable: true})
35694
+ RowCount: number;
35695
+
35696
+ @Field(() => Int, {nullable: true})
35697
+ TotalRowCount: number;
35698
+
35699
+ @Field(() => Int, {nullable: true})
35700
+ ExecutionTime: number;
35701
+
35702
+ @Field({nullable: true})
35703
+ ErrorMessage?: string;
35704
+
35705
+ @Field(() => Boolean, {nullable: false})
35706
+ Success: boolean;
35707
+ }
35708
+
35709
+ @Resolver(MJAPIKeyUsageLog_)
35710
+ export class MJAPIKeyUsageLogResolver extends ResolverBase {
35711
+ @Query(() => RunMJAPIKeyUsageLogViewResult)
35712
+ async RunMJAPIKeyUsageLogViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35713
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35714
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
35715
+ }
35716
+
35717
+ @Query(() => RunMJAPIKeyUsageLogViewResult)
35718
+ async RunMJAPIKeyUsageLogViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35719
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35720
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
35721
+ }
35722
+
35723
+ @Query(() => RunMJAPIKeyUsageLogViewResult)
35724
+ async RunMJAPIKeyUsageLogDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35725
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35726
+ input.EntityName = 'MJ: API Key Usage Logs';
35727
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
35728
+ }
35729
+ @Query(() => MJAPIKeyUsageLog_, { nullable: true })
35730
+ async MJAPIKeyUsageLog(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIKeyUsageLog_ | null> {
35731
+ this.CheckUserReadPermissions('MJ: API Key Usage Logs', userPayload);
35732
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35733
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35734
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyUsageLogs] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Usage Logs', userPayload, EntityPermissionType.Read, 'AND');
35735
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35736
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Key Usage Logs', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35737
+ return result;
35738
+ }
35739
+
35740
+ @Mutation(() => MJAPIKeyUsageLog_)
35741
+ async CreateMJAPIKeyUsageLog(
35742
+ @Arg('input', () => CreateMJAPIKeyUsageLogInput) input: CreateMJAPIKeyUsageLogInput,
35743
+ @Ctx() { providers, userPayload }: AppContext,
35744
+ @PubSub() pubSub: PubSubEngine
35745
+ ) {
35746
+ const provider = GetReadWriteProvider(providers);
35747
+ return this.CreateRecord('MJ: API Key Usage Logs', input, provider, userPayload, pubSub)
35748
+ }
35749
+
35750
+ @Mutation(() => MJAPIKeyUsageLog_)
35751
+ async UpdateMJAPIKeyUsageLog(
35752
+ @Arg('input', () => UpdateMJAPIKeyUsageLogInput) input: UpdateMJAPIKeyUsageLogInput,
35753
+ @Ctx() { providers, userPayload }: AppContext,
35754
+ @PubSub() pubSub: PubSubEngine
35755
+ ) {
35756
+ const provider = GetReadWriteProvider(providers);
35757
+ return this.UpdateRecord('MJ: API Key Usage Logs', input, provider, userPayload, pubSub);
35758
+ }
35759
+
35760
+ @Mutation(() => MJAPIKeyUsageLog_)
35761
+ async DeleteMJAPIKeyUsageLog(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35762
+ const provider = GetReadWriteProvider(providers);
35763
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
35764
+ return this.DeleteRecord('MJ: API Key Usage Logs', key, options, provider, userPayload, pubSub);
35765
+ }
35766
+
35767
+ }
35768
+
35769
+ //****************************************************************************
35770
+ // ENTITY CLASS for MJ: API Keys
35771
+ //****************************************************************************
35772
+ @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.` })
35773
+ export class MJAPIKey_ {
35774
+ @Field()
35775
+ @MaxLength(16)
35776
+ ID: string;
35777
+
35778
+ @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.`})
35779
+ @MaxLength(128)
35780
+ Hash: string;
35781
+
35782
+ @Field()
35783
+ @MaxLength(16)
35784
+ UserID: string;
35785
+
35786
+ @Field({description: `User-friendly name for identifying the key purpose (e.g., Cowork Integration, CI/CD Pipeline, Mobile App).`})
35787
+ @MaxLength(510)
35788
+ Label: string;
35789
+
35790
+ @Field({nullable: true, description: `Optional detailed description of the key's intended use, integration details, or other notes.`})
35791
+ @MaxLength(2000)
35792
+ Description?: string;
35793
+
35794
+ @Field({description: `Current lifecycle status of the key. Active keys can be used for authentication; Revoked keys are permanently disabled.`})
35795
+ @MaxLength(40)
35796
+ Status: string;
35797
+
35798
+ @Field({nullable: true, description: `Optional expiration timestamp. Keys with NULL expiration never expire. Expired keys are rejected during authentication.`})
35799
+ @MaxLength(10)
35800
+ ExpiresAt?: Date;
35801
+
35802
+ @Field({nullable: true, description: `Timestamp of the most recent successful authentication using this key. Updated on each valid API request.`})
35803
+ @MaxLength(10)
35804
+ LastUsedAt?: Date;
35805
+
35806
+ @Field()
35807
+ @MaxLength(16)
35808
+ CreatedByUserID: string;
35809
+
35810
+ @Field()
35811
+ @MaxLength(10)
35812
+ _mj__CreatedAt: Date;
35813
+
35814
+ @Field()
35815
+ @MaxLength(10)
35816
+ _mj__UpdatedAt: Date;
35817
+
35818
+ @Field()
35819
+ @MaxLength(200)
35820
+ User: string;
35821
+
35822
+ @Field()
35823
+ @MaxLength(200)
35824
+ CreatedByUser: string;
35825
+
35826
+ @Field(() => [MJAPIKeyUsageLog_])
35827
+ MJ_APIKeyUsageLogs_APIKeyIDArray: MJAPIKeyUsageLog_[]; // Link to MJ_APIKeyUsageLogs
35828
+
35829
+ @Field(() => [MJAPIKeyScope_])
35830
+ MJ_APIKeyScopes_APIKeyIDArray: MJAPIKeyScope_[]; // Link to MJ_APIKeyScopes
35831
+
35832
+ @Field(() => [MJAPIKeyApplication_])
35833
+ MJ_APIKeyApplications_APIKeyIDArray: MJAPIKeyApplication_[]; // Link to MJ_APIKeyApplications
35834
+
35835
+ }
35836
+
35837
+ //****************************************************************************
35838
+ // INPUT TYPE for MJ: API Keys
35839
+ //****************************************************************************
35840
+ @InputType()
35841
+ export class CreateMJAPIKeyInput {
35842
+ @Field({ nullable: true })
35843
+ ID?: string;
35844
+
35845
+ @Field({ nullable: true })
35846
+ Hash?: string;
35847
+
35848
+ @Field({ nullable: true })
35849
+ UserID?: string;
35850
+
35851
+ @Field({ nullable: true })
35852
+ Label?: string;
35853
+
35854
+ @Field({ nullable: true })
35855
+ Description: string | null;
35856
+
35857
+ @Field({ nullable: true })
35858
+ Status?: string;
35859
+
35860
+ @Field({ nullable: true })
35861
+ ExpiresAt: Date | null;
35862
+
35863
+ @Field({ nullable: true })
35864
+ LastUsedAt: Date | null;
35865
+
35866
+ @Field({ nullable: true })
35867
+ CreatedByUserID?: string;
35868
+ }
35869
+
35870
+
35871
+ //****************************************************************************
35872
+ // INPUT TYPE for MJ: API Keys
35873
+ //****************************************************************************
35874
+ @InputType()
35875
+ export class UpdateMJAPIKeyInput {
35876
+ @Field()
35877
+ ID: string;
35878
+
35879
+ @Field({ nullable: true })
35880
+ Hash?: string;
35881
+
35882
+ @Field({ nullable: true })
35883
+ UserID?: string;
35884
+
35885
+ @Field({ nullable: true })
35886
+ Label?: string;
35887
+
35888
+ @Field({ nullable: true })
35889
+ Description?: string | null;
35890
+
35891
+ @Field({ nullable: true })
35892
+ Status?: string;
35893
+
35894
+ @Field({ nullable: true })
35895
+ ExpiresAt?: Date | null;
35896
+
35897
+ @Field({ nullable: true })
35898
+ LastUsedAt?: Date | null;
35899
+
35900
+ @Field({ nullable: true })
35901
+ CreatedByUserID?: string;
35902
+
35903
+ @Field(() => [KeyValuePairInput], { nullable: true })
35904
+ OldValues___?: KeyValuePairInput[];
35905
+ }
35906
+
35907
+ //****************************************************************************
35908
+ // RESOLVER for MJ: API Keys
35909
+ //****************************************************************************
35910
+ @ObjectType()
35911
+ export class RunMJAPIKeyViewResult {
35912
+ @Field(() => [MJAPIKey_])
35913
+ Results: MJAPIKey_[];
35914
+
35915
+ @Field(() => String, {nullable: true})
35916
+ UserViewRunID?: string;
35917
+
35918
+ @Field(() => Int, {nullable: true})
35919
+ RowCount: number;
35920
+
35921
+ @Field(() => Int, {nullable: true})
35922
+ TotalRowCount: number;
35923
+
35924
+ @Field(() => Int, {nullable: true})
35925
+ ExecutionTime: number;
35926
+
35927
+ @Field({nullable: true})
35928
+ ErrorMessage?: string;
35929
+
35930
+ @Field(() => Boolean, {nullable: false})
35931
+ Success: boolean;
35932
+ }
35933
+
35934
+ @Resolver(MJAPIKey_)
35935
+ export class MJAPIKeyResolver extends ResolverBase {
35936
+ @Query(() => RunMJAPIKeyViewResult)
35937
+ async RunMJAPIKeyViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35938
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35939
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
35940
+ }
35941
+
35942
+ @Query(() => RunMJAPIKeyViewResult)
35943
+ async RunMJAPIKeyViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35944
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35945
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
35946
+ }
35947
+
35948
+ @Query(() => RunMJAPIKeyViewResult)
35949
+ async RunMJAPIKeyDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
35950
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35951
+ input.EntityName = 'MJ: API Keys';
35952
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
35953
+ }
35954
+ @Query(() => MJAPIKey_, { nullable: true })
35955
+ async MJAPIKey(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIKey_ | null> {
35956
+ this.CheckUserReadPermissions('MJ: API Keys', userPayload);
35957
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35958
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35959
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeys] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Keys', userPayload, EntityPermissionType.Read, 'AND');
35960
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35961
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Keys', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
35962
+ return result;
35963
+ }
35964
+
35965
+ @FieldResolver(() => [MJAPIKeyUsageLog_])
35966
+ async MJ_APIKeyUsageLogs_APIKeyIDArray(@Root() mjapikey_: MJAPIKey_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35967
+ this.CheckUserReadPermissions('MJ: API Key Usage Logs', userPayload);
35968
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35969
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35970
+ 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');
35971
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35972
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Usage Logs', rows, this.GetUserFromPayload(userPayload));
35973
+ return result;
35974
+ }
35975
+
35976
+ @FieldResolver(() => [MJAPIKeyScope_])
35977
+ async MJ_APIKeyScopes_APIKeyIDArray(@Root() mjapikey_: MJAPIKey_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35978
+ this.CheckUserReadPermissions('MJ: API Key Scopes', userPayload);
35979
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35980
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35981
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyScopes] WHERE [APIKeyID]='${mjapikey_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Scopes', userPayload, EntityPermissionType.Read, 'AND');
35982
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35983
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Scopes', rows, this.GetUserFromPayload(userPayload));
35984
+ return result;
35985
+ }
35986
+
35987
+ @FieldResolver(() => [MJAPIKeyApplication_])
35988
+ async MJ_APIKeyApplications_APIKeyIDArray(@Root() mjapikey_: MJAPIKey_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
35989
+ this.CheckUserReadPermissions('MJ: API Key Applications', userPayload);
35990
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
35991
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
35992
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyApplications] WHERE [APIKeyID]='${mjapikey_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Applications', userPayload, EntityPermissionType.Read, 'AND');
35993
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
35994
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Applications', rows, this.GetUserFromPayload(userPayload));
35995
+ return result;
35996
+ }
35997
+
35998
+ @Mutation(() => MJAPIKey_)
35999
+ async CreateMJAPIKey(
36000
+ @Arg('input', () => CreateMJAPIKeyInput) input: CreateMJAPIKeyInput,
36001
+ @Ctx() { providers, userPayload }: AppContext,
36002
+ @PubSub() pubSub: PubSubEngine
36003
+ ) {
36004
+ const provider = GetReadWriteProvider(providers);
36005
+ return this.CreateRecord('MJ: API Keys', input, provider, userPayload, pubSub)
36006
+ }
36007
+
36008
+ @Mutation(() => MJAPIKey_)
36009
+ async UpdateMJAPIKey(
36010
+ @Arg('input', () => UpdateMJAPIKeyInput) input: UpdateMJAPIKeyInput,
36011
+ @Ctx() { providers, userPayload }: AppContext,
36012
+ @PubSub() pubSub: PubSubEngine
36013
+ ) {
36014
+ const provider = GetReadWriteProvider(providers);
36015
+ return this.UpdateRecord('MJ: API Keys', input, provider, userPayload, pubSub);
36016
+ }
36017
+
36018
+ @Mutation(() => MJAPIKey_)
36019
+ async DeleteMJAPIKey(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36020
+ const provider = GetReadWriteProvider(providers);
36021
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
36022
+ return this.DeleteRecord('MJ: API Keys', key, options, provider, userPayload, pubSub);
36023
+ }
36024
+
36025
+ }
36026
+
36027
+ //****************************************************************************
36028
+ // ENTITY CLASS for MJ: API Scopes
36029
+ //****************************************************************************
36030
+ @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.` })
36031
+ export class MJAPIScope_ {
36032
+ @Field()
36033
+ @MaxLength(16)
36034
+ ID: string;
36035
+
36036
+ @Field({description: `Unique scope identifier following the pattern category:permission (e.g., entities:read, agents:execute, admin:*). Supports wildcard (*) for broad permissions.`})
36037
+ @MaxLength(200)
36038
+ Name: string;
36039
+
36040
+ @Field({description: `Grouping category for the scope (e.g., Entities, Agents, Admin). Used for organizing and filtering scopes in the UI.`})
36041
+ @MaxLength(200)
36042
+ Category: string;
36043
+
36044
+ @Field({nullable: true, description: `Human-readable description explaining what permissions this scope grants.`})
36045
+ @MaxLength(1000)
36046
+ Description?: string;
36047
+
36048
+ @Field()
36049
+ @MaxLength(10)
36050
+ _mj__CreatedAt: Date;
36051
+
36052
+ @Field()
36053
+ @MaxLength(10)
36054
+ _mj__UpdatedAt: Date;
36055
+
36056
+ @Field({nullable: true, description: `Reference to parent scope for hierarchical organization. NULL indicates a root-level scope.`})
36057
+ @MaxLength(16)
36058
+ ParentID?: string;
36059
+
36060
+ @Field({description: `Full hierarchical path of the scope (e.g., entity:runview, agent:execute). Used for matching during authorization.`})
36061
+ @MaxLength(1000)
36062
+ FullPath: string;
36063
+
36064
+ @Field({nullable: true, description: `Type of resource this scope applies to (Entity, Agent, Query, Mutation, or NULL for abstract grouping scopes).`})
36065
+ @MaxLength(100)
36066
+ ResourceType?: string;
36067
+
36068
+ @Field(() => Boolean, {description: `Whether this scope is currently active. Inactive scopes are ignored during authorization.`})
36069
+ IsActive: boolean;
36070
+
36071
+ @Field({nullable: true})
36072
+ @MaxLength(200)
36073
+ Parent?: string;
36074
+
36075
+ @Field({nullable: true})
36076
+ @MaxLength(16)
36077
+ RootParentID?: string;
36078
+
36079
+ @Field(() => [MJAPIKeyScope_])
36080
+ MJ_APIKeyScopes_ScopeIDArray: MJAPIKeyScope_[]; // Link to MJ_APIKeyScopes
36081
+
36082
+ @Field(() => [MJAPIApplicationScope_])
36083
+ MJ_APIApplicationScopes_ScopeIDArray: MJAPIApplicationScope_[]; // Link to MJ_APIApplicationScopes
36084
+
36085
+ @Field(() => [MJAPIScope_])
36086
+ MJ_APIScopes_ParentIDArray: MJAPIScope_[]; // Link to MJ_APIScopes
36087
+
36088
+ }
36089
+
36090
+ //****************************************************************************
36091
+ // INPUT TYPE for MJ: API Scopes
36092
+ //****************************************************************************
36093
+ @InputType()
36094
+ export class CreateMJAPIScopeInput {
36095
+ @Field({ nullable: true })
36096
+ ID?: string;
36097
+
36098
+ @Field({ nullable: true })
36099
+ Name?: string;
36100
+
36101
+ @Field({ nullable: true })
36102
+ Category?: string;
36103
+
36104
+ @Field({ nullable: true })
36105
+ Description: string | null;
36106
+
36107
+ @Field({ nullable: true })
36108
+ ParentID: string | null;
36109
+
36110
+ @Field({ nullable: true })
36111
+ FullPath?: string;
36112
+
36113
+ @Field({ nullable: true })
36114
+ ResourceType: string | null;
36115
+
36116
+ @Field(() => Boolean, { nullable: true })
36117
+ IsActive?: boolean;
36118
+ }
36119
+
36120
+
36121
+ //****************************************************************************
36122
+ // INPUT TYPE for MJ: API Scopes
36123
+ //****************************************************************************
36124
+ @InputType()
36125
+ export class UpdateMJAPIScopeInput {
36126
+ @Field()
36127
+ ID: string;
36128
+
36129
+ @Field({ nullable: true })
36130
+ Name?: string;
36131
+
36132
+ @Field({ nullable: true })
36133
+ Category?: string;
36134
+
36135
+ @Field({ nullable: true })
36136
+ Description?: string | null;
36137
+
36138
+ @Field({ nullable: true })
36139
+ ParentID?: string | null;
36140
+
36141
+ @Field({ nullable: true })
36142
+ FullPath?: string;
36143
+
36144
+ @Field({ nullable: true })
36145
+ ResourceType?: string | null;
36146
+
36147
+ @Field(() => Boolean, { nullable: true })
36148
+ IsActive?: boolean;
36149
+
36150
+ @Field(() => [KeyValuePairInput], { nullable: true })
36151
+ OldValues___?: KeyValuePairInput[];
36152
+ }
36153
+
36154
+ //****************************************************************************
36155
+ // RESOLVER for MJ: API Scopes
36156
+ //****************************************************************************
36157
+ @ObjectType()
36158
+ export class RunMJAPIScopeViewResult {
36159
+ @Field(() => [MJAPIScope_])
36160
+ Results: MJAPIScope_[];
36161
+
36162
+ @Field(() => String, {nullable: true})
36163
+ UserViewRunID?: string;
36164
+
36165
+ @Field(() => Int, {nullable: true})
36166
+ RowCount: number;
36167
+
36168
+ @Field(() => Int, {nullable: true})
36169
+ TotalRowCount: number;
36170
+
36171
+ @Field(() => Int, {nullable: true})
36172
+ ExecutionTime: number;
36173
+
36174
+ @Field({nullable: true})
36175
+ ErrorMessage?: string;
36176
+
36177
+ @Field(() => Boolean, {nullable: false})
36178
+ Success: boolean;
36179
+ }
36180
+
36181
+ @Resolver(MJAPIScope_)
36182
+ export class MJAPIScopeResolver extends ResolverBase {
36183
+ @Query(() => RunMJAPIScopeViewResult)
36184
+ async RunMJAPIScopeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36185
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36186
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
36187
+ }
36188
+
36189
+ @Query(() => RunMJAPIScopeViewResult)
36190
+ async RunMJAPIScopeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36191
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36192
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
36193
+ }
36194
+
36195
+ @Query(() => RunMJAPIScopeViewResult)
36196
+ async RunMJAPIScopeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36197
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36198
+ input.EntityName = 'MJ: API Scopes';
36199
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
36200
+ }
36201
+ @Query(() => MJAPIScope_, { nullable: true })
36202
+ async MJAPIScope(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAPIScope_ | null> {
36203
+ this.CheckUserReadPermissions('MJ: API Scopes', userPayload);
36204
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36205
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36206
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIScopes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Scopes', userPayload, EntityPermissionType.Read, 'AND');
36207
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36208
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Scopes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
36209
+ return result;
36210
+ }
36211
+
36212
+ @FieldResolver(() => [MJAPIKeyScope_])
36213
+ async MJ_APIKeyScopes_ScopeIDArray(@Root() mjapiscope_: MJAPIScope_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
36214
+ this.CheckUserReadPermissions('MJ: API Key Scopes', userPayload);
36215
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36216
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36217
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyScopes] WHERE [ScopeID]='${mjapiscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Scopes', userPayload, EntityPermissionType.Read, 'AND');
36218
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36219
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Scopes', rows, this.GetUserFromPayload(userPayload));
36220
+ return result;
36221
+ }
36222
+
36223
+ @FieldResolver(() => [MJAPIApplicationScope_])
36224
+ async MJ_APIApplicationScopes_ScopeIDArray(@Root() mjapiscope_: MJAPIScope_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
36225
+ this.CheckUserReadPermissions('MJ: API Application Scopes', userPayload);
36226
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36227
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36228
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIApplicationScopes] WHERE [ScopeID]='${mjapiscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Application Scopes', userPayload, EntityPermissionType.Read, 'AND');
36229
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36230
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Application Scopes', rows, this.GetUserFromPayload(userPayload));
36231
+ return result;
36232
+ }
36233
+
36234
+ @FieldResolver(() => [MJAPIScope_])
36235
+ async MJ_APIScopes_ParentIDArray(@Root() mjapiscope_: MJAPIScope_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
36236
+ this.CheckUserReadPermissions('MJ: API Scopes', userPayload);
36237
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36238
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36239
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIScopes] WHERE [ParentID]='${mjapiscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Scopes', userPayload, EntityPermissionType.Read, 'AND');
36240
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36241
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Scopes', rows, this.GetUserFromPayload(userPayload));
36242
+ return result;
36243
+ }
36244
+
36245
+ @Mutation(() => MJAPIScope_)
36246
+ async CreateMJAPIScope(
36247
+ @Arg('input', () => CreateMJAPIScopeInput) input: CreateMJAPIScopeInput,
36248
+ @Ctx() { providers, userPayload }: AppContext,
36249
+ @PubSub() pubSub: PubSubEngine
36250
+ ) {
36251
+ const provider = GetReadWriteProvider(providers);
36252
+ return this.CreateRecord('MJ: API Scopes', input, provider, userPayload, pubSub)
36253
+ }
36254
+
36255
+ @Mutation(() => MJAPIScope_)
36256
+ async UpdateMJAPIScope(
36257
+ @Arg('input', () => UpdateMJAPIScopeInput) input: UpdateMJAPIScopeInput,
36258
+ @Ctx() { providers, userPayload }: AppContext,
36259
+ @PubSub() pubSub: PubSubEngine
36260
+ ) {
36261
+ const provider = GetReadWriteProvider(providers);
36262
+ return this.UpdateRecord('MJ: API Scopes', input, provider, userPayload, pubSub);
36263
+ }
36264
+
36265
+ @Mutation(() => MJAPIScope_)
36266
+ async DeleteMJAPIScope(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36267
+ const provider = GetReadWriteProvider(providers);
36268
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
36269
+ return this.DeleteRecord('MJ: API Scopes', key, options, provider, userPayload, pubSub);
36270
+ }
36271
+
36272
+ }
36273
+
36274
+ //****************************************************************************
36275
+ // ENTITY CLASS for MJ: Artifact Permissions
36276
+ //****************************************************************************
36277
+ @ObjectType({ description: `Manages user permissions for artifacts with granular access control (Read, Edit, Delete, Share)` })
36278
+ export class MJArtifactPermission_ {
36279
+ @Field()
36280
+ @MaxLength(16)
36281
+ ID: string;
36282
+
36283
+ @Field()
36284
+ @MaxLength(16)
36285
+ ArtifactID: string;
36286
+
36287
+ @Field()
36288
+ @MaxLength(16)
36289
+ UserID: string;
36290
+
36291
+ @Field(() => Boolean, {description: `Whether the user can view/read the artifact`})
36292
+ CanRead: boolean;
36293
+
36294
+ @Field(() => Boolean, {description: `Whether the user can modify the artifact or create new versions`})
36295
+ CanEdit: boolean;
36296
+
36297
+ @Field(() => Boolean, {description: `Whether the user can delete the artifact`})
36298
+ CanDelete: boolean;
36299
+
36300
+ @Field(() => Boolean, {description: `Whether the user can share the artifact with other users`})
36301
+ CanShare: boolean;
36302
+
36303
+ @Field({nullable: true, description: `Foreign key to the User who shared this artifact (if shared)`})
36304
+ @MaxLength(16)
36305
+ SharedByUserID?: string;
36306
+
36307
+ @Field()
36308
+ @MaxLength(10)
36309
+ _mj__CreatedAt: Date;
36310
+
36311
+ @Field()
36312
+ @MaxLength(10)
36313
+ _mj__UpdatedAt: Date;
36314
+
36315
+ @Field()
36316
+ @MaxLength(510)
36317
+ Artifact: string;
36318
+
36319
+ @Field()
36320
+ @MaxLength(200)
36321
+ User: string;
36322
+
36323
+ @Field({nullable: true})
36324
+ @MaxLength(200)
36325
+ SharedByUser?: string;
36326
+
36327
+ }
36328
+
36329
+ //****************************************************************************
36330
+ // INPUT TYPE for MJ: Artifact Permissions
36331
+ //****************************************************************************
36332
+ @InputType()
36333
+ export class CreateMJArtifactPermissionInput {
36334
+ @Field({ nullable: true })
36335
+ ID?: string;
36336
+
36337
+ @Field({ nullable: true })
36338
+ ArtifactID?: string;
36339
+
36340
+ @Field({ nullable: true })
36341
+ UserID?: string;
36342
+
36343
+ @Field(() => Boolean, { nullable: true })
36344
+ CanRead?: boolean;
36345
+
36346
+ @Field(() => Boolean, { nullable: true })
36347
+ CanEdit?: boolean;
36348
+
36349
+ @Field(() => Boolean, { nullable: true })
36350
+ CanDelete?: boolean;
36351
+
36352
+ @Field(() => Boolean, { nullable: true })
36353
+ CanShare?: boolean;
36354
+
36355
+ @Field({ nullable: true })
36356
+ SharedByUserID: string | null;
36357
+ }
36358
+
36359
+
36360
+ //****************************************************************************
36361
+ // INPUT TYPE for MJ: Artifact Permissions
36362
+ //****************************************************************************
36363
+ @InputType()
36364
+ export class UpdateMJArtifactPermissionInput {
36365
+ @Field()
36366
+ ID: string;
36367
+
36368
+ @Field({ nullable: true })
36369
+ ArtifactID?: string;
36370
+
36371
+ @Field({ nullable: true })
36372
+ UserID?: string;
36373
+
36374
+ @Field(() => Boolean, { nullable: true })
36375
+ CanRead?: boolean;
36376
+
36377
+ @Field(() => Boolean, { nullable: true })
36378
+ CanEdit?: boolean;
36379
+
36380
+ @Field(() => Boolean, { nullable: true })
36381
+ CanDelete?: boolean;
36382
+
36383
+ @Field(() => Boolean, { nullable: true })
36384
+ CanShare?: boolean;
36385
+
36386
+ @Field({ nullable: true })
36387
+ SharedByUserID?: string | null;
36388
+
36389
+ @Field(() => [KeyValuePairInput], { nullable: true })
36390
+ OldValues___?: KeyValuePairInput[];
36391
+ }
36392
+
36393
+ //****************************************************************************
36394
+ // RESOLVER for MJ: Artifact Permissions
36395
+ //****************************************************************************
36396
+ @ObjectType()
36397
+ export class RunMJArtifactPermissionViewResult {
36398
+ @Field(() => [MJArtifactPermission_])
36399
+ Results: MJArtifactPermission_[];
36400
+
36401
+ @Field(() => String, {nullable: true})
36402
+ UserViewRunID?: string;
36403
+
36404
+ @Field(() => Int, {nullable: true})
36405
+ RowCount: number;
36406
+
36407
+ @Field(() => Int, {nullable: true})
36408
+ TotalRowCount: number;
36409
+
36410
+ @Field(() => Int, {nullable: true})
36411
+ ExecutionTime: number;
36412
+
36413
+ @Field({nullable: true})
36414
+ ErrorMessage?: string;
36415
+
36416
+ @Field(() => Boolean, {nullable: false})
36417
+ Success: boolean;
36418
+ }
36419
+
36420
+ @Resolver(MJArtifactPermission_)
36421
+ export class MJArtifactPermissionResolver extends ResolverBase {
36422
+ @Query(() => RunMJArtifactPermissionViewResult)
36423
+ async RunMJArtifactPermissionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36424
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36425
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
36426
+ }
36427
+
36428
+ @Query(() => RunMJArtifactPermissionViewResult)
36429
+ async RunMJArtifactPermissionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36430
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36431
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
36432
+ }
36433
+
36434
+ @Query(() => RunMJArtifactPermissionViewResult)
36435
+ async RunMJArtifactPermissionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36436
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36437
+ input.EntityName = 'MJ: Artifact Permissions';
36438
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
36439
+ }
36440
+ @Query(() => MJArtifactPermission_, { nullable: true })
36441
+ async MJArtifactPermission(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactPermission_ | null> {
36442
+ this.CheckUserReadPermissions('MJ: Artifact Permissions', userPayload);
36443
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36444
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36445
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactPermissions] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Permissions', userPayload, EntityPermissionType.Read, 'AND');
36446
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36447
+ const result = await this.MapFieldNamesToCodeNames('MJ: Artifact Permissions', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
36448
+ return result;
36449
+ }
36450
+
36451
+ @Mutation(() => MJArtifactPermission_)
36452
+ async CreateMJArtifactPermission(
36453
+ @Arg('input', () => CreateMJArtifactPermissionInput) input: CreateMJArtifactPermissionInput,
36454
+ @Ctx() { providers, userPayload }: AppContext,
36455
+ @PubSub() pubSub: PubSubEngine
36456
+ ) {
36457
+ const provider = GetReadWriteProvider(providers);
36458
+ return this.CreateRecord('MJ: Artifact Permissions', input, provider, userPayload, pubSub)
36459
+ }
36460
+
36461
+ @Mutation(() => MJArtifactPermission_)
36462
+ async UpdateMJArtifactPermission(
36463
+ @Arg('input', () => UpdateMJArtifactPermissionInput) input: UpdateMJArtifactPermissionInput,
36464
+ @Ctx() { providers, userPayload }: AppContext,
36465
+ @PubSub() pubSub: PubSubEngine
36466
+ ) {
36467
+ const provider = GetReadWriteProvider(providers);
36468
+ return this.UpdateRecord('MJ: Artifact Permissions', input, provider, userPayload, pubSub);
36469
+ }
36470
+
36471
+ @Mutation(() => MJArtifactPermission_)
36472
+ async DeleteMJArtifactPermission(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36473
+ const provider = GetReadWriteProvider(providers);
36474
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
36475
+ return this.DeleteRecord('MJ: Artifact Permissions', key, options, provider, userPayload, pubSub);
36476
+ }
36477
+
36478
+ }
36479
+
36480
+ //****************************************************************************
36481
+ // ENTITY CLASS for MJ: Artifact Types
36482
+ //****************************************************************************
36483
+ @ObjectType({ description: `Defines the types of artifacts that can be created within conversations` })
36484
+ export class MJArtifactType_ {
36485
+ @Field()
36486
+ @MaxLength(16)
36487
+ ID: string;
36488
+
36489
+ @Field({description: `Display name of the artifact type`})
36490
+ @MaxLength(200)
36491
+ Name: string;
36492
+
36493
+ @Field({nullable: true, description: `Detailed description of the artifact type`})
36494
+ Description?: string;
36495
+
36496
+ @Field({description: `MIME type or content identifier for this artifact type`})
36497
+ @MaxLength(200)
36498
+ ContentType: string;
36499
+
36500
+ @Field(() => Boolean, {description: `Indicates if this artifact type is currently available for use`})
36501
+ IsEnabled: boolean;
36502
+
36503
+ @Field()
36504
+ @MaxLength(10)
36505
+ _mj__CreatedAt: Date;
36506
+
36507
+ @Field()
36508
+ @MaxLength(10)
36509
+ _mj__UpdatedAt: Date;
36510
+
36511
+ @Field({nullable: true, description: `Parent artifact type ID for hierarchical artifact type organization. Child types inherit ExtractRules from parent but can override.`})
36512
+ @MaxLength(16)
36513
+ ParentID?: string;
36514
+
36515
+ @Field({nullable: true, description: `JSON array of extraction rules defining how to extract attributes from artifact content. Each rule has: name (string), description (string), type (TypeScript type), standardProperty ('name'|'description'|'displayMarkdown'|'displayHtml'|null), extractor (JavaScript code string). Child types inherit parent rules and can override by name.`})
36516
+ ExtractRules?: string;
36517
+
36518
+ @Field({nullable: true, description: `Driver class name for the artifact viewer plugin. References Angular component registered with @RegisterClass decorator.`})
36519
+ @MaxLength(510)
36520
+ DriverClass?: string;
36521
+
36522
+ @Field({nullable: true, description: `Font Awesome icon class name for displaying this artifact type in the UI (e.g., fa-file-code, fa-chart-line)`})
36523
+ @MaxLength(510)
36524
+ Icon?: string;
36525
+
36526
+ @Field({nullable: true})
36527
+ @MaxLength(200)
36528
+ Parent?: string;
36529
+
36530
+ @Field({nullable: true})
36531
+ @MaxLength(16)
36532
+ RootParentID?: string;
36533
+
36534
+ @Field(() => [MJConversationArtifact_])
36535
+ MJ_ConversationArtifacts_ArtifactTypeIDArray: MJConversationArtifact_[]; // Link to MJ_ConversationArtifacts
36536
+
36537
+ @Field(() => [MJAIAgentArtifactType_])
36538
+ MJ_AIAgentArtifactTypes_ArtifactTypeIDArray: MJAIAgentArtifactType_[]; // Link to MJ_AIAgentArtifactTypes
36539
+
36540
+ @Field(() => [MJArtifact_])
36541
+ MJ_Artifacts_TypeIDArray: MJArtifact_[]; // Link to MJ_Artifacts
36542
+
36543
+ @Field(() => [MJArtifactType_])
36544
+ MJ_ArtifactTypes_ParentIDArray: MJArtifactType_[]; // Link to MJ_ArtifactTypes
36545
+
36546
+ @Field(() => [MJAIAgent_])
36547
+ AIAgents_DefaultArtifactTypeIDArray: MJAIAgent_[]; // Link to AIAgents
36548
+
36549
+ }
36550
+
36551
+ //****************************************************************************
36552
+ // INPUT TYPE for MJ: Artifact Types
36553
+ //****************************************************************************
36554
+ @InputType()
36555
+ export class CreateMJArtifactTypeInput {
36556
+ @Field({ nullable: true })
36557
+ ID?: string;
36558
+
36559
+ @Field({ nullable: true })
36560
+ Name?: string;
36561
+
36562
+ @Field({ nullable: true })
36563
+ Description: string | null;
36564
+
36565
+ @Field({ nullable: true })
36566
+ ContentType?: string;
36567
+
36568
+ @Field(() => Boolean, { nullable: true })
36569
+ IsEnabled?: boolean;
36570
+
36571
+ @Field({ nullable: true })
36572
+ ParentID: string | null;
36573
+
36574
+ @Field({ nullable: true })
36575
+ ExtractRules: string | null;
36576
+
36577
+ @Field({ nullable: true })
36578
+ DriverClass: string | null;
36579
+
36580
+ @Field({ nullable: true })
36581
+ Icon: string | null;
36582
+ }
36583
+
36584
+
36585
+ //****************************************************************************
36586
+ // INPUT TYPE for MJ: Artifact Types
36587
+ //****************************************************************************
36588
+ @InputType()
36589
+ export class UpdateMJArtifactTypeInput {
36590
+ @Field()
36591
+ ID: string;
36592
+
36593
+ @Field({ nullable: true })
36594
+ Name?: string;
36595
+
36596
+ @Field({ nullable: true })
36597
+ Description?: string | null;
36598
+
36599
+ @Field({ nullable: true })
36600
+ ContentType?: string;
36601
+
36602
+ @Field(() => Boolean, { nullable: true })
36603
+ IsEnabled?: boolean;
36604
+
36605
+ @Field({ nullable: true })
36606
+ ParentID?: string | null;
36607
+
36608
+ @Field({ nullable: true })
36609
+ ExtractRules?: string | null;
36610
+
36611
+ @Field({ nullable: true })
36612
+ DriverClass?: string | null;
36613
+
36614
+ @Field({ nullable: true })
36615
+ Icon?: string | null;
36616
+
36617
+ @Field(() => [KeyValuePairInput], { nullable: true })
36618
+ OldValues___?: KeyValuePairInput[];
36619
+ }
36620
+
36621
+ //****************************************************************************
36622
+ // RESOLVER for MJ: Artifact Types
36623
+ //****************************************************************************
36624
+ @ObjectType()
36625
+ export class RunMJArtifactTypeViewResult {
36626
+ @Field(() => [MJArtifactType_])
36627
+ Results: MJArtifactType_[];
36628
+
36629
+ @Field(() => String, {nullable: true})
36630
+ UserViewRunID?: string;
36631
+
36632
+ @Field(() => Int, {nullable: true})
36633
+ RowCount: number;
36634
+
36635
+ @Field(() => Int, {nullable: true})
36636
+ TotalRowCount: number;
36637
+
36638
+ @Field(() => Int, {nullable: true})
36639
+ ExecutionTime: number;
36640
+
36641
+ @Field({nullable: true})
36642
+ ErrorMessage?: string;
36643
+
36644
+ @Field(() => Boolean, {nullable: false})
36645
+ Success: boolean;
36646
+ }
36647
+
36648
+ @Resolver(MJArtifactType_)
36649
+ export class MJArtifactTypeResolver extends ResolverBase {
36650
+ @Query(() => RunMJArtifactTypeViewResult)
36651
+ async RunMJArtifactTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36652
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36653
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
36654
+ }
36655
+
36656
+ @Query(() => RunMJArtifactTypeViewResult)
36657
+ async RunMJArtifactTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36658
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36659
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
36660
+ }
36661
+
36662
+ @Query(() => RunMJArtifactTypeViewResult)
36663
+ async RunMJArtifactTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36664
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36665
+ input.EntityName = 'MJ: Artifact Types';
36666
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
36667
+ }
36668
+ @Query(() => MJArtifactType_, { nullable: true })
36669
+ async MJArtifactType(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactType_ | null> {
36670
+ this.CheckUserReadPermissions('MJ: Artifact Types', userPayload);
36671
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36672
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36673
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactTypes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Types', userPayload, EntityPermissionType.Read, 'AND');
36674
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36675
+ const result = await this.MapFieldNamesToCodeNames('MJ: Artifact Types', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
36676
+ return result;
36677
+ }
36678
+
36679
+ @FieldResolver(() => [MJConversationArtifact_])
36680
+ async MJ_ConversationArtifacts_ArtifactTypeIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
36681
+ this.CheckUserReadPermissions('MJ: Conversation Artifacts', userPayload);
36682
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36683
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36684
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwConversationArtifacts] WHERE [ArtifactTypeID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Artifacts', userPayload, EntityPermissionType.Read, 'AND');
36685
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36686
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Artifacts', rows, this.GetUserFromPayload(userPayload));
36687
+ return result;
36688
+ }
36689
+
36690
+ @FieldResolver(() => [MJAIAgentArtifactType_])
36691
+ async MJ_AIAgentArtifactTypes_ArtifactTypeIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
36692
+ this.CheckUserReadPermissions('MJ: AI Agent Artifact Types', userPayload);
36693
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36694
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36695
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentArtifactTypes] WHERE [ArtifactTypeID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Artifact Types', userPayload, EntityPermissionType.Read, 'AND');
36696
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36697
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Artifact Types', rows, this.GetUserFromPayload(userPayload));
36698
+ return result;
36699
+ }
36700
+
36701
+ @FieldResolver(() => [MJArtifact_])
36702
+ async MJ_Artifacts_TypeIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
36703
+ this.CheckUserReadPermissions('MJ: Artifacts', userPayload);
36704
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36705
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36706
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifacts] WHERE [TypeID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifacts', userPayload, EntityPermissionType.Read, 'AND');
36707
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36708
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Artifacts', rows, this.GetUserFromPayload(userPayload));
36709
+ return result;
36710
+ }
36711
+
36712
+ @FieldResolver(() => [MJArtifactType_])
36713
+ async MJ_ArtifactTypes_ParentIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
36714
+ this.CheckUserReadPermissions('MJ: Artifact Types', userPayload);
36715
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36716
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36717
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactTypes] WHERE [ParentID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Types', userPayload, EntityPermissionType.Read, 'AND');
36718
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36719
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Artifact Types', rows, this.GetUserFromPayload(userPayload));
36720
+ return result;
36721
+ }
36722
+
36723
+ @FieldResolver(() => [MJAIAgent_])
36724
+ async AIAgents_DefaultArtifactTypeIDArray(@Root() mjartifacttype_: MJArtifactType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
36725
+ this.CheckUserReadPermissions('AI Agents', userPayload);
36726
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36727
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36728
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgents] WHERE [DefaultArtifactTypeID]='${mjartifacttype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agents', userPayload, EntityPermissionType.Read, 'AND');
36729
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36730
+ const result = await this.ArrayMapFieldNamesToCodeNames('AI Agents', rows, this.GetUserFromPayload(userPayload));
36731
+ return result;
36732
+ }
36733
+
36734
+ @Mutation(() => MJArtifactType_)
36735
+ async CreateMJArtifactType(
36736
+ @Arg('input', () => CreateMJArtifactTypeInput) input: CreateMJArtifactTypeInput,
36737
+ @Ctx() { providers, userPayload }: AppContext,
36738
+ @PubSub() pubSub: PubSubEngine
36739
+ ) {
36740
+ const provider = GetReadWriteProvider(providers);
36741
+ return this.CreateRecord('MJ: Artifact Types', input, provider, userPayload, pubSub)
36742
+ }
36743
+
36744
+ @Mutation(() => MJArtifactType_)
36745
+ async UpdateMJArtifactType(
36746
+ @Arg('input', () => UpdateMJArtifactTypeInput) input: UpdateMJArtifactTypeInput,
36747
+ @Ctx() { providers, userPayload }: AppContext,
36748
+ @PubSub() pubSub: PubSubEngine
36749
+ ) {
36750
+ const provider = GetReadWriteProvider(providers);
36751
+ return this.UpdateRecord('MJ: Artifact Types', input, provider, userPayload, pubSub);
36752
+ }
36753
+
36754
+ @Mutation(() => MJArtifactType_)
36755
+ async DeleteMJArtifactType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36756
+ const provider = GetReadWriteProvider(providers);
36757
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
36758
+ return this.DeleteRecord('MJ: Artifact Types', key, options, provider, userPayload, pubSub);
36759
+ }
36760
+
36761
+ }
36762
+
36763
+ //****************************************************************************
36764
+ // ENTITY CLASS for MJ: Artifact Uses
36765
+ //****************************************************************************
36766
+ @ObjectType({ description: `Audit trail of artifact usage for security and analytics. Tracks each time an artifact is viewed, opened, shared, saved, or exported by users.` })
36767
+ export class MJArtifactUse_ {
36768
+ @Field()
36769
+ @MaxLength(16)
36770
+ ID: string;
36771
+
36772
+ @Field({description: `The specific version of the artifact being used.`})
36773
+ @MaxLength(16)
36774
+ ArtifactVersionID: string;
36775
+
36776
+ @Field({description: `The user performing the action.`})
36777
+ @MaxLength(16)
36778
+ UserID: string;
36779
+
36780
+ @Field({description: `Type of usage: Viewed (artifact displayed), Opened (artifact accessed), Shared (artifact shared with others), Saved (artifact bookmarked), or Exported (artifact downloaded).`})
36781
+ @MaxLength(40)
36782
+ UsageType: string;
36783
+
36784
+ @Field({nullable: true, description: `Optional JSON context with additional metadata about the usage event (e.g., source page, referrer, device info).`})
36785
+ UsageContext?: string;
36786
+
36787
+ @Field()
36788
+ @MaxLength(10)
36789
+ _mj__CreatedAt: Date;
36790
+
36791
+ @Field()
36792
+ @MaxLength(10)
36793
+ _mj__UpdatedAt: Date;
36794
+
36795
+ @Field({nullable: true})
36796
+ @MaxLength(510)
36797
+ ArtifactVersion?: string;
36798
+
36799
+ @Field()
36800
+ @MaxLength(200)
36801
+ User: string;
36802
+
36803
+ }
36804
+
36805
+ //****************************************************************************
36806
+ // INPUT TYPE for MJ: Artifact Uses
36807
+ //****************************************************************************
36808
+ @InputType()
36809
+ export class CreateMJArtifactUseInput {
36810
+ @Field({ nullable: true })
36811
+ ID?: string;
36812
+
36813
+ @Field({ nullable: true })
36814
+ ArtifactVersionID?: string;
36815
+
36816
+ @Field({ nullable: true })
36817
+ UserID?: string;
36818
+
36819
+ @Field({ nullable: true })
36820
+ UsageType?: string;
36821
+
36822
+ @Field({ nullable: true })
36823
+ UsageContext: string | null;
36824
+ }
36825
+
36826
+
36827
+ //****************************************************************************
36828
+ // INPUT TYPE for MJ: Artifact Uses
36829
+ //****************************************************************************
36830
+ @InputType()
36831
+ export class UpdateMJArtifactUseInput {
36832
+ @Field()
36833
+ ID: string;
36834
+
36835
+ @Field({ nullable: true })
36836
+ ArtifactVersionID?: string;
36837
+
36838
+ @Field({ nullable: true })
36839
+ UserID?: string;
36840
+
36841
+ @Field({ nullable: true })
36842
+ UsageType?: string;
36843
+
36844
+ @Field({ nullable: true })
36845
+ UsageContext?: string | null;
36846
+
36847
+ @Field(() => [KeyValuePairInput], { nullable: true })
36848
+ OldValues___?: KeyValuePairInput[];
36849
+ }
36850
+
36851
+ //****************************************************************************
36852
+ // RESOLVER for MJ: Artifact Uses
36853
+ //****************************************************************************
36854
+ @ObjectType()
36855
+ export class RunMJArtifactUseViewResult {
36856
+ @Field(() => [MJArtifactUse_])
36857
+ Results: MJArtifactUse_[];
36858
+
36859
+ @Field(() => String, {nullable: true})
36860
+ UserViewRunID?: string;
36861
+
36862
+ @Field(() => Int, {nullable: true})
36863
+ RowCount: number;
36864
+
36865
+ @Field(() => Int, {nullable: true})
36866
+ TotalRowCount: number;
36867
+
36868
+ @Field(() => Int, {nullable: true})
36869
+ ExecutionTime: number;
36870
+
36871
+ @Field({nullable: true})
36872
+ ErrorMessage?: string;
36873
+
36874
+ @Field(() => Boolean, {nullable: false})
36875
+ Success: boolean;
36876
+ }
36877
+
36878
+ @Resolver(MJArtifactUse_)
36879
+ export class MJArtifactUseResolver extends ResolverBase {
36880
+ @Query(() => RunMJArtifactUseViewResult)
36881
+ async RunMJArtifactUseViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36882
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36883
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
36884
+ }
36885
+
36886
+ @Query(() => RunMJArtifactUseViewResult)
36887
+ async RunMJArtifactUseViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36888
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36889
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
36890
+ }
36891
+
36892
+ @Query(() => RunMJArtifactUseViewResult)
36893
+ async RunMJArtifactUseDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36894
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36895
+ input.EntityName = 'MJ: Artifact Uses';
36896
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
36897
+ }
36898
+ @Query(() => MJArtifactUse_, { nullable: true })
36899
+ async MJArtifactUse(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactUse_ | null> {
36900
+ this.CheckUserReadPermissions('MJ: Artifact Uses', userPayload);
36901
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
36902
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
36903
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactUses] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Uses', userPayload, EntityPermissionType.Read, 'AND');
36904
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
36905
+ const result = await this.MapFieldNamesToCodeNames('MJ: Artifact Uses', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
36906
+ return result;
36907
+ }
36908
+
36909
+ @Mutation(() => MJArtifactUse_)
36910
+ async CreateMJArtifactUse(
36911
+ @Arg('input', () => CreateMJArtifactUseInput) input: CreateMJArtifactUseInput,
36912
+ @Ctx() { providers, userPayload }: AppContext,
36913
+ @PubSub() pubSub: PubSubEngine
36914
+ ) {
36915
+ const provider = GetReadWriteProvider(providers);
36916
+ return this.CreateRecord('MJ: Artifact Uses', input, provider, userPayload, pubSub)
36917
+ }
36918
+
36919
+ @Mutation(() => MJArtifactUse_)
36920
+ async UpdateMJArtifactUse(
36921
+ @Arg('input', () => UpdateMJArtifactUseInput) input: UpdateMJArtifactUseInput,
36922
+ @Ctx() { providers, userPayload }: AppContext,
36923
+ @PubSub() pubSub: PubSubEngine
36924
+ ) {
36925
+ const provider = GetReadWriteProvider(providers);
36926
+ return this.UpdateRecord('MJ: Artifact Uses', input, provider, userPayload, pubSub);
36927
+ }
36928
+
36929
+ @Mutation(() => MJArtifactUse_)
36930
+ async DeleteMJArtifactUse(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
36931
+ const provider = GetReadWriteProvider(providers);
36932
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
36933
+ return this.DeleteRecord('MJ: Artifact Uses', key, options, provider, userPayload, pubSub);
36934
+ }
36935
+
36936
+ }
36937
+
36938
+ //****************************************************************************
36939
+ // ENTITY CLASS for MJ: Artifact Version Attributes
36940
+ //****************************************************************************
36941
+ @ObjectType({ description: `Stores extracted attribute values from artifact content based on ArtifactType ExtractRules. Prevents re-running extraction logic on every access.` })
36942
+ export class MJArtifactVersionAttribute_ {
36943
+ @Field()
36944
+ @MaxLength(16)
36945
+ ID: string;
36946
+
36947
+ @Field({description: `The artifact version this attribute belongs to`})
36948
+ @MaxLength(16)
36949
+ ArtifactVersionID: string;
36950
+
36951
+ @Field({description: `Name of the extracted attribute (matches ExtractRule.name)`})
36952
+ @MaxLength(510)
36953
+ Name: string;
36954
+
36955
+ @Field({description: `TypeScript type definition of the value (e.g., 'string', 'number', 'Date', 'Array<{x: number, y: string}>')`})
36956
+ @MaxLength(1000)
36957
+ Type: string;
36958
+
36959
+ @Field({nullable: true, description: `JSON-serialized extracted value`})
36960
+ Value?: string;
36961
+
36962
+ @Field({nullable: true, description: `Maps this attribute to a standard property for UI rendering: 'name', 'description', 'displayMarkdown', 'displayHtml', or NULL for custom attributes`})
36963
+ @MaxLength(100)
36964
+ StandardProperty?: string;
36965
+
36966
+ @Field()
36967
+ @MaxLength(10)
36968
+ _mj__CreatedAt: Date;
36969
+
36970
+ @Field()
36971
+ @MaxLength(10)
36972
+ _mj__UpdatedAt: Date;
36973
+
36974
+ @Field({nullable: true})
36975
+ @MaxLength(510)
36976
+ ArtifactVersion?: string;
36977
+
36978
+ }
36979
+
36980
+ //****************************************************************************
36981
+ // INPUT TYPE for MJ: Artifact Version Attributes
36982
+ //****************************************************************************
36983
+ @InputType()
36984
+ export class CreateMJArtifactVersionAttributeInput {
36985
+ @Field({ nullable: true })
36986
+ ID?: string;
36987
+
36988
+ @Field({ nullable: true })
36989
+ ArtifactVersionID?: string;
36990
+
36991
+ @Field({ nullable: true })
36992
+ Name?: string;
36993
+
36994
+ @Field({ nullable: true })
36995
+ Type?: string;
36996
+
36997
+ @Field({ nullable: true })
36998
+ Value: string | null;
36999
+
37000
+ @Field({ nullable: true })
37001
+ StandardProperty: string | null;
37002
+ }
37003
+
37004
+
37005
+ //****************************************************************************
37006
+ // INPUT TYPE for MJ: Artifact Version Attributes
37007
+ //****************************************************************************
37008
+ @InputType()
37009
+ export class UpdateMJArtifactVersionAttributeInput {
37010
+ @Field()
37011
+ ID: string;
37012
+
37013
+ @Field({ nullable: true })
37014
+ ArtifactVersionID?: string;
37015
+
37016
+ @Field({ nullable: true })
37017
+ Name?: string;
37018
+
37019
+ @Field({ nullable: true })
37020
+ Type?: string;
37021
+
37022
+ @Field({ nullable: true })
37023
+ Value?: string | null;
37024
+
37025
+ @Field({ nullable: true })
37026
+ StandardProperty?: string | null;
37027
+
37028
+ @Field(() => [KeyValuePairInput], { nullable: true })
37029
+ OldValues___?: KeyValuePairInput[];
37030
+ }
37031
+
37032
+ //****************************************************************************
37033
+ // RESOLVER for MJ: Artifact Version Attributes
37034
+ //****************************************************************************
37035
+ @ObjectType()
37036
+ export class RunMJArtifactVersionAttributeViewResult {
37037
+ @Field(() => [MJArtifactVersionAttribute_])
37038
+ Results: MJArtifactVersionAttribute_[];
37039
+
37040
+ @Field(() => String, {nullable: true})
37041
+ UserViewRunID?: string;
37042
+
37043
+ @Field(() => Int, {nullable: true})
37044
+ RowCount: number;
37045
+
37046
+ @Field(() => Int, {nullable: true})
37047
+ TotalRowCount: number;
37048
+
37049
+ @Field(() => Int, {nullable: true})
37050
+ ExecutionTime: number;
37051
+
37052
+ @Field({nullable: true})
37053
+ ErrorMessage?: string;
37054
+
37055
+ @Field(() => Boolean, {nullable: false})
37056
+ Success: boolean;
37057
+ }
37058
+
37059
+ @Resolver(MJArtifactVersionAttribute_)
37060
+ export class MJArtifactVersionAttributeResolver extends ResolverBase {
37061
+ @Query(() => RunMJArtifactVersionAttributeViewResult)
37062
+ async RunMJArtifactVersionAttributeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
37063
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
37064
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
37065
+ }
37066
+
37067
+ @Query(() => RunMJArtifactVersionAttributeViewResult)
37068
+ async RunMJArtifactVersionAttributeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
37069
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
37070
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
37071
+ }
37072
+
37073
+ @Query(() => RunMJArtifactVersionAttributeViewResult)
37074
+ async RunMJArtifactVersionAttributeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
37075
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
37076
+ input.EntityName = 'MJ: Artifact Version Attributes';
37077
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
37078
+ }
37079
+ @Query(() => MJArtifactVersionAttribute_, { nullable: true })
37080
+ async MJArtifactVersionAttribute(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJArtifactVersionAttribute_ | null> {
37081
+ this.CheckUserReadPermissions('MJ: Artifact Version Attributes', userPayload);
37082
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
37083
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
37084
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwArtifactVersionAttributes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Artifact Version Attributes', userPayload, EntityPermissionType.Read, 'AND');
37085
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
37086
+ const result = await this.MapFieldNamesToCodeNames('MJ: Artifact Version Attributes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
37087
+ return result;
37088
+ }
37089
+
37090
+ @Mutation(() => MJArtifactVersionAttribute_)
37091
+ async CreateMJArtifactVersionAttribute(
37092
+ @Arg('input', () => CreateMJArtifactVersionAttributeInput) input: CreateMJArtifactVersionAttributeInput,
37093
+ @Ctx() { providers, userPayload }: AppContext,
37094
+ @PubSub() pubSub: PubSubEngine
37095
+ ) {
37096
+ const provider = GetReadWriteProvider(providers);
37097
+ return this.CreateRecord('MJ: Artifact Version Attributes', input, provider, userPayload, pubSub)
37098
+ }
37099
+
37100
+ @Mutation(() => MJArtifactVersionAttribute_)
37101
+ async UpdateMJArtifactVersionAttribute(
37102
+ @Arg('input', () => UpdateMJArtifactVersionAttributeInput) input: UpdateMJArtifactVersionAttributeInput,
37103
+ @Ctx() { providers, userPayload }: AppContext,
37104
+ @PubSub() pubSub: PubSubEngine
37105
+ ) {
37106
+ const provider = GetReadWriteProvider(providers);
37107
+ return this.UpdateRecord('MJ: Artifact Version Attributes', input, provider, userPayload, pubSub);
37108
+ }
37109
+
37110
+ @Mutation(() => MJArtifactVersionAttribute_)
37111
+ async DeleteMJArtifactVersionAttribute(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
37112
+ const provider = GetReadWriteProvider(providers);
37113
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
37114
+ return this.DeleteRecord('MJ: Artifact Version Attributes', key, options, provider, userPayload, pubSub);
37115
+ }
37116
+
37117
+ }
37118
+
37119
+ //****************************************************************************
37120
+ // ENTITY CLASS for MJ: Artifact Versions
37121
+ //****************************************************************************
37122
+ @ObjectType({ description: `Version history for artifacts, tracking all changes over time` })
37123
+ export class MJArtifactVersion_ {
37124
+ @Field()
37125
+ @MaxLength(16)
37126
+ ID: string;
37127
+
37128
+ @Field()
37129
+ @MaxLength(16)
37130
+ ArtifactID: string;
37131
+
37132
+ @Field(() => Int, {description: `Sequential version number for this artifact`})
37133
+ VersionNumber: number;
37134
+
37135
+ @Field({nullable: true, description: `The content of the artifact at this version`})
37136
+ Content?: string;
37137
+
37138
+ @Field({nullable: true, description: `JSON configuration for this version`})
37139
+ Configuration?: string;
37140
+
37141
+ @Field({nullable: true, description: `User comments specific to this version`})
37142
+ Comments?: string;
37143
+
37144
+ @Field()
37145
+ @MaxLength(16)
37146
+ UserID: string;
37147
+
37148
+ @Field()
37149
+ @MaxLength(10)
37150
+ _mj__CreatedAt: Date;
37151
+
37152
+ @Field()
37153
+ @MaxLength(10)
37154
+ _mj__UpdatedAt: Date;
37155
+
37156
+ @Field({nullable: true, description: `SHA-256 hash of the Content field for duplicate detection and version comparison`})
37157
+ @MaxLength(1000)
37158
+ ContentHash?: string;
37159
+
37160
+ @Field({nullable: true, description: `Name of this artifact version. Can differ from Artifact.Name as it may evolve with versions.`})
37161
+ @MaxLength(510)
37162
+ Name?: string;
37163
+
37164
+ @Field({nullable: true, description: `Description of this artifact version. Can differ from Artifact.Description as it may evolve with versions.`})
37165
+ Description?: string;
37166
+
37167
+ @Field()
37168
+ @MaxLength(510)
37169
+ Artifact: string;
37170
+
37171
+ @Field()
37172
+ @MaxLength(200)
37173
+ User: string;
37174
+
37175
+ @Field(() => [MJArtifactVersionAttribute_])
35603
37176
  MJ_ArtifactVersionAttributes_ArtifactVersionIDArray: MJArtifactVersionAttribute_[]; // Link to MJ_ArtifactVersionAttributes
35604
37177
 
35605
37178
  @Field(() => [MJCollectionArtifact_])
@@ -39577,6 +41150,9 @@ export class MJCredential_ {
39577
41150
  @MaxLength(200)
39578
41151
  Category?: string;
39579
41152
 
41153
+ @Field(() => [MJFileStorageAccount_])
41154
+ MJ_FileStorageAccounts_CredentialIDArray: MJFileStorageAccount_[]; // Link to MJ_FileStorageAccounts
41155
+
39580
41156
  @Field(() => [MJAICredentialBinding_])
39581
41157
  MJ_AICredentialBindings_CredentialIDArray: MJAICredentialBinding_[]; // Link to MJ_AICredentialBindings
39582
41158
 
@@ -39728,6 +41304,17 @@ export class MJCredentialResolver extends ResolverBase {
39728
41304
  return result;
39729
41305
  }
39730
41306
 
41307
+ @FieldResolver(() => [MJFileStorageAccount_])
41308
+ async MJ_FileStorageAccounts_CredentialIDArray(@Root() mjcredential_: MJCredential_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
41309
+ this.CheckUserReadPermissions('MJ: File Storage Accounts', userPayload);
41310
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
41311
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
41312
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwFileStorageAccounts] WHERE [CredentialID]='${mjcredential_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: File Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
41313
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
41314
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: File Storage Accounts', rows, this.GetUserFromPayload(userPayload));
41315
+ return result;
41316
+ }
41317
+
39731
41318
  @FieldResolver(() => [MJAICredentialBinding_])
39732
41319
  async MJ_AICredentialBindings_CredentialIDArray(@Root() mjcredential_: MJCredential_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
39733
41320
  this.CheckUserReadPermissions('MJ: AI Credential Bindings', userPayload);
@@ -41864,6 +43451,181 @@ export class MJEnvironmentResolver extends ResolverBase {
41864
43451
 
41865
43452
  }
41866
43453
 
43454
+ //****************************************************************************
43455
+ // ENTITY CLASS for MJ: File Storage Accounts
43456
+ //****************************************************************************
43457
+ @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.` })
43458
+ export class MJFileStorageAccount_ {
43459
+ @Field({description: `Primary key`})
43460
+ @MaxLength(16)
43461
+ ID: string;
43462
+
43463
+ @Field({description: `Display name for the storage account (e.g., Marketing Files, Engineering Docs). Must be unique per provider.`})
43464
+ @MaxLength(400)
43465
+ Name: string;
43466
+
43467
+ @Field({nullable: true, description: `Optional description providing additional context about the account purpose or contents.`})
43468
+ Description?: string;
43469
+
43470
+ @Field({description: `Foreign key to FileStorageProvider indicating which storage service this account uses (Dropbox, Google Drive, S3, etc.).`})
43471
+ @MaxLength(16)
43472
+ ProviderID: string;
43473
+
43474
+ @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.`})
43475
+ @MaxLength(16)
43476
+ CredentialID: string;
43477
+
43478
+ @Field()
43479
+ @MaxLength(10)
43480
+ _mj__CreatedAt: Date;
43481
+
43482
+ @Field()
43483
+ @MaxLength(10)
43484
+ _mj__UpdatedAt: Date;
43485
+
43486
+ @Field()
43487
+ @MaxLength(100)
43488
+ Provider: string;
43489
+
43490
+ @Field()
43491
+ @MaxLength(400)
43492
+ Credential: string;
43493
+
43494
+ }
43495
+
43496
+ //****************************************************************************
43497
+ // INPUT TYPE for MJ: File Storage Accounts
43498
+ //****************************************************************************
43499
+ @InputType()
43500
+ export class CreateMJFileStorageAccountInput {
43501
+ @Field({ nullable: true })
43502
+ ID?: string;
43503
+
43504
+ @Field({ nullable: true })
43505
+ Name?: string;
43506
+
43507
+ @Field({ nullable: true })
43508
+ Description: string | null;
43509
+
43510
+ @Field({ nullable: true })
43511
+ ProviderID?: string;
43512
+
43513
+ @Field({ nullable: true })
43514
+ CredentialID?: string;
43515
+ }
43516
+
43517
+
43518
+ //****************************************************************************
43519
+ // INPUT TYPE for MJ: File Storage Accounts
43520
+ //****************************************************************************
43521
+ @InputType()
43522
+ export class UpdateMJFileStorageAccountInput {
43523
+ @Field()
43524
+ ID: string;
43525
+
43526
+ @Field({ nullable: true })
43527
+ Name?: string;
43528
+
43529
+ @Field({ nullable: true })
43530
+ Description?: string | null;
43531
+
43532
+ @Field({ nullable: true })
43533
+ ProviderID?: string;
43534
+
43535
+ @Field({ nullable: true })
43536
+ CredentialID?: string;
43537
+
43538
+ @Field(() => [KeyValuePairInput], { nullable: true })
43539
+ OldValues___?: KeyValuePairInput[];
43540
+ }
43541
+
43542
+ //****************************************************************************
43543
+ // RESOLVER for MJ: File Storage Accounts
43544
+ //****************************************************************************
43545
+ @ObjectType()
43546
+ export class RunMJFileStorageAccountViewResult {
43547
+ @Field(() => [MJFileStorageAccount_])
43548
+ Results: MJFileStorageAccount_[];
43549
+
43550
+ @Field(() => String, {nullable: true})
43551
+ UserViewRunID?: string;
43552
+
43553
+ @Field(() => Int, {nullable: true})
43554
+ RowCount: number;
43555
+
43556
+ @Field(() => Int, {nullable: true})
43557
+ TotalRowCount: number;
43558
+
43559
+ @Field(() => Int, {nullable: true})
43560
+ ExecutionTime: number;
43561
+
43562
+ @Field({nullable: true})
43563
+ ErrorMessage?: string;
43564
+
43565
+ @Field(() => Boolean, {nullable: false})
43566
+ Success: boolean;
43567
+ }
43568
+
43569
+ @Resolver(MJFileStorageAccount_)
43570
+ export class MJFileStorageAccountResolver extends ResolverBase {
43571
+ @Query(() => RunMJFileStorageAccountViewResult)
43572
+ async RunMJFileStorageAccountViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
43573
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
43574
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
43575
+ }
43576
+
43577
+ @Query(() => RunMJFileStorageAccountViewResult)
43578
+ async RunMJFileStorageAccountViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
43579
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
43580
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
43581
+ }
43582
+
43583
+ @Query(() => RunMJFileStorageAccountViewResult)
43584
+ async RunMJFileStorageAccountDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
43585
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
43586
+ input.EntityName = 'MJ: File Storage Accounts';
43587
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
43588
+ }
43589
+ @Query(() => MJFileStorageAccount_, { nullable: true })
43590
+ async MJFileStorageAccount(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJFileStorageAccount_ | null> {
43591
+ this.CheckUserReadPermissions('MJ: File Storage Accounts', userPayload);
43592
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
43593
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
43594
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwFileStorageAccounts] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: File Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
43595
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
43596
+ const result = await this.MapFieldNamesToCodeNames('MJ: File Storage Accounts', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
43597
+ return result;
43598
+ }
43599
+
43600
+ @Mutation(() => MJFileStorageAccount_)
43601
+ async CreateMJFileStorageAccount(
43602
+ @Arg('input', () => CreateMJFileStorageAccountInput) input: CreateMJFileStorageAccountInput,
43603
+ @Ctx() { providers, userPayload }: AppContext,
43604
+ @PubSub() pubSub: PubSubEngine
43605
+ ) {
43606
+ const provider = GetReadWriteProvider(providers);
43607
+ return this.CreateRecord('MJ: File Storage Accounts', input, provider, userPayload, pubSub)
43608
+ }
43609
+
43610
+ @Mutation(() => MJFileStorageAccount_)
43611
+ async UpdateMJFileStorageAccount(
43612
+ @Arg('input', () => UpdateMJFileStorageAccountInput) input: UpdateMJFileStorageAccountInput,
43613
+ @Ctx() { providers, userPayload }: AppContext,
43614
+ @PubSub() pubSub: PubSubEngine
43615
+ ) {
43616
+ const provider = GetReadWriteProvider(providers);
43617
+ return this.UpdateRecord('MJ: File Storage Accounts', input, provider, userPayload, pubSub);
43618
+ }
43619
+
43620
+ @Mutation(() => MJFileStorageAccount_)
43621
+ async DeleteMJFileStorageAccount(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
43622
+ const provider = GetReadWriteProvider(providers);
43623
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
43624
+ return this.DeleteRecord('MJ: File Storage Accounts', key, options, provider, userPayload, pubSub);
43625
+ }
43626
+
43627
+ }
43628
+
41867
43629
  //****************************************************************************
41868
43630
  // ENTITY CLASS for MJ: List Invitations
41869
43631
  //****************************************************************************
@@ -47212,6 +48974,476 @@ export class MJTestResolver extends ResolverBase {
47212
48974
 
47213
48975
  }
47214
48976
 
48977
+ //****************************************************************************
48978
+ // ENTITY CLASS for MJ: User Notification Preferences
48979
+ //****************************************************************************
48980
+ @ObjectType({ description: `Per-user preferences for each notification type (delivery method overrides)` })
48981
+ export class MJUserNotificationPreference_ {
48982
+ @Field()
48983
+ @MaxLength(16)
48984
+ ID: string;
48985
+
48986
+ @Field()
48987
+ @MaxLength(16)
48988
+ UserID: string;
48989
+
48990
+ @Field()
48991
+ @MaxLength(16)
48992
+ NotificationTypeID: string;
48993
+
48994
+ @Field(() => Boolean, {nullable: true, description: `User preference for in-app notifications (NULL = use default)`})
48995
+ InAppEnabled?: boolean;
48996
+
48997
+ @Field(() => Boolean, {nullable: true, description: `User preference for email notifications (NULL = use default)`})
48998
+ EmailEnabled?: boolean;
48999
+
49000
+ @Field(() => Boolean, {nullable: true, description: `User preference for SMS notifications (NULL = use default)`})
49001
+ SMSEnabled?: boolean;
49002
+
49003
+ @Field(() => Boolean, {nullable: true})
49004
+ Enabled?: boolean;
49005
+
49006
+ @Field()
49007
+ @MaxLength(10)
49008
+ _mj__CreatedAt: Date;
49009
+
49010
+ @Field()
49011
+ @MaxLength(10)
49012
+ _mj__UpdatedAt: Date;
49013
+
49014
+ @Field()
49015
+ @MaxLength(200)
49016
+ User: string;
49017
+
49018
+ @Field()
49019
+ @MaxLength(200)
49020
+ NotificationType: string;
49021
+
49022
+ }
49023
+
49024
+ //****************************************************************************
49025
+ // INPUT TYPE for MJ: User Notification Preferences
49026
+ //****************************************************************************
49027
+ @InputType()
49028
+ export class CreateMJUserNotificationPreferenceInput {
49029
+ @Field({ nullable: true })
49030
+ ID?: string;
49031
+
49032
+ @Field({ nullable: true })
49033
+ UserID?: string;
49034
+
49035
+ @Field({ nullable: true })
49036
+ NotificationTypeID?: string;
49037
+
49038
+ @Field(() => Boolean, { nullable: true })
49039
+ InAppEnabled: boolean | null;
49040
+
49041
+ @Field(() => Boolean, { nullable: true })
49042
+ EmailEnabled: boolean | null;
49043
+
49044
+ @Field(() => Boolean, { nullable: true })
49045
+ SMSEnabled: boolean | null;
49046
+
49047
+ @Field(() => Boolean, { nullable: true })
49048
+ Enabled?: boolean | null;
49049
+ }
49050
+
49051
+
49052
+ //****************************************************************************
49053
+ // INPUT TYPE for MJ: User Notification Preferences
49054
+ //****************************************************************************
49055
+ @InputType()
49056
+ export class UpdateMJUserNotificationPreferenceInput {
49057
+ @Field()
49058
+ ID: string;
49059
+
49060
+ @Field({ nullable: true })
49061
+ UserID?: string;
49062
+
49063
+ @Field({ nullable: true })
49064
+ NotificationTypeID?: string;
49065
+
49066
+ @Field(() => Boolean, { nullable: true })
49067
+ InAppEnabled?: boolean | null;
49068
+
49069
+ @Field(() => Boolean, { nullable: true })
49070
+ EmailEnabled?: boolean | null;
49071
+
49072
+ @Field(() => Boolean, { nullable: true })
49073
+ SMSEnabled?: boolean | null;
49074
+
49075
+ @Field(() => Boolean, { nullable: true })
49076
+ Enabled?: boolean | null;
49077
+
49078
+ @Field(() => [KeyValuePairInput], { nullable: true })
49079
+ OldValues___?: KeyValuePairInput[];
49080
+ }
49081
+
49082
+ //****************************************************************************
49083
+ // RESOLVER for MJ: User Notification Preferences
49084
+ //****************************************************************************
49085
+ @ObjectType()
49086
+ export class RunMJUserNotificationPreferenceViewResult {
49087
+ @Field(() => [MJUserNotificationPreference_])
49088
+ Results: MJUserNotificationPreference_[];
49089
+
49090
+ @Field(() => String, {nullable: true})
49091
+ UserViewRunID?: string;
49092
+
49093
+ @Field(() => Int, {nullable: true})
49094
+ RowCount: number;
49095
+
49096
+ @Field(() => Int, {nullable: true})
49097
+ TotalRowCount: number;
49098
+
49099
+ @Field(() => Int, {nullable: true})
49100
+ ExecutionTime: number;
49101
+
49102
+ @Field({nullable: true})
49103
+ ErrorMessage?: string;
49104
+
49105
+ @Field(() => Boolean, {nullable: false})
49106
+ Success: boolean;
49107
+ }
49108
+
49109
+ @Resolver(MJUserNotificationPreference_)
49110
+ export class MJUserNotificationPreferenceResolver extends ResolverBase {
49111
+ @Query(() => RunMJUserNotificationPreferenceViewResult)
49112
+ async RunMJUserNotificationPreferenceViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
49113
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49114
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
49115
+ }
49116
+
49117
+ @Query(() => RunMJUserNotificationPreferenceViewResult)
49118
+ async RunMJUserNotificationPreferenceViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
49119
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49120
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
49121
+ }
49122
+
49123
+ @Query(() => RunMJUserNotificationPreferenceViewResult)
49124
+ async RunMJUserNotificationPreferenceDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
49125
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49126
+ input.EntityName = 'MJ: User Notification Preferences';
49127
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
49128
+ }
49129
+ @Query(() => MJUserNotificationPreference_, { nullable: true })
49130
+ async MJUserNotificationPreference(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJUserNotificationPreference_ | null> {
49131
+ this.CheckUserReadPermissions('MJ: User Notification Preferences', userPayload);
49132
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49133
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
49134
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationPreferences] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Preferences', userPayload, EntityPermissionType.Read, 'AND');
49135
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
49136
+ const result = await this.MapFieldNamesToCodeNames('MJ: User Notification Preferences', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
49137
+ return result;
49138
+ }
49139
+
49140
+ @Mutation(() => MJUserNotificationPreference_)
49141
+ async CreateMJUserNotificationPreference(
49142
+ @Arg('input', () => CreateMJUserNotificationPreferenceInput) input: CreateMJUserNotificationPreferenceInput,
49143
+ @Ctx() { providers, userPayload }: AppContext,
49144
+ @PubSub() pubSub: PubSubEngine
49145
+ ) {
49146
+ const provider = GetReadWriteProvider(providers);
49147
+ return this.CreateRecord('MJ: User Notification Preferences', input, provider, userPayload, pubSub)
49148
+ }
49149
+
49150
+ @Mutation(() => MJUserNotificationPreference_)
49151
+ async UpdateMJUserNotificationPreference(
49152
+ @Arg('input', () => UpdateMJUserNotificationPreferenceInput) input: UpdateMJUserNotificationPreferenceInput,
49153
+ @Ctx() { providers, userPayload }: AppContext,
49154
+ @PubSub() pubSub: PubSubEngine
49155
+ ) {
49156
+ const provider = GetReadWriteProvider(providers);
49157
+ return this.UpdateRecord('MJ: User Notification Preferences', input, provider, userPayload, pubSub);
49158
+ }
49159
+
49160
+ @Mutation(() => MJUserNotificationPreference_)
49161
+ async DeleteMJUserNotificationPreference(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
49162
+ const provider = GetReadWriteProvider(providers);
49163
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
49164
+ return this.DeleteRecord('MJ: User Notification Preferences', key, options, provider, userPayload, pubSub);
49165
+ }
49166
+
49167
+ }
49168
+
49169
+ //****************************************************************************
49170
+ // ENTITY CLASS for MJ: User Notification Types
49171
+ //****************************************************************************
49172
+ @ObjectType({ description: `Defines categories of notifications with delivery configuration and template associations` })
49173
+ export class MJUserNotificationType_ {
49174
+ @Field()
49175
+ @MaxLength(16)
49176
+ ID: string;
49177
+
49178
+ @Field({description: `Unique name for the notification type (e.g., 'Agent Completion')`})
49179
+ @MaxLength(200)
49180
+ Name: string;
49181
+
49182
+ @Field({nullable: true})
49183
+ @MaxLength(1000)
49184
+ Description?: string;
49185
+
49186
+ @Field(() => Boolean, {description: `Whether in-app notifications are enabled by default for this type`})
49187
+ DefaultInApp: boolean;
49188
+
49189
+ @Field(() => Boolean, {description: `Whether email notifications are enabled by default for this type`})
49190
+ DefaultEmail: boolean;
49191
+
49192
+ @Field(() => Boolean, {description: `Whether SMS notifications are enabled by default for this type`})
49193
+ DefaultSMS: boolean;
49194
+
49195
+ @Field(() => Boolean, {nullable: true, description: `Whether users can override the default delivery method`})
49196
+ AllowUserPreference?: boolean;
49197
+
49198
+ @Field({nullable: true})
49199
+ @MaxLength(16)
49200
+ EmailTemplateID?: string;
49201
+
49202
+ @Field({nullable: true})
49203
+ @MaxLength(16)
49204
+ SMSTemplateID?: string;
49205
+
49206
+ @Field({nullable: true})
49207
+ @MaxLength(200)
49208
+ Icon?: string;
49209
+
49210
+ @Field({nullable: true})
49211
+ @MaxLength(100)
49212
+ Color?: string;
49213
+
49214
+ @Field(() => Int, {nullable: true})
49215
+ AutoExpireDays?: number;
49216
+
49217
+ @Field(() => Int, {nullable: true})
49218
+ Priority?: number;
49219
+
49220
+ @Field()
49221
+ @MaxLength(10)
49222
+ _mj__CreatedAt: Date;
49223
+
49224
+ @Field()
49225
+ @MaxLength(10)
49226
+ _mj__UpdatedAt: Date;
49227
+
49228
+ @Field({nullable: true})
49229
+ @MaxLength(510)
49230
+ EmailTemplate?: string;
49231
+
49232
+ @Field({nullable: true})
49233
+ @MaxLength(510)
49234
+ SMSTemplate?: string;
49235
+
49236
+ @Field(() => [MJUserNotification_])
49237
+ UserNotifications_NotificationTypeIDArray: MJUserNotification_[]; // Link to UserNotifications
49238
+
49239
+ @Field(() => [MJUserNotificationPreference_])
49240
+ MJ_UserNotificationPreferences_NotificationTypeIDArray: MJUserNotificationPreference_[]; // Link to MJ_UserNotificationPreferences
49241
+
49242
+ }
49243
+
49244
+ //****************************************************************************
49245
+ // INPUT TYPE for MJ: User Notification Types
49246
+ //****************************************************************************
49247
+ @InputType()
49248
+ export class CreateMJUserNotificationTypeInput {
49249
+ @Field({ nullable: true })
49250
+ ID?: string;
49251
+
49252
+ @Field({ nullable: true })
49253
+ Name?: string;
49254
+
49255
+ @Field({ nullable: true })
49256
+ Description: string | null;
49257
+
49258
+ @Field(() => Boolean, { nullable: true })
49259
+ DefaultInApp?: boolean;
49260
+
49261
+ @Field(() => Boolean, { nullable: true })
49262
+ DefaultEmail?: boolean;
49263
+
49264
+ @Field(() => Boolean, { nullable: true })
49265
+ DefaultSMS?: boolean;
49266
+
49267
+ @Field(() => Boolean, { nullable: true })
49268
+ AllowUserPreference?: boolean | null;
49269
+
49270
+ @Field({ nullable: true })
49271
+ EmailTemplateID: string | null;
49272
+
49273
+ @Field({ nullable: true })
49274
+ SMSTemplateID: string | null;
49275
+
49276
+ @Field({ nullable: true })
49277
+ Icon: string | null;
49278
+
49279
+ @Field({ nullable: true })
49280
+ Color: string | null;
49281
+
49282
+ @Field(() => Int, { nullable: true })
49283
+ AutoExpireDays: number | null;
49284
+
49285
+ @Field(() => Int, { nullable: true })
49286
+ Priority?: number | null;
49287
+ }
49288
+
49289
+
49290
+ //****************************************************************************
49291
+ // INPUT TYPE for MJ: User Notification Types
49292
+ //****************************************************************************
49293
+ @InputType()
49294
+ export class UpdateMJUserNotificationTypeInput {
49295
+ @Field()
49296
+ ID: string;
49297
+
49298
+ @Field({ nullable: true })
49299
+ Name?: string;
49300
+
49301
+ @Field({ nullable: true })
49302
+ Description?: string | null;
49303
+
49304
+ @Field(() => Boolean, { nullable: true })
49305
+ DefaultInApp?: boolean;
49306
+
49307
+ @Field(() => Boolean, { nullable: true })
49308
+ DefaultEmail?: boolean;
49309
+
49310
+ @Field(() => Boolean, { nullable: true })
49311
+ DefaultSMS?: boolean;
49312
+
49313
+ @Field(() => Boolean, { nullable: true })
49314
+ AllowUserPreference?: boolean | null;
49315
+
49316
+ @Field({ nullable: true })
49317
+ EmailTemplateID?: string | null;
49318
+
49319
+ @Field({ nullable: true })
49320
+ SMSTemplateID?: string | null;
49321
+
49322
+ @Field({ nullable: true })
49323
+ Icon?: string | null;
49324
+
49325
+ @Field({ nullable: true })
49326
+ Color?: string | null;
49327
+
49328
+ @Field(() => Int, { nullable: true })
49329
+ AutoExpireDays?: number | null;
49330
+
49331
+ @Field(() => Int, { nullable: true })
49332
+ Priority?: number | null;
49333
+
49334
+ @Field(() => [KeyValuePairInput], { nullable: true })
49335
+ OldValues___?: KeyValuePairInput[];
49336
+ }
49337
+
49338
+ //****************************************************************************
49339
+ // RESOLVER for MJ: User Notification Types
49340
+ //****************************************************************************
49341
+ @ObjectType()
49342
+ export class RunMJUserNotificationTypeViewResult {
49343
+ @Field(() => [MJUserNotificationType_])
49344
+ Results: MJUserNotificationType_[];
49345
+
49346
+ @Field(() => String, {nullable: true})
49347
+ UserViewRunID?: string;
49348
+
49349
+ @Field(() => Int, {nullable: true})
49350
+ RowCount: number;
49351
+
49352
+ @Field(() => Int, {nullable: true})
49353
+ TotalRowCount: number;
49354
+
49355
+ @Field(() => Int, {nullable: true})
49356
+ ExecutionTime: number;
49357
+
49358
+ @Field({nullable: true})
49359
+ ErrorMessage?: string;
49360
+
49361
+ @Field(() => Boolean, {nullable: false})
49362
+ Success: boolean;
49363
+ }
49364
+
49365
+ @Resolver(MJUserNotificationType_)
49366
+ export class MJUserNotificationTypeResolver extends ResolverBase {
49367
+ @Query(() => RunMJUserNotificationTypeViewResult)
49368
+ async RunMJUserNotificationTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
49369
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49370
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
49371
+ }
49372
+
49373
+ @Query(() => RunMJUserNotificationTypeViewResult)
49374
+ async RunMJUserNotificationTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
49375
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49376
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
49377
+ }
49378
+
49379
+ @Query(() => RunMJUserNotificationTypeViewResult)
49380
+ async RunMJUserNotificationTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
49381
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49382
+ input.EntityName = 'MJ: User Notification Types';
49383
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
49384
+ }
49385
+ @Query(() => MJUserNotificationType_, { nullable: true })
49386
+ async MJUserNotificationType(@Arg('ID', () => String) ID: string, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJUserNotificationType_ | null> {
49387
+ this.CheckUserReadPermissions('MJ: User Notification Types', userPayload);
49388
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49389
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
49390
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationTypes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Types', userPayload, EntityPermissionType.Read, 'AND');
49391
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
49392
+ const result = await this.MapFieldNamesToCodeNames('MJ: User Notification Types', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
49393
+ return result;
49394
+ }
49395
+
49396
+ @FieldResolver(() => [MJUserNotification_])
49397
+ async UserNotifications_NotificationTypeIDArray(@Root() mjusernotificationtype_: MJUserNotificationType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
49398
+ this.CheckUserReadPermissions('User Notifications', userPayload);
49399
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49400
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
49401
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotifications] WHERE [NotificationTypeID]='${mjusernotificationtype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'User Notifications', userPayload, EntityPermissionType.Read, 'AND');
49402
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
49403
+ const result = await this.ArrayMapFieldNamesToCodeNames('User Notifications', rows, this.GetUserFromPayload(userPayload));
49404
+ return result;
49405
+ }
49406
+
49407
+ @FieldResolver(() => [MJUserNotificationPreference_])
49408
+ async MJ_UserNotificationPreferences_NotificationTypeIDArray(@Root() mjusernotificationtype_: MJUserNotificationType_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
49409
+ this.CheckUserReadPermissions('MJ: User Notification Preferences', userPayload);
49410
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
49411
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
49412
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationPreferences] WHERE [NotificationTypeID]='${mjusernotificationtype_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Preferences', userPayload, EntityPermissionType.Read, 'AND');
49413
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
49414
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Preferences', rows, this.GetUserFromPayload(userPayload));
49415
+ return result;
49416
+ }
49417
+
49418
+ @Mutation(() => MJUserNotificationType_)
49419
+ async CreateMJUserNotificationType(
49420
+ @Arg('input', () => CreateMJUserNotificationTypeInput) input: CreateMJUserNotificationTypeInput,
49421
+ @Ctx() { providers, userPayload }: AppContext,
49422
+ @PubSub() pubSub: PubSubEngine
49423
+ ) {
49424
+ const provider = GetReadWriteProvider(providers);
49425
+ return this.CreateRecord('MJ: User Notification Types', input, provider, userPayload, pubSub)
49426
+ }
49427
+
49428
+ @Mutation(() => MJUserNotificationType_)
49429
+ async UpdateMJUserNotificationType(
49430
+ @Arg('input', () => UpdateMJUserNotificationTypeInput) input: UpdateMJUserNotificationTypeInput,
49431
+ @Ctx() { providers, userPayload }: AppContext,
49432
+ @PubSub() pubSub: PubSubEngine
49433
+ ) {
49434
+ const provider = GetReadWriteProvider(providers);
49435
+ return this.UpdateRecord('MJ: User Notification Types', input, provider, userPayload, pubSub);
49436
+ }
49437
+
49438
+ @Mutation(() => MJUserNotificationType_)
49439
+ async DeleteMJUserNotificationType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
49440
+ const provider = GetReadWriteProvider(providers);
49441
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
49442
+ return this.DeleteRecord('MJ: User Notification Types', key, options, provider, userPayload, pubSub);
49443
+ }
49444
+
49445
+ }
49446
+
47215
49447
  //****************************************************************************
47216
49448
  // ENTITY CLASS for MJ: User Settings
47217
49449
  //****************************************************************************
@@ -55395,9 +57627,15 @@ export class MJTemplate_ {
55395
57627
  @Field(() => [MJTemplateContent_])
55396
57628
  TemplateContents_TemplateIDArray: MJTemplateContent_[]; // Link to TemplateContents
55397
57629
 
57630
+ @Field(() => [MJUserNotificationType_])
57631
+ MJ_UserNotificationTypes_SMSTemplateIDArray: MJUserNotificationType_[]; // Link to MJ_UserNotificationTypes
57632
+
55398
57633
  @Field(() => [MJAIPrompt_])
55399
57634
  AIPrompts_TemplateIDArray: MJAIPrompt_[]; // Link to AIPrompts
55400
57635
 
57636
+ @Field(() => [MJUserNotificationType_])
57637
+ MJ_UserNotificationTypes_EmailTemplateIDArray: MJUserNotificationType_[]; // Link to MJ_UserNotificationTypes
57638
+
55401
57639
  @Field(() => [MJEntityDocument_])
55402
57640
  EntityDocuments_TemplateIDArray: MJEntityDocument_[]; // Link to EntityDocuments
55403
57641
 
@@ -55553,6 +57791,17 @@ export class MJTemplateResolver extends ResolverBase {
55553
57791
  return result;
55554
57792
  }
55555
57793
 
57794
+ @FieldResolver(() => [MJUserNotificationType_])
57795
+ async MJ_UserNotificationTypes_SMSTemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
57796
+ this.CheckUserReadPermissions('MJ: User Notification Types', userPayload);
57797
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
57798
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
57799
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationTypes] WHERE [SMSTemplateID]='${mjtemplate_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Types', userPayload, EntityPermissionType.Read, 'AND');
57800
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
57801
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Types', rows, this.GetUserFromPayload(userPayload));
57802
+ return result;
57803
+ }
57804
+
55556
57805
  @FieldResolver(() => [MJAIPrompt_])
55557
57806
  async AIPrompts_TemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
55558
57807
  this.CheckUserReadPermissions('AI Prompts', userPayload);
@@ -55564,6 +57813,17 @@ export class MJTemplateResolver extends ResolverBase {
55564
57813
  return result;
55565
57814
  }
55566
57815
 
57816
+ @FieldResolver(() => [MJUserNotificationType_])
57817
+ async MJ_UserNotificationTypes_EmailTemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
57818
+ this.CheckUserReadPermissions('MJ: User Notification Types', userPayload);
57819
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
57820
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
57821
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationTypes] WHERE [EmailTemplateID]='${mjtemplate_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Types', userPayload, EntityPermissionType.Read, 'AND');
57822
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
57823
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Types', rows, this.GetUserFromPayload(userPayload));
57824
+ return result;
57825
+ }
57826
+
55567
57827
  @FieldResolver(() => [MJEntityDocument_])
55568
57828
  async EntityDocuments_TemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
55569
57829
  this.CheckUserReadPermissions('Entity Documents', userPayload);
@@ -56177,6 +58437,10 @@ export class MJUserNotification_ {
56177
58437
  @MaxLength(16)
56178
58438
  ResourceRecordID?: string;
56179
58439
 
58440
+ @Field({nullable: true, description: `Optional reference to notification type for categorization and delivery preferences`})
58441
+ @MaxLength(16)
58442
+ NotificationTypeID?: string;
58443
+
56180
58444
  @Field()
56181
58445
  @MaxLength(200)
56182
58446
  User: string;
@@ -56185,6 +58449,10 @@ export class MJUserNotification_ {
56185
58449
  @MaxLength(510)
56186
58450
  ResourceType?: string;
56187
58451
 
58452
+ @Field({nullable: true})
58453
+ @MaxLength(200)
58454
+ NotificationType?: string;
58455
+
56188
58456
  }
56189
58457
 
56190
58458
  //****************************************************************************
@@ -56218,6 +58486,9 @@ export class CreateMJUserNotificationInput {
56218
58486
 
56219
58487
  @Field({ nullable: true })
56220
58488
  ResourceRecordID: string | null;
58489
+
58490
+ @Field({ nullable: true })
58491
+ NotificationTypeID: string | null;
56221
58492
  }
56222
58493
 
56223
58494
 
@@ -56253,6 +58524,9 @@ export class UpdateMJUserNotificationInput {
56253
58524
  @Field({ nullable: true })
56254
58525
  ResourceRecordID?: string | null;
56255
58526
 
58527
+ @Field({ nullable: true })
58528
+ NotificationTypeID?: string | null;
58529
+
56256
58530
  @Field(() => [KeyValuePairInput], { nullable: true })
56257
58531
  OldValues___?: KeyValuePairInput[];
56258
58532
  }
@@ -57918,6 +60192,12 @@ export class MJUser_ {
57918
60192
  @Field(() => [MJDashboardPermission_])
57919
60193
  MJ_DashboardPermissions_SharedByUserIDArray: MJDashboardPermission_[]; // Link to MJ_DashboardPermissions
57920
60194
 
60195
+ @Field(() => [MJAPIKey_])
60196
+ MJ_APIKeys_UserIDArray: MJAPIKey_[]; // Link to MJ_APIKeys
60197
+
60198
+ @Field(() => [MJUserNotificationPreference_])
60199
+ MJ_UserNotificationPreferences_UserIDArray: MJUserNotificationPreference_[]; // Link to MJ_UserNotificationPreferences
60200
+
57921
60201
  @Field(() => [MJResourcePermission_])
57922
60202
  ResourcePermissions_UserIDArray: MJResourcePermission_[]; // Link to ResourcePermissions
57923
60203
 
@@ -57951,6 +60231,9 @@ export class MJUser_ {
57951
60231
  @Field(() => [MJDashboardCategoryPermission_])
57952
60232
  MJ_DashboardCategoryPermissions_SharedByUserIDArray: MJDashboardCategoryPermission_[]; // Link to MJ_DashboardCategoryPermissions
57953
60233
 
60234
+ @Field(() => [MJAPIKey_])
60235
+ MJ_APIKeys_CreatedByUserIDArray: MJAPIKey_[]; // Link to MJ_APIKeys
60236
+
57954
60237
  @Field(() => [MJAIAgentRun_])
57955
60238
  MJ_AIAgentRuns_UserIDArray: MJAIAgentRun_[]; // Link to MJ_AIAgentRuns
57956
60239
 
@@ -58726,6 +61009,28 @@ export class MJUserResolverBase extends ResolverBase {
58726
61009
  return result;
58727
61010
  }
58728
61011
 
61012
+ @FieldResolver(() => [MJAPIKey_])
61013
+ async MJ_APIKeys_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
61014
+ this.CheckUserReadPermissions('MJ: API Keys', userPayload);
61015
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
61016
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
61017
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeys] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Keys', userPayload, EntityPermissionType.Read, 'AND');
61018
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
61019
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Keys', rows, this.GetUserFromPayload(userPayload));
61020
+ return result;
61021
+ }
61022
+
61023
+ @FieldResolver(() => [MJUserNotificationPreference_])
61024
+ async MJ_UserNotificationPreferences_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
61025
+ this.CheckUserReadPermissions('MJ: User Notification Preferences', userPayload);
61026
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
61027
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
61028
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Preferences', userPayload, EntityPermissionType.Read, 'AND');
61029
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
61030
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Preferences', rows, this.GetUserFromPayload(userPayload));
61031
+ return result;
61032
+ }
61033
+
58729
61034
  @FieldResolver(() => [MJResourcePermission_])
58730
61035
  async ResourcePermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
58731
61036
  this.CheckUserReadPermissions('Resource Permissions', userPayload);
@@ -58847,6 +61152,17 @@ export class MJUserResolverBase extends ResolverBase {
58847
61152
  return result;
58848
61153
  }
58849
61154
 
61155
+ @FieldResolver(() => [MJAPIKey_])
61156
+ async MJ_APIKeys_CreatedByUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
61157
+ this.CheckUserReadPermissions('MJ: API Keys', userPayload);
61158
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
61159
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
61160
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeys] WHERE [CreatedByUserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Keys', userPayload, EntityPermissionType.Read, 'AND');
61161
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
61162
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Keys', rows, this.GetUserFromPayload(userPayload));
61163
+ return result;
61164
+ }
61165
+
58850
61166
  @FieldResolver(() => [MJAIAgentRun_])
58851
61167
  async MJ_AIAgentRuns_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { dataSources, userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
58852
61168
  this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);