@memberjunction/server 5.32.0 → 5.34.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 (73) hide show
  1. package/README.md +2 -1
  2. package/dist/agents/skip-agent.d.ts +3 -1
  3. package/dist/agents/skip-agent.d.ts.map +1 -1
  4. package/dist/agents/skip-agent.js +15 -3
  5. package/dist/agents/skip-agent.js.map +1 -1
  6. package/dist/auth/newUsers.d.ts.map +1 -1
  7. package/dist/auth/newUsers.js +11 -3
  8. package/dist/auth/newUsers.js.map +1 -1
  9. package/dist/context.d.ts.map +1 -1
  10. package/dist/context.js +23 -3
  11. package/dist/context.js.map +1 -1
  12. package/dist/generated/generated.d.ts +551 -5
  13. package/dist/generated/generated.d.ts.map +1 -1
  14. package/dist/generated/generated.js +3277 -120
  15. package/dist/generated/generated.js.map +1 -1
  16. package/dist/generic/ResolverBase.d.ts +1 -1
  17. package/dist/generic/ResolverBase.d.ts.map +1 -1
  18. package/dist/generic/ResolverBase.js +9 -2
  19. package/dist/generic/ResolverBase.js.map +1 -1
  20. package/dist/generic/RunViewResolver.d.ts +5 -1
  21. package/dist/generic/RunViewResolver.d.ts.map +1 -1
  22. package/dist/generic/RunViewResolver.js +33 -2
  23. package/dist/generic/RunViewResolver.js.map +1 -1
  24. package/dist/index.d.ts +12 -2
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +29 -9
  27. package/dist/index.js.map +1 -1
  28. package/dist/resolvers/AvailableSearchProvidersResolver.d.ts +26 -0
  29. package/dist/resolvers/AvailableSearchProvidersResolver.d.ts.map +1 -0
  30. package/dist/resolvers/AvailableSearchProvidersResolver.js +65 -0
  31. package/dist/resolvers/AvailableSearchProvidersResolver.js.map +1 -0
  32. package/dist/resolvers/ComponentRegistryResolver.d.ts +11 -25
  33. package/dist/resolvers/ComponentRegistryResolver.d.ts.map +1 -1
  34. package/dist/resolvers/ComponentRegistryResolver.js +51 -93
  35. package/dist/resolvers/ComponentRegistryResolver.js.map +1 -1
  36. package/dist/resolvers/GetDataResolver.d.ts.map +1 -1
  37. package/dist/resolvers/GetDataResolver.js +5 -1
  38. package/dist/resolvers/GetDataResolver.js.map +1 -1
  39. package/dist/resolvers/IntegrationDiscoveryResolver.d.ts.map +1 -1
  40. package/dist/resolvers/IntegrationDiscoveryResolver.js +9 -4
  41. package/dist/resolvers/IntegrationDiscoveryResolver.js.map +1 -1
  42. package/dist/resolvers/QuerySystemUserResolver.d.ts +6 -0
  43. package/dist/resolvers/QuerySystemUserResolver.d.ts.map +1 -1
  44. package/dist/resolvers/QuerySystemUserResolver.js +31 -1
  45. package/dist/resolvers/QuerySystemUserResolver.js.map +1 -1
  46. package/dist/resolvers/SearchKnowledgeResolver.d.ts +44 -1
  47. package/dist/resolvers/SearchKnowledgeResolver.d.ts.map +1 -1
  48. package/dist/resolvers/SearchKnowledgeResolver.js +217 -7
  49. package/dist/resolvers/SearchKnowledgeResolver.js.map +1 -1
  50. package/dist/resolvers/SearchKnowledgeStreamResolver.d.ts +79 -0
  51. package/dist/resolvers/SearchKnowledgeStreamResolver.d.ts.map +1 -0
  52. package/dist/resolvers/SearchKnowledgeStreamResolver.js +342 -0
  53. package/dist/resolvers/SearchKnowledgeStreamResolver.js.map +1 -0
  54. package/dist/types.d.ts +6 -1
  55. package/dist/types.d.ts.map +1 -1
  56. package/dist/types.js.map +1 -1
  57. package/package.json +68 -68
  58. package/src/__tests__/databaseAbstraction.test.ts +123 -61
  59. package/src/agents/skip-agent.ts +18 -4
  60. package/src/auth/newUsers.ts +12 -3
  61. package/src/context.ts +21 -3
  62. package/src/generated/generated.ts +2229 -80
  63. package/src/generic/ResolverBase.ts +11 -2
  64. package/src/generic/RunViewResolver.ts +29 -2
  65. package/src/index.ts +29 -9
  66. package/src/resolvers/AvailableSearchProvidersResolver.ts +43 -0
  67. package/src/resolvers/ComponentRegistryResolver.ts +71 -123
  68. package/src/resolvers/GetDataResolver.ts +6 -2
  69. package/src/resolvers/IntegrationDiscoveryResolver.ts +10 -4
  70. package/src/resolvers/QuerySystemUserResolver.ts +27 -1
  71. package/src/resolvers/SearchKnowledgeResolver.ts +205 -4
  72. package/src/resolvers/SearchKnowledgeStreamResolver.ts +338 -0
  73. package/src/types.ts +6 -1
@@ -18,7 +18,7 @@ import { mj_core_schema } from '../config.js';
18
18
 
19
19
 
20
20
 
21
- import { MJAccessControlRuleEntity, MJActionAuthorizationEntity, MJActionCategoryEntity, MJActionContextTypeEntity, MJActionContextEntity, MJActionExecutionLogEntity, MJActionFilterEntity, MJActionLibraryEntity, MJActionParamEntity, MJActionResultCodeEntity, MJActionEntity, MJAIActionEntity, MJAIAgentActionEntity, MJAIAgentArtifactTypeEntity, MJAIAgentCategoryEntity, MJAIAgentClientToolEntity, MJAIAgentConfigurationEntity, MJAIAgentDataSourceEntity, MJAIAgentExampleEntity, MJAIAgentLearningCycleEntity, MJAIAgentModalityEntity, MJAIAgentModelEntity, MJAIAgentNoteTypeEntity, MJAIAgentNoteEntity, MJAIAgentPermissionEntity, MJAIAgentPromptEntity, MJAIAgentRelationshipEntity, MJAIAgentRequestTypeEntity, MJAIAgentRequestEntity, MJAIAgentRunMediaEntity, MJAIAgentRunStepEntity, MJAIAgentRunEntity, MJAIAgentStepPathEntity, MJAIAgentStepEntity, MJAIAgentTypeEntity, MJAIAgentEntity, MJAIArchitectureEntity, MJAIClientToolDefinitionEntity, MJAIConfigurationParamEntity, MJAIConfigurationEntity, MJAICredentialBindingEntity, MJAIModalityEntity, MJAIModelActionEntity, MJAIModelArchitectureEntity, MJAIModelCostEntity, MJAIModelModalityEntity, MJAIModelPriceTypeEntity, MJAIModelPriceUnitTypeEntity, MJAIModelTypeEntity, MJAIModelVendorEntity, MJAIModelEntity, MJAIPromptCategoryEntity, MJAIPromptModelEntity, MJAIPromptRunMediaEntity, MJAIPromptRunEntity, MJAIPromptTypeEntity, MJAIPromptEntity, MJAIResultCacheEntity, MJAIVendorTypeDefinitionEntity, MJAIVendorTypeEntity, MJAIVendorEntity, MJAPIApplicationScopeEntity, MJAPIApplicationEntity, MJAPIKeyApplicationEntity, MJAPIKeyScopeEntity, MJAPIKeyUsageLogEntity, MJAPIKeyEntity, MJAPIScopeEntity, MJApplicationEntityEntity, MJApplicationRoleEntity, MJApplicationSettingEntity, MJApplicationEntity, MJArchiveConfigurationEntityEntity, MJArchiveConfigurationEntity, MJArchiveRunDetailEntity, MJArchiveRunEntity, MJArtifactPermissionEntity, MJArtifactTypeEntity, MJArtifactUseEntity, MJArtifactVersionAttributeEntity, MJArtifactVersionEntity, MJArtifactEntity, MJAuditLogTypeEntity, MJAuditLogEntity, MJAuthorizationRoleEntity, MJAuthorizationEntity, MJCollectionArtifactEntity, MJCollectionPermissionEntity, MJCollectionEntity, MJCommunicationBaseMessageTypeEntity, MJCommunicationLogEntity, MJCommunicationProviderMessageTypeEntity, MJCommunicationProviderEntity, MJCommunicationRunEntity, MJCompanyEntity, MJCompanyIntegrationEntityMapEntity, MJCompanyIntegrationFieldMapEntity, MJCompanyIntegrationRecordMapEntity, MJCompanyIntegrationRunAPILogEntity, MJCompanyIntegrationRunDetailEntity, MJCompanyIntegrationRunEntity, MJCompanyIntegrationSyncWatermarkEntity, MJCompanyIntegrationEntity, MJComponentDependencyEntity, MJComponentLibraryEntity, MJComponentLibraryLinkEntity, MJComponentRegistryEntity, MJComponentEntity, MJContentFileTypeEntity, MJContentItemAttributeEntity, MJContentItemDuplicateEntity, MJContentItemTagEntity, MJContentItemEntity, MJContentProcessRunDetailEntity, MJContentProcessRunPromptRunEntity, MJContentProcessRunEntity, MJContentSourceParamEntity, MJContentSourceTypeParamEntity, MJContentSourceTypeEntity, MJContentSourceEntity, MJContentTypeAttributeEntity, MJContentTypeEntity, MJConversationArtifactPermissionEntity, MJConversationArtifactVersionEntity, MJConversationArtifactEntity, MJConversationDetailArtifactEntity, MJConversationDetailAttachmentEntity, MJConversationDetailRatingEntity, MJConversationDetailEntity, MJConversationEntity, MJCountryEntity, MJCredentialCategoryEntity, MJCredentialTypeEntity, MJCredentialEntity, MJDashboardCategoryEntity, MJDashboardCategoryLinkEntity, MJDashboardCategoryPermissionEntity, MJDashboardPartTypeEntity, MJDashboardPermissionEntity, MJDashboardUserPreferenceEntity, MJDashboardUserStateEntity, MJDashboardEntity, MJDataContextItemEntity, MJDataContextEntity, MJDatasetItemEntity, MJDatasetEntity, MJDuplicateRunDetailMatchEntity, MJDuplicateRunDetailEntity, MJDuplicateRunEntity, MJEmployeeCompanyIntegrationEntity, MJEmployeeRoleEntity, MJEmployeeSkillEntity, MJEmployeeEntity, MJEncryptionAlgorithmEntity, MJEncryptionKeySourceEntity, MJEncryptionKeyEntity, MJEntityEntity, MJEntityActionFilterEntity, MJEntityActionInvocationTypeEntity, MJEntityActionInvocationEntity, MJEntityActionParamEntity, MJEntityActionEntity, MJEntityAIActionEntity, MJEntityCommunicationFieldEntity, MJEntityCommunicationMessageTypeEntity, MJEntityDocumentRunEntity, MJEntityDocumentSettingEntity, MJEntityDocumentTypeEntity, MJEntityDocumentEntity, MJEntityFieldValueEntity, MJEntityFieldEntity, MJEntityOrganicKeyRelatedEntityEntity, MJEntityOrganicKeyEntity, MJEntityPermissionEntity, MJEntityRecordDocumentEntity, MJEntityRelationshipDisplayComponentEntity, MJEntityRelationshipEntity, MJEntitySettingEntity, MJEnvironmentEntity, MJErrorLogEntity, MJExplorerNavigationItemEntity, MJFileCategoryEntity, MJFileEntityRecordLinkEntity, MJFileStorageAccountPermissionEntity, MJFileStorageAccountEntity, MJFileStorageProviderEntity, MJFileEntity, MJGeneratedCodeCategoryEntity, MJGeneratedCodeEntity, MJInstanceConfigurationEntity, MJIntegrationObjectFieldEntity, MJIntegrationObjectEntity, MJIntegrationSourceTypeEntity, MJIntegrationURLFormatEntity, MJIntegrationEntity, MJKnowledgeHubSavedSearchEntity, MJLibraryEntity, MJLibraryItemEntity, MJListCategoryEntity, MJListDetailEntity, MJListInvitationEntity, MJListShareEntity, MJListEntity, MJMCPServerConnectionPermissionEntity, MJMCPServerConnectionToolEntity, MJMCPServerConnectionEntity, MJMCPServerToolEntity, MJMCPServerEntity, MJMCPToolExecutionLogEntity, MJMCPToolFavoriteEntity, MJOAuthAuthServerMetadataCacheEntity, MJOAuthAuthorizationStateEntity, MJOAuthClientRegistrationEntity, MJOAuthTokenEntity, MJOpenAppDependencyEntity, MJOpenAppInstallHistoryEntity, MJOpenAppEntity, MJOutputDeliveryTypeEntity, MJOutputFormatTypeEntity, MJOutputTriggerTypeEntity, MJPermissionDomainEntity, MJProjectEntity, MJPublicLinkEntity, MJQueryEntity, MJQueryCategoryEntity, MJQueryDependencyEntity, MJQueryEntityEntity, MJQueryFieldEntity, MJQueryParameterEntity, MJQueryPermissionEntity, MJQuerySQLEntity, MJQueueTaskEntity, MJQueueTypeEntity, MJQueueEntity, MJRecommendationItemEntity, MJRecommendationProviderEntity, MJRecommendationRunEntity, MJRecommendationEntity, MJRecordChangeReplayRunEntity, MJRecordChangeEntity, MJRecordGeoCodeEntity, MJRecordLinkEntity, MJRecordMergeDeletionLogEntity, MJRecordMergeLogEntity, MJReportCategoryEntity, MJReportSnapshotEntity, MJReportUserStateEntity, MJReportVersionEntity, MJReportEntity, MJResourceLinkEntity, MJResourcePermissionEntity, MJResourceTypeEntity, MJRoleEntity, MJRowLevelSecurityFilterEntity, MJScheduledActionParamEntity, MJScheduledActionEntity, MJScheduledJobRunEntity, MJScheduledJobTypeEntity, MJScheduledJobEntity, MJSchemaInfoEntity, MJSearchProviderEntity, MJSkillEntity, MJSQLDialectEntity, MJStateProvinceEntity, MJTagAuditLogEntity, MJTagCoOccurrenceEntity, MJTagScopeEntity, MJTagSuggestionEntity, MJTagSynonymEntity, MJTaggedItemEntity, MJTagEntity, MJTaskDependencyEntity, MJTaskTypeEntity, MJTaskEntity, MJTemplateCategoryEntity, MJTemplateContentTypeEntity, MJTemplateContentEntity, MJTemplateParamEntity, MJTemplateEntity, MJTestRubricEntity, MJTestRunFeedbackEntity, MJTestRunOutputTypeEntity, MJTestRunOutputEntity, MJTestRunEntity, MJTestSuiteRunEntity, MJTestSuiteTestEntity, MJTestSuiteEntity, MJTestTypeEntity, MJTestEntity, MJUserApplicationEntityEntity, MJUserApplicationEntity, MJUserFavoriteEntity, MJUserNotificationPreferenceEntity, MJUserNotificationTypeEntity, MJUserNotificationEntity, MJUserRecordLogEntity, MJUserRoleEntity, MJUserSettingEntity, MJUserViewCategoryEntity, MJUserViewRunDetailEntity, MJUserViewRunEntity, MJUserViewEntity, MJUserEntity, MJVectorDatabaseEntity, MJVectorIndexEntity, MJVersionInstallationEntity, MJVersionLabelItemEntity, MJVersionLabelRestoreEntity, MJVersionLabelEntity, MJWorkflowEngineEntity, MJWorkflowRunEntity, MJWorkflowEntity, MJWorkspaceItemEntity, MJWorkspaceEntity } from '@memberjunction/core-entities';
21
+ import { MJAccessControlRuleEntity, MJActionAuthorizationEntity, MJActionCategoryEntity, MJActionContextTypeEntity, MJActionContextEntity, MJActionExecutionLogEntity, MJActionFilterEntity, MJActionLibraryEntity, MJActionParamEntity, MJActionResultCodeEntity, MJActionEntity, MJAIActionEntity, MJAIAgentActionEntity, MJAIAgentArtifactTypeEntity, MJAIAgentCategoryEntity, MJAIAgentClientToolEntity, MJAIAgentConfigurationEntity, MJAIAgentDataSourceEntity, MJAIAgentExampleEntity, MJAIAgentLearningCycleEntity, MJAIAgentModalityEntity, MJAIAgentModelEntity, MJAIAgentNoteTypeEntity, MJAIAgentNoteEntity, MJAIAgentPermissionEntity, MJAIAgentPromptEntity, MJAIAgentRelationshipEntity, MJAIAgentRequestTypeEntity, MJAIAgentRequestEntity, MJAIAgentRunMediaEntity, MJAIAgentRunStepEntity, MJAIAgentRunEntity, MJAIAgentSearchScopeEntity, MJAIAgentStepPathEntity, MJAIAgentStepEntity, MJAIAgentTypeEntity, MJAIAgentEntity, MJAIArchitectureEntity, MJAIClientToolDefinitionEntity, MJAIConfigurationParamEntity, MJAIConfigurationEntity, MJAICredentialBindingEntity, MJAIModalityEntity, MJAIModelActionEntity, MJAIModelArchitectureEntity, MJAIModelCostEntity, MJAIModelModalityEntity, MJAIModelPriceTypeEntity, MJAIModelPriceUnitTypeEntity, MJAIModelTypeEntity, MJAIModelVendorEntity, MJAIModelEntity, MJAIPromptCategoryEntity, MJAIPromptModelEntity, MJAIPromptRunMediaEntity, MJAIPromptRunEntity, MJAIPromptTypeEntity, MJAIPromptEntity, MJAIResultCacheEntity, MJAIVendorTypeDefinitionEntity, MJAIVendorTypeEntity, MJAIVendorEntity, MJAPIApplicationScopeEntity, MJAPIApplicationEntity, MJAPIKeyApplicationEntity, MJAPIKeyScopeEntity, MJAPIKeyUsageLogEntity, MJAPIKeyEntity, MJAPIScopeEntity, MJApplicationEntityEntity, MJApplicationRoleEntity, MJApplicationSettingEntity, MJApplicationEntity, MJArchiveConfigurationEntityEntity, MJArchiveConfigurationEntity, MJArchiveRunDetailEntity, MJArchiveRunEntity, MJArtifactPermissionEntity, MJArtifactTypeEntity, MJArtifactUseEntity, MJArtifactVersionAttributeEntity, MJArtifactVersionEntity, MJArtifactEntity, MJAuditLogTypeEntity, MJAuditLogEntity, MJAuthorizationRoleEntity, MJAuthorizationEntity, MJCollectionArtifactEntity, MJCollectionPermissionEntity, MJCollectionEntity, MJCommunicationBaseMessageTypeEntity, MJCommunicationLogEntity, MJCommunicationProviderMessageTypeEntity, MJCommunicationProviderEntity, MJCommunicationRunEntity, MJCompanyEntity, MJCompanyIntegrationEntityMapEntity, MJCompanyIntegrationFieldMapEntity, MJCompanyIntegrationRecordMapEntity, MJCompanyIntegrationRunAPILogEntity, MJCompanyIntegrationRunDetailEntity, MJCompanyIntegrationRunEntity, MJCompanyIntegrationSyncWatermarkEntity, MJCompanyIntegrationEntity, MJComponentDependencyEntity, MJComponentLibraryEntity, MJComponentLibraryLinkEntity, MJComponentRegistryEntity, MJComponentEntity, MJContentFileTypeEntity, MJContentItemAttributeEntity, MJContentItemDuplicateEntity, MJContentItemTagEntity, MJContentItemEntity, MJContentProcessRunDetailEntity, MJContentProcessRunPromptRunEntity, MJContentProcessRunEntity, MJContentSourceParamEntity, MJContentSourceTypeParamEntity, MJContentSourceTypeEntity, MJContentSourceEntity, MJContentTypeAttributeEntity, MJContentTypeEntity, MJConversationArtifactPermissionEntity, MJConversationArtifactVersionEntity, MJConversationArtifactEntity, MJConversationDetailArtifactEntity, MJConversationDetailAttachmentEntity, MJConversationDetailRatingEntity, MJConversationDetailEntity, MJConversationEntity, MJCountryEntity, MJCredentialCategoryEntity, MJCredentialTypeEntity, MJCredentialEntity, MJDashboardCategoryEntity, MJDashboardCategoryLinkEntity, MJDashboardCategoryPermissionEntity, MJDashboardPartTypeEntity, MJDashboardPermissionEntity, MJDashboardUserPreferenceEntity, MJDashboardUserStateEntity, MJDashboardEntity, MJDataContextItemEntity, MJDataContextEntity, MJDatasetItemEntity, MJDatasetEntity, MJDuplicateRunDetailMatchEntity, MJDuplicateRunDetailEntity, MJDuplicateRunEntity, MJEmployeeCompanyIntegrationEntity, MJEmployeeRoleEntity, MJEmployeeSkillEntity, MJEmployeeEntity, MJEncryptionAlgorithmEntity, MJEncryptionKeySourceEntity, MJEncryptionKeyEntity, MJEntityEntity, MJEntityActionFilterEntity, MJEntityActionInvocationTypeEntity, MJEntityActionInvocationEntity, MJEntityActionParamEntity, MJEntityActionEntity, MJEntityAIActionEntity, MJEntityCommunicationFieldEntity, MJEntityCommunicationMessageTypeEntity, MJEntityDocumentRunEntity, MJEntityDocumentSettingEntity, MJEntityDocumentTypeEntity, MJEntityDocumentEntity, MJEntityFieldValueEntity, MJEntityFieldEntity, MJEntityOrganicKeyRelatedEntityEntity, MJEntityOrganicKeyEntity, MJEntityPermissionEntity, MJEntityRecordDocumentEntity, MJEntityRelationshipDisplayComponentEntity, MJEntityRelationshipEntity, MJEntitySettingEntity, MJEnvironmentEntity, MJErrorLogEntity, MJExplorerNavigationItemEntity, MJFileCategoryEntity, MJFileEntityRecordLinkEntity, MJFileStorageAccountPermissionEntity, MJFileStorageAccountEntity, MJFileStorageProviderEntity, MJFileEntity, MJGeneratedCodeCategoryEntity, MJGeneratedCodeEntity, MJInstanceConfigurationEntity, MJIntegrationObjectFieldEntity, MJIntegrationObjectEntity, MJIntegrationSourceTypeEntity, MJIntegrationURLFormatEntity, MJIntegrationEntity, MJKnowledgeHubSavedSearchEntity, MJLibraryEntity, MJLibraryItemEntity, MJListCategoryEntity, MJListDetailEntity, MJListInvitationEntity, MJListShareEntity, MJListEntity, MJMCPServerConnectionPermissionEntity, MJMCPServerConnectionToolEntity, MJMCPServerConnectionEntity, MJMCPServerToolEntity, MJMCPServerEntity, MJMCPToolExecutionLogEntity, MJMCPToolFavoriteEntity, MJOAuthAuthServerMetadataCacheEntity, MJOAuthAuthorizationStateEntity, MJOAuthClientRegistrationEntity, MJOAuthTokenEntity, MJOpenAppDependencyEntity, MJOpenAppInstallHistoryEntity, MJOpenAppEntity, MJOutputDeliveryTypeEntity, MJOutputFormatTypeEntity, MJOutputTriggerTypeEntity, MJPermissionDomainEntity, MJProjectEntity, MJPublicLinkEntity, MJQueryEntity, MJQueryCategoryEntity, MJQueryDependencyEntity, MJQueryEntityEntity, MJQueryFieldEntity, MJQueryParameterEntity, MJQueryPermissionEntity, MJQuerySQLEntity, MJQueueTaskEntity, MJQueueTypeEntity, MJQueueEntity, MJRecommendationItemEntity, MJRecommendationProviderEntity, MJRecommendationRunEntity, MJRecommendationEntity, MJRecordChangeReplayRunEntity, MJRecordChangeEntity, MJRecordGeoCodeEntity, MJRecordLinkEntity, MJRecordMergeDeletionLogEntity, MJRecordMergeLogEntity, MJReportCategoryEntity, MJReportSnapshotEntity, MJReportUserStateEntity, MJReportVersionEntity, MJReportEntity, MJResourceLinkEntity, MJResourcePermissionEntity, MJResourceTypeEntity, MJRoleEntity, MJRowLevelSecurityFilterEntity, MJScheduledActionParamEntity, MJScheduledActionEntity, MJScheduledJobRunEntity, MJScheduledJobTypeEntity, MJScheduledJobEntity, MJSchemaInfoEntity, MJSearchExecutionLogEntity, MJSearchProviderEntity, MJSearchScopeEntityEntity, MJSearchScopeExternalIndexEntity, MJSearchScopePermissionEntity, MJSearchScopeProviderEntity, MJSearchScopeStorageAccountEntity, MJSearchScopeTestQueryEntity, MJSearchScopeEntity, MJSkillEntity, MJSQLDialectEntity, MJStateProvinceEntity, MJTagAuditLogEntity, MJTagCoOccurrenceEntity, MJTagScopeEntity, MJTagSuggestionEntity, MJTagSynonymEntity, MJTaggedItemEntity, MJTagEntity, MJTaskDependencyEntity, MJTaskTypeEntity, MJTaskEntity, MJTemplateCategoryEntity, MJTemplateContentTypeEntity, MJTemplateContentEntity, MJTemplateParamEntity, MJTemplateEntity, MJTestRubricEntity, MJTestRunFeedbackEntity, MJTestRunOutputTypeEntity, MJTestRunOutputEntity, MJTestRunEntity, MJTestSuiteRunEntity, MJTestSuiteTestEntity, MJTestSuiteEntity, MJTestTypeEntity, MJTestEntity, MJUserApplicationEntityEntity, MJUserApplicationEntity, MJUserFavoriteEntity, MJUserNotificationPreferenceEntity, MJUserNotificationTypeEntity, MJUserNotificationEntity, MJUserRecordLogEntity, MJUserRoleEntity, MJUserSettingEntity, MJUserViewCategoryEntity, MJUserViewRunDetailEntity, MJUserViewRunEntity, MJUserViewEntity, MJUserEntity, MJVectorDatabaseEntity, MJVectorIndexEntity, MJVersionInstallationEntity, MJVersionLabelItemEntity, MJVersionLabelRestoreEntity, MJVersionLabelEntity, MJWorkflowEngineEntity, MJWorkflowRunEntity, MJWorkflowEntity, MJWorkspaceItemEntity, MJWorkspaceEntity } from '@memberjunction/core-entities';
22
22
 
23
23
 
24
24
  //****************************************************************************
@@ -8139,6 +8139,262 @@ export class MJAIAgentRunResolver extends ResolverBase {
8139
8139
 
8140
8140
  }
8141
8141
 
8142
+ //****************************************************************************
8143
+ // ENTITY CLASS for MJ: AI Agent Search Scopes
8144
+ //****************************************************************************
8145
+ @ObjectType({ description: `Many-to-many between agents and search scopes, with phase and scheduling control. Drives both pre-execution RAG and agent-invoked scoped search.` })
8146
+ export class MJAIAgentSearchScope_ {
8147
+ @Field()
8148
+ @MaxLength(36)
8149
+ ID: string;
8150
+
8151
+ @Field()
8152
+ @MaxLength(36)
8153
+ AgentID: string;
8154
+
8155
+ @Field()
8156
+ @MaxLength(36)
8157
+ SearchScopeID: string;
8158
+
8159
+ @Field({description: `When this scope is used: PreExecution (injected as retrieved context before the agent runs), AgentInvoked (callable via the scoped search Action), or Both.`})
8160
+ @MaxLength(20)
8161
+ Phase: string;
8162
+
8163
+ @Field({description: `Lifecycle status. Only Active rows are considered at runtime.`})
8164
+ @MaxLength(20)
8165
+ Status: string;
8166
+
8167
+ @Field({nullable: true, description: `Time-windowed activation for this agent-scope assignment. NULL = immediately active.`})
8168
+ StartAt?: Date;
8169
+
8170
+ @Field({nullable: true, description: `Time-windowed deactivation for this agent-scope assignment. NULL = no expiry.`})
8171
+ EndAt?: Date;
8172
+
8173
+ @Field(() => Int, {description: `Ordering within Phase. Lower = higher priority. Used for pre-execution ordering and as default preference for agent-invoked scope selection.`})
8174
+ Priority: number;
8175
+
8176
+ @Field(() => Int, {nullable: true, description: `Override max results for this scope when used by this agent. NULL = use scope/engine default.`})
8177
+ MaxResults?: number;
8178
+
8179
+ @Field(() => Float, {nullable: true, description: `Override min score threshold (0.0000–1.0000). NULL = use engine default.`})
8180
+ MinScore?: number;
8181
+
8182
+ @Field({nullable: true, description: `FK to Templates. MJ Template used to generate the search query from conversation context (lastUserMessage, recentMessages, payload, etc.). NULL = use lastUserMessage as-is. Can be further specialized per-provider via SearchScopeProvider.QueryTransformTemplateID.`})
8183
+ @MaxLength(36)
8184
+ QueryTemplateID?: string;
8185
+
8186
+ @Field({nullable: true, description: `JSON override for RRF per-provider fusion weights when this agent uses this scope. Resolution order: AIAgentSearchScope.FusionWeightsOverride > SearchScope.ScopeConfig.fusionWeights > engine defaults. Example: { "vector": 2.0, "fulltext": 1.0, "entity": 1.0 }.`})
8187
+ FusionWeightsOverride?: string;
8188
+
8189
+ @Field(() => Boolean, {description: `If true, this is the agent's default scope when no scope is specified in a tool call.`})
8190
+ IsDefault: boolean;
8191
+
8192
+ @Field()
8193
+ _mj__CreatedAt: Date;
8194
+
8195
+ @Field()
8196
+ _mj__UpdatedAt: Date;
8197
+
8198
+ @Field({nullable: true})
8199
+ @MaxLength(255)
8200
+ Agent?: string;
8201
+
8202
+ @Field()
8203
+ @MaxLength(200)
8204
+ SearchScope: string;
8205
+
8206
+ @Field({nullable: true})
8207
+ @MaxLength(255)
8208
+ QueryTemplate?: string;
8209
+
8210
+ }
8211
+
8212
+ //****************************************************************************
8213
+ // INPUT TYPE for MJ: AI Agent Search Scopes
8214
+ //****************************************************************************
8215
+ @InputType()
8216
+ export class CreateMJAIAgentSearchScopeInput {
8217
+ @Field({ nullable: true })
8218
+ ID?: string;
8219
+
8220
+ @Field({ nullable: true })
8221
+ AgentID?: string;
8222
+
8223
+ @Field({ nullable: true })
8224
+ SearchScopeID?: string;
8225
+
8226
+ @Field({ nullable: true })
8227
+ Phase?: string;
8228
+
8229
+ @Field({ nullable: true })
8230
+ Status?: string;
8231
+
8232
+ @Field({ nullable: true })
8233
+ StartAt: Date | null;
8234
+
8235
+ @Field({ nullable: true })
8236
+ EndAt: Date | null;
8237
+
8238
+ @Field(() => Int, { nullable: true })
8239
+ Priority?: number;
8240
+
8241
+ @Field(() => Int, { nullable: true })
8242
+ MaxResults: number | null;
8243
+
8244
+ @Field(() => Float, { nullable: true })
8245
+ MinScore: number | null;
8246
+
8247
+ @Field({ nullable: true })
8248
+ QueryTemplateID: string | null;
8249
+
8250
+ @Field({ nullable: true })
8251
+ FusionWeightsOverride: string | null;
8252
+
8253
+ @Field(() => Boolean, { nullable: true })
8254
+ IsDefault?: boolean;
8255
+
8256
+ @Field(() => RestoreContextInput, { nullable: true })
8257
+ RestoreContext___?: RestoreContextInput;
8258
+ }
8259
+
8260
+
8261
+ //****************************************************************************
8262
+ // INPUT TYPE for MJ: AI Agent Search Scopes
8263
+ //****************************************************************************
8264
+ @InputType()
8265
+ export class UpdateMJAIAgentSearchScopeInput {
8266
+ @Field()
8267
+ ID: string;
8268
+
8269
+ @Field({ nullable: true })
8270
+ AgentID?: string;
8271
+
8272
+ @Field({ nullable: true })
8273
+ SearchScopeID?: string;
8274
+
8275
+ @Field({ nullable: true })
8276
+ Phase?: string;
8277
+
8278
+ @Field({ nullable: true })
8279
+ Status?: string;
8280
+
8281
+ @Field({ nullable: true })
8282
+ StartAt?: Date | null;
8283
+
8284
+ @Field({ nullable: true })
8285
+ EndAt?: Date | null;
8286
+
8287
+ @Field(() => Int, { nullable: true })
8288
+ Priority?: number;
8289
+
8290
+ @Field(() => Int, { nullable: true })
8291
+ MaxResults?: number | null;
8292
+
8293
+ @Field(() => Float, { nullable: true })
8294
+ MinScore?: number | null;
8295
+
8296
+ @Field({ nullable: true })
8297
+ QueryTemplateID?: string | null;
8298
+
8299
+ @Field({ nullable: true })
8300
+ FusionWeightsOverride?: string | null;
8301
+
8302
+ @Field(() => Boolean, { nullable: true })
8303
+ IsDefault?: boolean;
8304
+
8305
+ @Field(() => [KeyValuePairInput], { nullable: true })
8306
+ OldValues___?: KeyValuePairInput[];
8307
+
8308
+ @Field(() => RestoreContextInput, { nullable: true })
8309
+ RestoreContext___?: RestoreContextInput;
8310
+ }
8311
+
8312
+ //****************************************************************************
8313
+ // RESOLVER for MJ: AI Agent Search Scopes
8314
+ //****************************************************************************
8315
+ @ObjectType()
8316
+ export class RunMJAIAgentSearchScopeViewResult {
8317
+ @Field(() => [MJAIAgentSearchScope_])
8318
+ Results: MJAIAgentSearchScope_[];
8319
+
8320
+ @Field(() => String, {nullable: true})
8321
+ UserViewRunID?: string;
8322
+
8323
+ @Field(() => Int, {nullable: true})
8324
+ RowCount: number;
8325
+
8326
+ @Field(() => Int, {nullable: true})
8327
+ TotalRowCount: number;
8328
+
8329
+ @Field(() => Int, {nullable: true})
8330
+ ExecutionTime: number;
8331
+
8332
+ @Field({nullable: true})
8333
+ ErrorMessage?: string;
8334
+
8335
+ @Field(() => Boolean, {nullable: false})
8336
+ Success: boolean;
8337
+ }
8338
+
8339
+ @Resolver(MJAIAgentSearchScope_)
8340
+ export class MJAIAgentSearchScopeResolver extends ResolverBase {
8341
+ @Query(() => RunMJAIAgentSearchScopeViewResult)
8342
+ async RunMJAIAgentSearchScopeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8343
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8344
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
8345
+ }
8346
+
8347
+ @Query(() => RunMJAIAgentSearchScopeViewResult)
8348
+ async RunMJAIAgentSearchScopeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8349
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8350
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
8351
+ }
8352
+
8353
+ @Query(() => RunMJAIAgentSearchScopeViewResult)
8354
+ async RunMJAIAgentSearchScopeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8355
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8356
+ input.EntityName = 'MJ: AI Agent Search Scopes';
8357
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
8358
+ }
8359
+ @Query(() => MJAIAgentSearchScope_, { nullable: true })
8360
+ async MJAIAgentSearchScope(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJAIAgentSearchScope_ | null> {
8361
+ this.CheckUserReadPermissions('MJ: AI Agent Search Scopes', userPayload);
8362
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8363
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSearchScopes')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Search Scopes', userPayload, EntityPermissionType.Read, 'AND');
8364
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
8365
+ const result = await this.MapFieldNamesToCodeNames('MJ: AI Agent Search Scopes', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
8366
+ return result;
8367
+ }
8368
+
8369
+ @Mutation(() => MJAIAgentSearchScope_)
8370
+ async CreateMJAIAgentSearchScope(
8371
+ @Arg('input', () => CreateMJAIAgentSearchScopeInput) input: CreateMJAIAgentSearchScopeInput,
8372
+ @Ctx() { providers, userPayload }: AppContext,
8373
+ @PubSub() pubSub: PubSubEngine
8374
+ ) {
8375
+ const provider = GetReadWriteProvider(providers);
8376
+ return this.CreateRecord('MJ: AI Agent Search Scopes', input, provider, userPayload, pubSub)
8377
+ }
8378
+
8379
+ @Mutation(() => MJAIAgentSearchScope_)
8380
+ async UpdateMJAIAgentSearchScope(
8381
+ @Arg('input', () => UpdateMJAIAgentSearchScopeInput) input: UpdateMJAIAgentSearchScopeInput,
8382
+ @Ctx() { providers, userPayload }: AppContext,
8383
+ @PubSub() pubSub: PubSubEngine
8384
+ ) {
8385
+ const provider = GetReadWriteProvider(providers);
8386
+ return this.UpdateRecord('MJ: AI Agent Search Scopes', input, provider, userPayload, pubSub);
8387
+ }
8388
+
8389
+ @Mutation(() => MJAIAgentSearchScope_)
8390
+ async DeleteMJAIAgentSearchScope(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8391
+ const provider = GetReadWriteProvider(providers);
8392
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
8393
+ return this.DeleteRecord('MJ: AI Agent Search Scopes', key, options, provider, userPayload, pubSub);
8394
+ }
8395
+
8396
+ }
8397
+
8142
8398
  //****************************************************************************
8143
8399
  // ENTITY CLASS for MJ: AI Agent Step Paths
8144
8400
  //****************************************************************************
@@ -9193,6 +9449,10 @@ if this limit is exceeded.`})
9193
9449
  @MaxLength(36)
9194
9450
  DefaultStorageAccountID?: string;
9195
9451
 
9452
+ @Field({description: `Controls the agent's search capability. All = may use any scope including Global; search action does not restrict. Assigned = may use ONLY scopes explicitly linked via AIAgentSearchScope; scoped search action enforces this. None = agent has no search capability; the scoped search action rejects all requests.`})
9453
+ @MaxLength(20)
9454
+ SearchScopeAccess: string;
9455
+
9196
9456
  @Field({nullable: true})
9197
9457
  @MaxLength(255)
9198
9458
  Parent?: string;
@@ -9262,6 +9522,12 @@ if this limit is exceeded.`})
9262
9522
  @Field(() => [MJAIAgentClientTool_])
9263
9523
  MJAIAgentClientTools_AgentIDArray: MJAIAgentClientTool_[]; // Link to MJAIAgentClientTools
9264
9524
 
9525
+ @Field(() => [MJAIAgentSearchScope_])
9526
+ MJAIAgentSearchScopes_AgentIDArray: MJAIAgentSearchScope_[]; // Link to MJAIAgentSearchScopes
9527
+
9528
+ @Field(() => [MJSearchExecutionLog_])
9529
+ MJSearchExecutionLogs_AIAgentIDArray: MJSearchExecutionLog_[]; // Link to MJSearchExecutionLogs
9530
+
9265
9531
  @Field(() => [MJAIAgentNote_])
9266
9532
  MJAIAgentNotes_AgentIDArray: MJAIAgentNote_[]; // Link to MJAIAgentNotes
9267
9533
 
@@ -9494,6 +9760,9 @@ export class CreateMJAIAgentInput {
9494
9760
  @Field({ nullable: true })
9495
9761
  DefaultStorageAccountID: string | null;
9496
9762
 
9763
+ @Field({ nullable: true })
9764
+ SearchScopeAccess?: string;
9765
+
9497
9766
  @Field(() => RestoreContextInput, { nullable: true })
9498
9767
  RestoreContext___?: RestoreContextInput;
9499
9768
  }
@@ -9690,6 +9959,9 @@ export class UpdateMJAIAgentInput {
9690
9959
  @Field({ nullable: true })
9691
9960
  DefaultStorageAccountID?: string | null;
9692
9961
 
9962
+ @Field({ nullable: true })
9963
+ SearchScopeAccess?: string;
9964
+
9693
9965
  @Field(() => [KeyValuePairInput], { nullable: true })
9694
9966
  OldValues___?: KeyValuePairInput[];
9695
9967
 
@@ -9864,6 +10136,26 @@ export class MJAIAgentResolver extends ResolverBase {
9864
10136
  return result;
9865
10137
  }
9866
10138
 
10139
+ @FieldResolver(() => [MJAIAgentSearchScope_])
10140
+ async MJAIAgentSearchScopes_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10141
+ this.CheckUserReadPermissions('MJ: AI Agent Search Scopes', userPayload);
10142
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10143
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSearchScopes')} WHERE ${provider.QuoteIdentifier('AgentID')}='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Search Scopes', userPayload, EntityPermissionType.Read, 'AND');
10144
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
10145
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Search Scopes', rows, this.GetUserFromPayload(userPayload));
10146
+ return result;
10147
+ }
10148
+
10149
+ @FieldResolver(() => [MJSearchExecutionLog_])
10150
+ async MJSearchExecutionLogs_AIAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
10151
+ this.CheckUserReadPermissions('MJ: Search Execution Logs', userPayload);
10152
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
10153
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchExecutionLogs')} WHERE ${provider.QuoteIdentifier('AIAgentID')}='${mjaiagent_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Execution Logs', userPayload, EntityPermissionType.Read, 'AND');
10154
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
10155
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Execution Logs', rows, this.GetUserFromPayload(userPayload));
10156
+ return result;
10157
+ }
10158
+
9867
10159
  @FieldResolver(() => [MJAIAgentNote_])
9868
10160
  async MJAIAgentNotes_AgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
9869
10161
  this.CheckUserReadPermissions('MJ: AI Agent Notes', userPayload);
@@ -16684,8 +16976,8 @@ export class MJAIResultCache_ {
16684
16976
  @MaxLength(36)
16685
16977
  ConfigurationID?: string;
16686
16978
 
16687
- @Field(() => Int, {nullable: true, description: `Vector representation of the prompt for similarity matching.`})
16688
- PromptEmbedding?: number;
16979
+ @Field({nullable: true, description: `Vector representation of the prompt for similarity matching.`})
16980
+ PromptEmbedding?: string;
16689
16981
 
16690
16982
  @Field({nullable: true, description: `Reference to the AIPromptRun that created this cache entry.`})
16691
16983
  @MaxLength(36)
@@ -16755,8 +17047,8 @@ export class CreateMJAIResultCacheInput {
16755
17047
  @Field({ nullable: true })
16756
17048
  ConfigurationID: string | null;
16757
17049
 
16758
- @Field(() => Int, { nullable: true })
16759
- PromptEmbedding: number | null;
17050
+ @Field({ nullable: true })
17051
+ PromptEmbedding: string | null;
16760
17052
 
16761
17053
  @Field({ nullable: true })
16762
17054
  PromptRunID: string | null;
@@ -16804,8 +17096,8 @@ export class UpdateMJAIResultCacheInput {
16804
17096
  @Field({ nullable: true })
16805
17097
  ConfigurationID?: string | null;
16806
17098
 
16807
- @Field(() => Int, { nullable: true })
16808
- PromptEmbedding?: number | null;
17099
+ @Field({ nullable: true })
17100
+ PromptEmbedding?: string | null;
16809
17101
 
16810
17102
  @Field({ nullable: true })
16811
17103
  PromptRunID?: string | null;
@@ -40051,6 +40343,9 @@ export class MJEntity_ {
40051
40343
  @Field(() => [MJArchiveRunDetail_])
40052
40344
  MJArchiveRunDetails_EntityIDArray: MJArchiveRunDetail_[]; // Link to MJArchiveRunDetails
40053
40345
 
40346
+ @Field(() => [MJSearchScopeEntity_])
40347
+ MJSearchScopeEntities_EntityIDArray: MJSearchScopeEntity_[]; // Link to MJSearchScopeEntities
40348
+
40054
40349
  @Field(() => [MJResourceType_])
40055
40350
  MJResourceTypes_CategoryEntityIDArray: MJResourceType_[]; // Link to MJResourceTypes
40056
40351
 
@@ -41060,6 +41355,16 @@ export class MJEntityResolverBase extends ResolverBase {
41060
41355
  return result;
41061
41356
  }
41062
41357
 
41358
+ @FieldResolver(() => [MJSearchScopeEntity_])
41359
+ async MJSearchScopeEntities_EntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
41360
+ this.CheckUserReadPermissions('MJ: Search Scope Entities', userPayload);
41361
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
41362
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeEntities')} WHERE ${provider.QuoteIdentifier('EntityID')}='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Entities', userPayload, EntityPermissionType.Read, 'AND');
41363
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
41364
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Entities', rows, this.GetUserFromPayload(userPayload));
41365
+ return result;
41366
+ }
41367
+
41063
41368
  @FieldResolver(() => [MJResourceType_])
41064
41369
  async MJResourceTypes_CategoryEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
41065
41370
  this.CheckUserReadPermissions('MJ: Resource Types', userPayload);
@@ -43791,7 +44096,7 @@ export class MJEntityField_ {
43791
44096
  @MaxLength(10)
43792
44097
  GeneratedFormSection: string;
43793
44098
 
43794
- @Field(() => Boolean, {description: `NULL`})
44099
+ @Field(() => Boolean, {description: `When 1, this field is read-only at the API layer (excluded from spCreate / spUpdate / GraphQL input types). Set automatically when the column is either (a) not present in the base table — e.g., a joined name lookup in the base view, or (b) a SQL Server computed column or PostgreSQL generated column. Cases (a) and (b) are distinguished by the IsComputed flag: IsVirtual=1, IsComputed=0 means view-only; IsVirtual=1, IsComputed=1 means computed/generated and physically present in the base table.`})
43795
44100
  IsVirtual: boolean;
43796
44101
 
43797
44102
  @Field(() => Boolean, {description: `If set to 1, this column will be used as the "Name" field for the entity and will be used to display the name of the record in various places in the UI.`})
@@ -43901,6 +44206,9 @@ export class MJEntityField_ {
43901
44206
  @Field(() => Boolean, {description: `When true (default), CodeGen can automatically suggest and apply ExtendedType values (GeoLatitude, GeoLongitude, GeoAddress, etc.) during LLM field categorization. Set to 0 to lock admin-specified ExtendedType.`})
43902
44207
  AutoUpdateExtendedType: boolean;
43903
44208
 
44209
+ @Field(() => Boolean, {description: `When 1, this field is a SQL Server computed column or PostgreSQL generated column — physically present in the base table but read-only at the SQL layer. Distinct from IsVirtual, which means the column is not in the base table at all (e.g., joined name lookups in the base view). A computed column has both IsVirtual=1 (read-only at the API layer) and IsComputed=1 (physically in the table). The difference matters for base-view JOIN target selection: when an FK's related Name Field is computed, the generated view joins to the related entity's base table instead of its view.`})
44210
+ IsComputed: boolean;
44211
+
43904
44212
  @Field({nullable: true})
43905
44213
  FieldCodeName?: string;
43906
44214
 
@@ -44108,6 +44416,9 @@ export class CreateMJEntityFieldInput {
44108
44416
  @Field(() => Boolean, { nullable: true })
44109
44417
  AutoUpdateExtendedType?: boolean;
44110
44418
 
44419
+ @Field(() => Boolean, { nullable: true })
44420
+ IsComputed?: boolean;
44421
+
44111
44422
  @Field(() => RestoreContextInput, { nullable: true })
44112
44423
  RestoreContext___?: RestoreContextInput;
44113
44424
  }
@@ -44268,6 +44579,9 @@ export class UpdateMJEntityFieldInput {
44268
44579
  @Field(() => Boolean, { nullable: true })
44269
44580
  AutoUpdateExtendedType?: boolean;
44270
44581
 
44582
+ @Field(() => Boolean, { nullable: true })
44583
+ IsComputed?: boolean;
44584
+
44271
44585
  @Field(() => [KeyValuePairInput], { nullable: true })
44272
44586
  OldValues___?: KeyValuePairInput[];
44273
44587
 
@@ -47412,6 +47726,9 @@ export class MJFileStorageAccount_ {
47412
47726
  @Field(() => [MJArchiveConfiguration_])
47413
47727
  MJArchiveConfigurations_StorageAccountIDArray: MJArchiveConfiguration_[]; // Link to MJArchiveConfigurations
47414
47728
 
47729
+ @Field(() => [MJSearchScopeStorageAccount_])
47730
+ MJSearchScopeStorageAccounts_FileStorageAccountIDArray: MJSearchScopeStorageAccount_[]; // Link to MJSearchScopeStorageAccounts
47731
+
47415
47732
  @Field(() => [MJFileStorageAccountPermission_])
47416
47733
  MJFileStorageAccountPermissions_FileStorageAccountIDArray: MJFileStorageAccountPermission_[]; // Link to MJFileStorageAccountPermissions
47417
47734
 
@@ -47558,6 +47875,16 @@ export class MJFileStorageAccountResolver extends ResolverBase {
47558
47875
  return result;
47559
47876
  }
47560
47877
 
47878
+ @FieldResolver(() => [MJSearchScopeStorageAccount_])
47879
+ async MJSearchScopeStorageAccounts_FileStorageAccountIDArray(@Root() mjfilestorageaccount_: MJFileStorageAccount_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
47880
+ this.CheckUserReadPermissions('MJ: Search Scope Storage Accounts', userPayload);
47881
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
47882
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeStorageAccounts')} WHERE ${provider.QuoteIdentifier('FileStorageAccountID')}='${mjfilestorageaccount_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
47883
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
47884
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Storage Accounts', rows, this.GetUserFromPayload(userPayload));
47885
+ return result;
47886
+ }
47887
+
47561
47888
  @FieldResolver(() => [MJFileStorageAccountPermission_])
47562
47889
  async MJFileStorageAccountPermissions_FileStorageAccountIDArray(@Root() mjfilestorageaccount_: MJFileStorageAccount_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
47563
47890
  this.CheckUserReadPermissions('MJ: File Storage Account Permissions', userPayload);
@@ -63304,6 +63631,9 @@ export class MJRole_ {
63304
63631
  @Field(() => [MJAIAgentPermission_])
63305
63632
  MJAIAgentPermissions_RoleIDArray: MJAIAgentPermission_[]; // Link to MJAIAgentPermissions
63306
63633
 
63634
+ @Field(() => [MJSearchScopePermission_])
63635
+ MJSearchScopePermissions_RoleIDArray: MJSearchScopePermission_[]; // Link to MJSearchScopePermissions
63636
+
63307
63637
  }
63308
63638
 
63309
63639
  //****************************************************************************
@@ -63525,6 +63855,16 @@ export class MJRoleResolver extends ResolverBase {
63525
63855
  return result;
63526
63856
  }
63527
63857
 
63858
+ @FieldResolver(() => [MJSearchScopePermission_])
63859
+ async MJSearchScopePermissions_RoleIDArray(@Root() mjrole_: MJRole_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
63860
+ this.CheckUserReadPermissions('MJ: Search Scope Permissions', userPayload);
63861
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
63862
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopePermissions')} WHERE ${provider.QuoteIdentifier('RoleID')}='${mjrole_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Permissions', userPayload, EntityPermissionType.Read, 'AND');
63863
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
63864
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Permissions', rows, this.GetUserFromPayload(userPayload));
63865
+ return result;
63866
+ }
63867
+
63528
63868
  @Mutation(() => MJRole_)
63529
63869
  async CreateMJRole(
63530
63870
  @Arg('input', () => CreateMJRoleInput) input: CreateMJRoleInput,
@@ -65306,6 +65646,254 @@ export class MJSchemaInfoResolver extends ResolverBase {
65306
65646
 
65307
65647
  }
65308
65648
 
65649
+ //****************************************************************************
65650
+ // ENTITY CLASS for MJ: Search Execution Logs
65651
+ //****************************************************************************
65652
+ @ObjectType({ description: `One row per SearchEngine.search invocation. Populated by SearchEngine\'s post-fusion logging hook (Phase 3.2). Read by the Knowledge Hub Search Analytics dashboard (Phase 3.3) and the per-scope tuning CSV export (Phase 3.4).` })
65653
+ export class MJSearchExecutionLog_ {
65654
+ @Field()
65655
+ @MaxLength(36)
65656
+ ID: string;
65657
+
65658
+ @Field({nullable: true, description: `The SearchScope this invocation targeted. NULL for unscoped global search.`})
65659
+ @MaxLength(36)
65660
+ SearchScopeID?: string;
65661
+
65662
+ @Field({nullable: true, description: `The User who initiated the search. NULL for system / unauthenticated callers.`})
65663
+ @MaxLength(36)
65664
+ UserID?: string;
65665
+
65666
+ @Field({nullable: true, description: `The AIAgent identity if the search was invoked from an agent (e.g. ScopedSearchAction). NULL for direct human-initiated searches.`})
65667
+ @MaxLength(36)
65668
+ AIAgentID?: string;
65669
+
65670
+ @Field({description: `Raw query string the user / agent submitted. NVARCHAR(MAX) because some queries are long (full sentences, snippets). Stored verbatim for analytics — do NOT rely on this for permission decisions.`})
65671
+ Query: string;
65672
+
65673
+ @Field(() => Int, {description: `End-to-end search duration in milliseconds, measured at the SearchEngine.search call boundary (provider runs + fusion + rerank + permission filter + enrichment).`})
65674
+ TotalDurationMs: number;
65675
+
65676
+ @Field(() => Int, {description: `Number of results returned to the caller after permission filtering, deduplication, and score-threshold trimming. Use this as the hit-rate denominator (rows where ResultCount > 0).`})
65677
+ ResultCount: number;
65678
+
65679
+ @Field({nullable: true, description: `BaseReRanker.Name of the reranker that ran (e.g. 'Cohere', 'Voyage', 'OpenAI', 'BGE', 'NoopReRanker'). NULL when no rerank stage executed for this invocation.`})
65680
+ @MaxLength(100)
65681
+ RerankerName?: string;
65682
+
65683
+ @Field(() => Float, {nullable: true, description: `Total reranker spend in cents for this invocation, populated from the BaseReRanker.CostReporter callback via RerankerBudgetGuard. NULL when no rerank ran or no real-provider cost was incurred (Noop / BGE).`})
65684
+ RerankerCostCents?: number;
65685
+
65686
+ @Field({description: `Outcome of the search: 'Success' (results returned, possibly empty), 'Failure' (an exception bubbled out — see FailureReason), 'Forbidden' (the caller lacked SearchScopePermission for the requested scope). Constrained by CK_SearchExecutionLog_Status.`})
65687
+ @MaxLength(20)
65688
+ Status: string;
65689
+
65690
+ @Field({nullable: true, description: `Short human-readable failure reason when Status = 'Failure' or 'Forbidden'. NULL on success.`})
65691
+ @MaxLength(500)
65692
+ FailureReason?: string;
65693
+
65694
+ @Field({nullable: true, description: `JSON array of per-provider breakdown entries: [{"Provider":"Vector","DurationMs":123,"ResultCount":5,"ErrorMessage":null}, ...]. Used by the analytics dashboard for p50/p95 latency-by-provider charts and to spot consistently slow providers.`})
65695
+ ProvidersJSON?: string;
65696
+
65697
+ @Field()
65698
+ _mj__CreatedAt: Date;
65699
+
65700
+ @Field()
65701
+ _mj__UpdatedAt: Date;
65702
+
65703
+ @Field({nullable: true})
65704
+ @MaxLength(200)
65705
+ SearchScope?: string;
65706
+
65707
+ @Field({nullable: true})
65708
+ @MaxLength(100)
65709
+ User?: string;
65710
+
65711
+ @Field({nullable: true})
65712
+ @MaxLength(255)
65713
+ AIAgent?: string;
65714
+
65715
+ }
65716
+
65717
+ //****************************************************************************
65718
+ // INPUT TYPE for MJ: Search Execution Logs
65719
+ //****************************************************************************
65720
+ @InputType()
65721
+ export class CreateMJSearchExecutionLogInput {
65722
+ @Field({ nullable: true })
65723
+ ID?: string;
65724
+
65725
+ @Field({ nullable: true })
65726
+ SearchScopeID: string | null;
65727
+
65728
+ @Field({ nullable: true })
65729
+ UserID: string | null;
65730
+
65731
+ @Field({ nullable: true })
65732
+ AIAgentID: string | null;
65733
+
65734
+ @Field({ nullable: true })
65735
+ Query?: string;
65736
+
65737
+ @Field(() => Int, { nullable: true })
65738
+ TotalDurationMs?: number;
65739
+
65740
+ @Field(() => Int, { nullable: true })
65741
+ ResultCount?: number;
65742
+
65743
+ @Field({ nullable: true })
65744
+ RerankerName: string | null;
65745
+
65746
+ @Field(() => Float, { nullable: true })
65747
+ RerankerCostCents: number | null;
65748
+
65749
+ @Field({ nullable: true })
65750
+ Status?: string;
65751
+
65752
+ @Field({ nullable: true })
65753
+ FailureReason: string | null;
65754
+
65755
+ @Field({ nullable: true })
65756
+ ProvidersJSON: string | null;
65757
+
65758
+ @Field(() => RestoreContextInput, { nullable: true })
65759
+ RestoreContext___?: RestoreContextInput;
65760
+ }
65761
+
65762
+
65763
+ //****************************************************************************
65764
+ // INPUT TYPE for MJ: Search Execution Logs
65765
+ //****************************************************************************
65766
+ @InputType()
65767
+ export class UpdateMJSearchExecutionLogInput {
65768
+ @Field()
65769
+ ID: string;
65770
+
65771
+ @Field({ nullable: true })
65772
+ SearchScopeID?: string | null;
65773
+
65774
+ @Field({ nullable: true })
65775
+ UserID?: string | null;
65776
+
65777
+ @Field({ nullable: true })
65778
+ AIAgentID?: string | null;
65779
+
65780
+ @Field({ nullable: true })
65781
+ Query?: string;
65782
+
65783
+ @Field(() => Int, { nullable: true })
65784
+ TotalDurationMs?: number;
65785
+
65786
+ @Field(() => Int, { nullable: true })
65787
+ ResultCount?: number;
65788
+
65789
+ @Field({ nullable: true })
65790
+ RerankerName?: string | null;
65791
+
65792
+ @Field(() => Float, { nullable: true })
65793
+ RerankerCostCents?: number | null;
65794
+
65795
+ @Field({ nullable: true })
65796
+ Status?: string;
65797
+
65798
+ @Field({ nullable: true })
65799
+ FailureReason?: string | null;
65800
+
65801
+ @Field({ nullable: true })
65802
+ ProvidersJSON?: string | null;
65803
+
65804
+ @Field(() => [KeyValuePairInput], { nullable: true })
65805
+ OldValues___?: KeyValuePairInput[];
65806
+
65807
+ @Field(() => RestoreContextInput, { nullable: true })
65808
+ RestoreContext___?: RestoreContextInput;
65809
+ }
65810
+
65811
+ //****************************************************************************
65812
+ // RESOLVER for MJ: Search Execution Logs
65813
+ //****************************************************************************
65814
+ @ObjectType()
65815
+ export class RunMJSearchExecutionLogViewResult {
65816
+ @Field(() => [MJSearchExecutionLog_])
65817
+ Results: MJSearchExecutionLog_[];
65818
+
65819
+ @Field(() => String, {nullable: true})
65820
+ UserViewRunID?: string;
65821
+
65822
+ @Field(() => Int, {nullable: true})
65823
+ RowCount: number;
65824
+
65825
+ @Field(() => Int, {nullable: true})
65826
+ TotalRowCount: number;
65827
+
65828
+ @Field(() => Int, {nullable: true})
65829
+ ExecutionTime: number;
65830
+
65831
+ @Field({nullable: true})
65832
+ ErrorMessage?: string;
65833
+
65834
+ @Field(() => Boolean, {nullable: false})
65835
+ Success: boolean;
65836
+ }
65837
+
65838
+ @Resolver(MJSearchExecutionLog_)
65839
+ export class MJSearchExecutionLogResolver extends ResolverBase {
65840
+ @Query(() => RunMJSearchExecutionLogViewResult)
65841
+ async RunMJSearchExecutionLogViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
65842
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
65843
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
65844
+ }
65845
+
65846
+ @Query(() => RunMJSearchExecutionLogViewResult)
65847
+ async RunMJSearchExecutionLogViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
65848
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
65849
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
65850
+ }
65851
+
65852
+ @Query(() => RunMJSearchExecutionLogViewResult)
65853
+ async RunMJSearchExecutionLogDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
65854
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
65855
+ input.EntityName = 'MJ: Search Execution Logs';
65856
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
65857
+ }
65858
+ @Query(() => MJSearchExecutionLog_, { nullable: true })
65859
+ async MJSearchExecutionLog(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchExecutionLog_ | null> {
65860
+ this.CheckUserReadPermissions('MJ: Search Execution Logs', userPayload);
65861
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
65862
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchExecutionLogs')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Execution Logs', userPayload, EntityPermissionType.Read, 'AND');
65863
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
65864
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Execution Logs', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
65865
+ return result;
65866
+ }
65867
+
65868
+ @Mutation(() => MJSearchExecutionLog_)
65869
+ async CreateMJSearchExecutionLog(
65870
+ @Arg('input', () => CreateMJSearchExecutionLogInput) input: CreateMJSearchExecutionLogInput,
65871
+ @Ctx() { providers, userPayload }: AppContext,
65872
+ @PubSub() pubSub: PubSubEngine
65873
+ ) {
65874
+ const provider = GetReadWriteProvider(providers);
65875
+ return this.CreateRecord('MJ: Search Execution Logs', input, provider, userPayload, pubSub)
65876
+ }
65877
+
65878
+ @Mutation(() => MJSearchExecutionLog_)
65879
+ async UpdateMJSearchExecutionLog(
65880
+ @Arg('input', () => UpdateMJSearchExecutionLogInput) input: UpdateMJSearchExecutionLogInput,
65881
+ @Ctx() { providers, userPayload }: AppContext,
65882
+ @PubSub() pubSub: PubSubEngine
65883
+ ) {
65884
+ const provider = GetReadWriteProvider(providers);
65885
+ return this.UpdateRecord('MJ: Search Execution Logs', input, provider, userPayload, pubSub);
65886
+ }
65887
+
65888
+ @Mutation(() => MJSearchExecutionLog_)
65889
+ async DeleteMJSearchExecutionLog(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
65890
+ const provider = GetReadWriteProvider(providers);
65891
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
65892
+ return this.DeleteRecord('MJ: Search Execution Logs', key, options, provider, userPayload, pubSub);
65893
+ }
65894
+
65895
+ }
65896
+
65309
65897
  //****************************************************************************
65310
65898
  // ENTITY CLASS for MJ: Search Providers
65311
65899
  //****************************************************************************
@@ -65367,51 +65955,1201 @@ export class MJSearchProvider_ {
65367
65955
  @MaxLength(200)
65368
65956
  Credential?: string;
65369
65957
 
65958
+ @Field(() => [MJSearchScopeProvider_])
65959
+ MJSearchScopeProviders_SearchProviderIDArray: MJSearchScopeProvider_[]; // Link to MJSearchScopeProviders
65960
+
65961
+ }
65962
+
65963
+ //****************************************************************************
65964
+ // INPUT TYPE for MJ: Search Providers
65965
+ //****************************************************************************
65966
+ @InputType()
65967
+ export class CreateMJSearchProviderInput {
65968
+ @Field({ nullable: true })
65969
+ ID?: string;
65970
+
65971
+ @Field({ nullable: true })
65972
+ Name?: string;
65973
+
65974
+ @Field({ nullable: true })
65975
+ Description: string | null;
65976
+
65977
+ @Field({ nullable: true })
65978
+ DriverClass?: string;
65979
+
65980
+ @Field({ nullable: true })
65981
+ Status?: string;
65982
+
65983
+ @Field(() => Int, { nullable: true })
65984
+ Priority?: number;
65985
+
65986
+ @Field(() => Boolean, { nullable: true })
65987
+ SupportsPreview?: boolean;
65988
+
65989
+ @Field(() => Int, { nullable: true })
65990
+ MaxResultsOverride: number | null;
65991
+
65992
+ @Field({ nullable: true })
65993
+ ProviderConfig: string | null;
65994
+
65995
+ @Field({ nullable: true })
65996
+ CredentialID: string | null;
65997
+
65998
+ @Field({ nullable: true })
65999
+ DisplayName: string | null;
66000
+
66001
+ @Field({ nullable: true })
66002
+ Icon: string | null;
66003
+
66004
+ @Field({ nullable: true })
66005
+ Comments: string | null;
66006
+
66007
+ @Field(() => RestoreContextInput, { nullable: true })
66008
+ RestoreContext___?: RestoreContextInput;
66009
+ }
66010
+
66011
+
66012
+ //****************************************************************************
66013
+ // INPUT TYPE for MJ: Search Providers
66014
+ //****************************************************************************
66015
+ @InputType()
66016
+ export class UpdateMJSearchProviderInput {
66017
+ @Field()
66018
+ ID: string;
66019
+
66020
+ @Field({ nullable: true })
66021
+ Name?: string;
66022
+
66023
+ @Field({ nullable: true })
66024
+ Description?: string | null;
66025
+
66026
+ @Field({ nullable: true })
66027
+ DriverClass?: string;
66028
+
66029
+ @Field({ nullable: true })
66030
+ Status?: string;
66031
+
66032
+ @Field(() => Int, { nullable: true })
66033
+ Priority?: number;
66034
+
66035
+ @Field(() => Boolean, { nullable: true })
66036
+ SupportsPreview?: boolean;
66037
+
66038
+ @Field(() => Int, { nullable: true })
66039
+ MaxResultsOverride?: number | null;
66040
+
66041
+ @Field({ nullable: true })
66042
+ ProviderConfig?: string | null;
66043
+
66044
+ @Field({ nullable: true })
66045
+ CredentialID?: string | null;
66046
+
66047
+ @Field({ nullable: true })
66048
+ DisplayName?: string | null;
66049
+
66050
+ @Field({ nullable: true })
66051
+ Icon?: string | null;
66052
+
66053
+ @Field({ nullable: true })
66054
+ Comments?: string | null;
66055
+
66056
+ @Field(() => [KeyValuePairInput], { nullable: true })
66057
+ OldValues___?: KeyValuePairInput[];
66058
+
66059
+ @Field(() => RestoreContextInput, { nullable: true })
66060
+ RestoreContext___?: RestoreContextInput;
66061
+ }
66062
+
66063
+ //****************************************************************************
66064
+ // RESOLVER for MJ: Search Providers
66065
+ //****************************************************************************
66066
+ @ObjectType()
66067
+ export class RunMJSearchProviderViewResult {
66068
+ @Field(() => [MJSearchProvider_])
66069
+ Results: MJSearchProvider_[];
66070
+
66071
+ @Field(() => String, {nullable: true})
66072
+ UserViewRunID?: string;
66073
+
66074
+ @Field(() => Int, {nullable: true})
66075
+ RowCount: number;
66076
+
66077
+ @Field(() => Int, {nullable: true})
66078
+ TotalRowCount: number;
66079
+
66080
+ @Field(() => Int, {nullable: true})
66081
+ ExecutionTime: number;
66082
+
66083
+ @Field({nullable: true})
66084
+ ErrorMessage?: string;
66085
+
66086
+ @Field(() => Boolean, {nullable: false})
66087
+ Success: boolean;
66088
+ }
66089
+
66090
+ @Resolver(MJSearchProvider_)
66091
+ export class MJSearchProviderResolver extends ResolverBase {
66092
+ @Query(() => RunMJSearchProviderViewResult)
66093
+ async RunMJSearchProviderViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66094
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66095
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
66096
+ }
66097
+
66098
+ @Query(() => RunMJSearchProviderViewResult)
66099
+ async RunMJSearchProviderViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66100
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66101
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
66102
+ }
66103
+
66104
+ @Query(() => RunMJSearchProviderViewResult)
66105
+ async RunMJSearchProviderDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66106
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66107
+ input.EntityName = 'MJ: Search Providers';
66108
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
66109
+ }
66110
+ @Query(() => MJSearchProvider_, { nullable: true })
66111
+ async MJSearchProvider(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchProvider_ | null> {
66112
+ this.CheckUserReadPermissions('MJ: Search Providers', userPayload);
66113
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66114
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchProviders')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Providers', userPayload, EntityPermissionType.Read, 'AND');
66115
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
66116
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Providers', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
66117
+ return result;
66118
+ }
66119
+
66120
+ @FieldResolver(() => [MJSearchScopeProvider_])
66121
+ async MJSearchScopeProviders_SearchProviderIDArray(@Root() mjsearchprovider_: MJSearchProvider_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
66122
+ this.CheckUserReadPermissions('MJ: Search Scope Providers', userPayload);
66123
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66124
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeProviders')} WHERE ${provider.QuoteIdentifier('SearchProviderID')}='${mjsearchprovider_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Providers', userPayload, EntityPermissionType.Read, 'AND');
66125
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
66126
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Providers', rows, this.GetUserFromPayload(userPayload));
66127
+ return result;
66128
+ }
66129
+
66130
+ @Mutation(() => MJSearchProvider_)
66131
+ async CreateMJSearchProvider(
66132
+ @Arg('input', () => CreateMJSearchProviderInput) input: CreateMJSearchProviderInput,
66133
+ @Ctx() { providers, userPayload }: AppContext,
66134
+ @PubSub() pubSub: PubSubEngine
66135
+ ) {
66136
+ const provider = GetReadWriteProvider(providers);
66137
+ return this.CreateRecord('MJ: Search Providers', input, provider, userPayload, pubSub)
66138
+ }
66139
+
66140
+ @Mutation(() => MJSearchProvider_)
66141
+ async UpdateMJSearchProvider(
66142
+ @Arg('input', () => UpdateMJSearchProviderInput) input: UpdateMJSearchProviderInput,
66143
+ @Ctx() { providers, userPayload }: AppContext,
66144
+ @PubSub() pubSub: PubSubEngine
66145
+ ) {
66146
+ const provider = GetReadWriteProvider(providers);
66147
+ return this.UpdateRecord('MJ: Search Providers', input, provider, userPayload, pubSub);
66148
+ }
66149
+
66150
+ @Mutation(() => MJSearchProvider_)
66151
+ async DeleteMJSearchProvider(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66152
+ const provider = GetReadWriteProvider(providers);
66153
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
66154
+ return this.DeleteRecord('MJ: Search Providers', key, options, provider, userPayload, pubSub);
66155
+ }
66156
+
66157
+ }
66158
+
66159
+ //****************************************************************************
66160
+ // ENTITY CLASS for MJ: Search Scope Entities
66161
+ //****************************************************************************
66162
+ @ObjectType({ description: `Controls which entities participate in entity and full-text search within a scope, with optional per-entity filter and user-search-string overrides.` })
66163
+ export class MJSearchScopeEntity_ {
66164
+ @Field()
66165
+ @MaxLength(36)
66166
+ ID: string;
66167
+
66168
+ @Field()
66169
+ @MaxLength(36)
66170
+ SearchScopeID: string;
66171
+
66172
+ @Field()
66173
+ @MaxLength(36)
66174
+ EntityID: string;
66175
+
66176
+ @Field({nullable: true, description: `Optional SQL filter applied to this entity's search within this scope. Example: Status='Published' AND DepartmentID='abc'. Rendered as a Nunjucks template with SearchContext variables for multi-tenant filtering.`})
66177
+ ExtraFilter?: string;
66178
+
66179
+ @Field({nullable: true, description: `Optional override for the UserSearchString passed to RunView for this entity within this scope. Nunjucks template (e.g., "{{ query }} AND type:policy"). NULL = pass the user's actual query through as-is.`})
66180
+ UserSearchString?: string;
66181
+
66182
+ @Field()
66183
+ _mj__CreatedAt: Date;
66184
+
66185
+ @Field()
66186
+ _mj__UpdatedAt: Date;
66187
+
66188
+ @Field()
66189
+ @MaxLength(200)
66190
+ SearchScope: string;
66191
+
66192
+ @Field()
66193
+ @MaxLength(255)
66194
+ Entity: string;
66195
+
66196
+ }
66197
+
66198
+ //****************************************************************************
66199
+ // INPUT TYPE for MJ: Search Scope Entities
66200
+ //****************************************************************************
66201
+ @InputType()
66202
+ export class CreateMJSearchScopeEntityInput {
66203
+ @Field({ nullable: true })
66204
+ ID?: string;
66205
+
66206
+ @Field({ nullable: true })
66207
+ SearchScopeID?: string;
66208
+
66209
+ @Field({ nullable: true })
66210
+ EntityID?: string;
66211
+
66212
+ @Field({ nullable: true })
66213
+ ExtraFilter: string | null;
66214
+
66215
+ @Field({ nullable: true })
66216
+ UserSearchString: string | null;
66217
+
66218
+ @Field(() => RestoreContextInput, { nullable: true })
66219
+ RestoreContext___?: RestoreContextInput;
66220
+ }
66221
+
66222
+
66223
+ //****************************************************************************
66224
+ // INPUT TYPE for MJ: Search Scope Entities
66225
+ //****************************************************************************
66226
+ @InputType()
66227
+ export class UpdateMJSearchScopeEntityInput {
66228
+ @Field()
66229
+ ID: string;
66230
+
66231
+ @Field({ nullable: true })
66232
+ SearchScopeID?: string;
66233
+
66234
+ @Field({ nullable: true })
66235
+ EntityID?: string;
66236
+
66237
+ @Field({ nullable: true })
66238
+ ExtraFilter?: string | null;
66239
+
66240
+ @Field({ nullable: true })
66241
+ UserSearchString?: string | null;
66242
+
66243
+ @Field(() => [KeyValuePairInput], { nullable: true })
66244
+ OldValues___?: KeyValuePairInput[];
66245
+
66246
+ @Field(() => RestoreContextInput, { nullable: true })
66247
+ RestoreContext___?: RestoreContextInput;
66248
+ }
66249
+
66250
+ //****************************************************************************
66251
+ // RESOLVER for MJ: Search Scope Entities
66252
+ //****************************************************************************
66253
+ @ObjectType()
66254
+ export class RunMJSearchScopeEntityViewResult {
66255
+ @Field(() => [MJSearchScopeEntity_])
66256
+ Results: MJSearchScopeEntity_[];
66257
+
66258
+ @Field(() => String, {nullable: true})
66259
+ UserViewRunID?: string;
66260
+
66261
+ @Field(() => Int, {nullable: true})
66262
+ RowCount: number;
66263
+
66264
+ @Field(() => Int, {nullable: true})
66265
+ TotalRowCount: number;
66266
+
66267
+ @Field(() => Int, {nullable: true})
66268
+ ExecutionTime: number;
66269
+
66270
+ @Field({nullable: true})
66271
+ ErrorMessage?: string;
66272
+
66273
+ @Field(() => Boolean, {nullable: false})
66274
+ Success: boolean;
66275
+ }
66276
+
66277
+ @Resolver(MJSearchScopeEntity_)
66278
+ export class MJSearchScopeEntityResolver extends ResolverBase {
66279
+ @Query(() => RunMJSearchScopeEntityViewResult)
66280
+ async RunMJSearchScopeEntityViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66281
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66282
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
66283
+ }
66284
+
66285
+ @Query(() => RunMJSearchScopeEntityViewResult)
66286
+ async RunMJSearchScopeEntityViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66287
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66288
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
66289
+ }
66290
+
66291
+ @Query(() => RunMJSearchScopeEntityViewResult)
66292
+ async RunMJSearchScopeEntityDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66293
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66294
+ input.EntityName = 'MJ: Search Scope Entities';
66295
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
66296
+ }
66297
+ @Query(() => MJSearchScopeEntity_, { nullable: true })
66298
+ async MJSearchScopeEntity(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchScopeEntity_ | null> {
66299
+ this.CheckUserReadPermissions('MJ: Search Scope Entities', userPayload);
66300
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66301
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeEntities')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Entities', userPayload, EntityPermissionType.Read, 'AND');
66302
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
66303
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Scope Entities', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
66304
+ return result;
66305
+ }
66306
+
66307
+ @Mutation(() => MJSearchScopeEntity_)
66308
+ async CreateMJSearchScopeEntity(
66309
+ @Arg('input', () => CreateMJSearchScopeEntityInput) input: CreateMJSearchScopeEntityInput,
66310
+ @Ctx() { providers, userPayload }: AppContext,
66311
+ @PubSub() pubSub: PubSubEngine
66312
+ ) {
66313
+ const provider = GetReadWriteProvider(providers);
66314
+ return this.CreateRecord('MJ: Search Scope Entities', input, provider, userPayload, pubSub)
66315
+ }
66316
+
66317
+ @Mutation(() => MJSearchScopeEntity_)
66318
+ async UpdateMJSearchScopeEntity(
66319
+ @Arg('input', () => UpdateMJSearchScopeEntityInput) input: UpdateMJSearchScopeEntityInput,
66320
+ @Ctx() { providers, userPayload }: AppContext,
66321
+ @PubSub() pubSub: PubSubEngine
66322
+ ) {
66323
+ const provider = GetReadWriteProvider(providers);
66324
+ return this.UpdateRecord('MJ: Search Scope Entities', input, provider, userPayload, pubSub);
66325
+ }
66326
+
66327
+ @Mutation(() => MJSearchScopeEntity_)
66328
+ async DeleteMJSearchScopeEntity(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66329
+ const provider = GetReadWriteProvider(providers);
66330
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
66331
+ return this.DeleteRecord('MJ: Search Scope Entities', key, options, provider, userPayload, pubSub);
66332
+ }
66333
+
66334
+ }
66335
+
66336
+ //****************************************************************************
66337
+ // ENTITY CLASS for MJ: Search Scope External Indexes
66338
+ //****************************************************************************
66339
+ @ObjectType({ description: `Scoped external/provider-owned indexes. Generic — covers vector stores (Pinecone, Qdrant, PGVector) and text/hybrid engines (Elasticsearch, Typesense, Azure AI Search, OpenSearch). A single scope can mix types; each row is consumed only by the provider matching its IndexType.` })
66340
+ export class MJSearchScopeExternalIndex_ {
66341
+ @Field()
66342
+ @MaxLength(36)
66343
+ ID: string;
66344
+
66345
+ @Field()
66346
+ @MaxLength(36)
66347
+ SearchScopeID: string;
66348
+
66349
+ @Field({description: `Discriminator. Determines which provider class consumes this row: Vector | Elasticsearch | Typesense | AzureAISearch | OpenSearch | Other.`})
66350
+ @MaxLength(40)
66351
+ IndexType: string;
66352
+
66353
+ @Field({nullable: true, description: `FK to VectorIndex. REQUIRED when IndexType='Vector'. NULL for all other IndexType values.`})
66354
+ @MaxLength(36)
66355
+ VectorIndexID?: string;
66356
+
66357
+ @Field({nullable: true, description: `For non-vector IndexTypes: the remote engine's index/collection/alias name (e.g., Elasticsearch index "kb_docs_v3", Typesense collection "articles"). NULL for IndexType='Vector' (VectorIndexID resolves the name instead).`})
66358
+ @MaxLength(400)
66359
+ ExternalIndexName?: string;
66360
+
66361
+ @Field({nullable: true, description: `JSON with extra connection/config hints the provider needs (cluster alias, routing key, custom analyzer, etc.). Provider-interpreted.`})
66362
+ ExternalIndexConfig?: string;
66363
+
66364
+ @Field({nullable: true, description: `JSON filter expression applied as a native metadata filter on the remote engine. Pinecone/Qdrant/PGVector metadata filter, or Elasticsearch filter DSL, etc. Rendered as a Nunjucks template so SearchContext.PrimaryScopeRecordID and SearchContext.SecondaryScopes.* can be interpolated for multi-tenant filtering.`})
66365
+ MetadataFilter?: string;
66366
+
66367
+ @Field()
66368
+ _mj__CreatedAt: Date;
66369
+
66370
+ @Field()
66371
+ _mj__UpdatedAt: Date;
66372
+
66373
+ @Field()
66374
+ @MaxLength(200)
66375
+ SearchScope: string;
66376
+
66377
+ @Field({nullable: true})
66378
+ @MaxLength(255)
66379
+ VectorIndex?: string;
66380
+
66381
+ }
66382
+
66383
+ //****************************************************************************
66384
+ // INPUT TYPE for MJ: Search Scope External Indexes
66385
+ //****************************************************************************
66386
+ @InputType()
66387
+ export class CreateMJSearchScopeExternalIndexInput {
66388
+ @Field({ nullable: true })
66389
+ ID?: string;
66390
+
66391
+ @Field({ nullable: true })
66392
+ SearchScopeID?: string;
66393
+
66394
+ @Field({ nullable: true })
66395
+ IndexType?: string;
66396
+
66397
+ @Field({ nullable: true })
66398
+ VectorIndexID: string | null;
66399
+
66400
+ @Field({ nullable: true })
66401
+ ExternalIndexName: string | null;
66402
+
66403
+ @Field({ nullable: true })
66404
+ ExternalIndexConfig: string | null;
66405
+
66406
+ @Field({ nullable: true })
66407
+ MetadataFilter: string | null;
66408
+
66409
+ @Field(() => RestoreContextInput, { nullable: true })
66410
+ RestoreContext___?: RestoreContextInput;
66411
+ }
66412
+
66413
+
66414
+ //****************************************************************************
66415
+ // INPUT TYPE for MJ: Search Scope External Indexes
66416
+ //****************************************************************************
66417
+ @InputType()
66418
+ export class UpdateMJSearchScopeExternalIndexInput {
66419
+ @Field()
66420
+ ID: string;
66421
+
66422
+ @Field({ nullable: true })
66423
+ SearchScopeID?: string;
66424
+
66425
+ @Field({ nullable: true })
66426
+ IndexType?: string;
66427
+
66428
+ @Field({ nullable: true })
66429
+ VectorIndexID?: string | null;
66430
+
66431
+ @Field({ nullable: true })
66432
+ ExternalIndexName?: string | null;
66433
+
66434
+ @Field({ nullable: true })
66435
+ ExternalIndexConfig?: string | null;
66436
+
66437
+ @Field({ nullable: true })
66438
+ MetadataFilter?: string | null;
66439
+
66440
+ @Field(() => [KeyValuePairInput], { nullable: true })
66441
+ OldValues___?: KeyValuePairInput[];
66442
+
66443
+ @Field(() => RestoreContextInput, { nullable: true })
66444
+ RestoreContext___?: RestoreContextInput;
66445
+ }
66446
+
66447
+ //****************************************************************************
66448
+ // RESOLVER for MJ: Search Scope External Indexes
66449
+ //****************************************************************************
66450
+ @ObjectType()
66451
+ export class RunMJSearchScopeExternalIndexViewResult {
66452
+ @Field(() => [MJSearchScopeExternalIndex_])
66453
+ Results: MJSearchScopeExternalIndex_[];
66454
+
66455
+ @Field(() => String, {nullable: true})
66456
+ UserViewRunID?: string;
66457
+
66458
+ @Field(() => Int, {nullable: true})
66459
+ RowCount: number;
66460
+
66461
+ @Field(() => Int, {nullable: true})
66462
+ TotalRowCount: number;
66463
+
66464
+ @Field(() => Int, {nullable: true})
66465
+ ExecutionTime: number;
66466
+
66467
+ @Field({nullable: true})
66468
+ ErrorMessage?: string;
66469
+
66470
+ @Field(() => Boolean, {nullable: false})
66471
+ Success: boolean;
66472
+ }
66473
+
66474
+ @Resolver(MJSearchScopeExternalIndex_)
66475
+ export class MJSearchScopeExternalIndexResolver extends ResolverBase {
66476
+ @Query(() => RunMJSearchScopeExternalIndexViewResult)
66477
+ async RunMJSearchScopeExternalIndexViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66478
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66479
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
66480
+ }
66481
+
66482
+ @Query(() => RunMJSearchScopeExternalIndexViewResult)
66483
+ async RunMJSearchScopeExternalIndexViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66484
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66485
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
66486
+ }
66487
+
66488
+ @Query(() => RunMJSearchScopeExternalIndexViewResult)
66489
+ async RunMJSearchScopeExternalIndexDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66490
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66491
+ input.EntityName = 'MJ: Search Scope External Indexes';
66492
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
66493
+ }
66494
+ @Query(() => MJSearchScopeExternalIndex_, { nullable: true })
66495
+ async MJSearchScopeExternalIndex(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchScopeExternalIndex_ | null> {
66496
+ this.CheckUserReadPermissions('MJ: Search Scope External Indexes', userPayload);
66497
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66498
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeExternalIndexes')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope External Indexes', userPayload, EntityPermissionType.Read, 'AND');
66499
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
66500
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Scope External Indexes', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
66501
+ return result;
66502
+ }
66503
+
66504
+ @Mutation(() => MJSearchScopeExternalIndex_)
66505
+ async CreateMJSearchScopeExternalIndex(
66506
+ @Arg('input', () => CreateMJSearchScopeExternalIndexInput) input: CreateMJSearchScopeExternalIndexInput,
66507
+ @Ctx() { providers, userPayload }: AppContext,
66508
+ @PubSub() pubSub: PubSubEngine
66509
+ ) {
66510
+ const provider = GetReadWriteProvider(providers);
66511
+ return this.CreateRecord('MJ: Search Scope External Indexes', input, provider, userPayload, pubSub)
66512
+ }
66513
+
66514
+ @Mutation(() => MJSearchScopeExternalIndex_)
66515
+ async UpdateMJSearchScopeExternalIndex(
66516
+ @Arg('input', () => UpdateMJSearchScopeExternalIndexInput) input: UpdateMJSearchScopeExternalIndexInput,
66517
+ @Ctx() { providers, userPayload }: AppContext,
66518
+ @PubSub() pubSub: PubSubEngine
66519
+ ) {
66520
+ const provider = GetReadWriteProvider(providers);
66521
+ return this.UpdateRecord('MJ: Search Scope External Indexes', input, provider, userPayload, pubSub);
66522
+ }
66523
+
66524
+ @Mutation(() => MJSearchScopeExternalIndex_)
66525
+ async DeleteMJSearchScopeExternalIndex(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66526
+ const provider = GetReadWriteProvider(providers);
66527
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
66528
+ return this.DeleteRecord('MJ: Search Scope External Indexes', key, options, provider, userPayload, pubSub);
66529
+ }
66530
+
66531
+ }
66532
+
66533
+ //****************************************************************************
66534
+ // ENTITY CLASS for MJ: Search Scope Permissions
66535
+ //****************************************************************************
66536
+ @ObjectType({ description: `Per-user or per-role permission grant on a SearchScope. Exactly one of UserID or RoleID is set on each row; the other is NULL. PermissionLevel is one of None, Read, Search, Manage. Combined with AIAgent.SearchScopeAccess for agent-side fallbacks via the SearchScopePermissionResolver.` })
66537
+ export class MJSearchScopePermission_ {
66538
+ @Field({description: `Primary key. Auto-generated.`})
66539
+ @MaxLength(36)
66540
+ ID: string;
66541
+
66542
+ @Field({description: `The SearchScope this permission row applies to.`})
66543
+ @MaxLength(36)
66544
+ SearchScopeID: string;
66545
+
66546
+ @Field({nullable: true, description: `The user this permission applies to. Mutually exclusive with RoleID — exactly one must be set.`})
66547
+ @MaxLength(36)
66548
+ UserID?: string;
66549
+
66550
+ @Field({nullable: true, description: `The role this permission applies to. Mutually exclusive with UserID — exactly one must be set. Permissions granted via roles flow to all users in that role.`})
66551
+ @MaxLength(36)
66552
+ RoleID?: string;
66553
+
66554
+ @Field({description: `Capability granted on this SearchScope. None = explicit deny (overrides role grants), Read = view scope metadata, Search = invoke ScopedSearchAction, Manage = full edit including authoring of permission rows. The resolver picks the highest level when multiple grants apply (direct + role).`})
66555
+ @MaxLength(20)
66556
+ PermissionLevel: string;
66557
+
66558
+ @Field()
66559
+ _mj__CreatedAt: Date;
66560
+
66561
+ @Field()
66562
+ _mj__UpdatedAt: Date;
66563
+
66564
+ @Field()
66565
+ @MaxLength(200)
66566
+ SearchScope: string;
66567
+
66568
+ @Field({nullable: true})
66569
+ @MaxLength(100)
66570
+ User?: string;
66571
+
66572
+ @Field({nullable: true})
66573
+ @MaxLength(50)
66574
+ Role?: string;
66575
+
66576
+ }
66577
+
66578
+ //****************************************************************************
66579
+ // INPUT TYPE for MJ: Search Scope Permissions
66580
+ //****************************************************************************
66581
+ @InputType()
66582
+ export class CreateMJSearchScopePermissionInput {
66583
+ @Field({ nullable: true })
66584
+ ID?: string;
66585
+
66586
+ @Field({ nullable: true })
66587
+ SearchScopeID?: string;
66588
+
66589
+ @Field({ nullable: true })
66590
+ UserID: string | null;
66591
+
66592
+ @Field({ nullable: true })
66593
+ RoleID: string | null;
66594
+
66595
+ @Field({ nullable: true })
66596
+ PermissionLevel?: string;
66597
+
66598
+ @Field(() => RestoreContextInput, { nullable: true })
66599
+ RestoreContext___?: RestoreContextInput;
66600
+ }
66601
+
66602
+
66603
+ //****************************************************************************
66604
+ // INPUT TYPE for MJ: Search Scope Permissions
66605
+ //****************************************************************************
66606
+ @InputType()
66607
+ export class UpdateMJSearchScopePermissionInput {
66608
+ @Field()
66609
+ ID: string;
66610
+
66611
+ @Field({ nullable: true })
66612
+ SearchScopeID?: string;
66613
+
66614
+ @Field({ nullable: true })
66615
+ UserID?: string | null;
66616
+
66617
+ @Field({ nullable: true })
66618
+ RoleID?: string | null;
66619
+
66620
+ @Field({ nullable: true })
66621
+ PermissionLevel?: string;
66622
+
66623
+ @Field(() => [KeyValuePairInput], { nullable: true })
66624
+ OldValues___?: KeyValuePairInput[];
66625
+
66626
+ @Field(() => RestoreContextInput, { nullable: true })
66627
+ RestoreContext___?: RestoreContextInput;
66628
+ }
66629
+
66630
+ //****************************************************************************
66631
+ // RESOLVER for MJ: Search Scope Permissions
66632
+ //****************************************************************************
66633
+ @ObjectType()
66634
+ export class RunMJSearchScopePermissionViewResult {
66635
+ @Field(() => [MJSearchScopePermission_])
66636
+ Results: MJSearchScopePermission_[];
66637
+
66638
+ @Field(() => String, {nullable: true})
66639
+ UserViewRunID?: string;
66640
+
66641
+ @Field(() => Int, {nullable: true})
66642
+ RowCount: number;
66643
+
66644
+ @Field(() => Int, {nullable: true})
66645
+ TotalRowCount: number;
66646
+
66647
+ @Field(() => Int, {nullable: true})
66648
+ ExecutionTime: number;
66649
+
66650
+ @Field({nullable: true})
66651
+ ErrorMessage?: string;
66652
+
66653
+ @Field(() => Boolean, {nullable: false})
66654
+ Success: boolean;
66655
+ }
66656
+
66657
+ @Resolver(MJSearchScopePermission_)
66658
+ export class MJSearchScopePermissionResolver extends ResolverBase {
66659
+ @Query(() => RunMJSearchScopePermissionViewResult)
66660
+ async RunMJSearchScopePermissionViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66661
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66662
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
66663
+ }
66664
+
66665
+ @Query(() => RunMJSearchScopePermissionViewResult)
66666
+ async RunMJSearchScopePermissionViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66667
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66668
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
66669
+ }
66670
+
66671
+ @Query(() => RunMJSearchScopePermissionViewResult)
66672
+ async RunMJSearchScopePermissionDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66673
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66674
+ input.EntityName = 'MJ: Search Scope Permissions';
66675
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
66676
+ }
66677
+ @Query(() => MJSearchScopePermission_, { nullable: true })
66678
+ async MJSearchScopePermission(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchScopePermission_ | null> {
66679
+ this.CheckUserReadPermissions('MJ: Search Scope Permissions', userPayload);
66680
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66681
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopePermissions')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Permissions', userPayload, EntityPermissionType.Read, 'AND');
66682
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
66683
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Scope Permissions', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
66684
+ return result;
66685
+ }
66686
+
66687
+ @Mutation(() => MJSearchScopePermission_)
66688
+ async CreateMJSearchScopePermission(
66689
+ @Arg('input', () => CreateMJSearchScopePermissionInput) input: CreateMJSearchScopePermissionInput,
66690
+ @Ctx() { providers, userPayload }: AppContext,
66691
+ @PubSub() pubSub: PubSubEngine
66692
+ ) {
66693
+ const provider = GetReadWriteProvider(providers);
66694
+ return this.CreateRecord('MJ: Search Scope Permissions', input, provider, userPayload, pubSub)
66695
+ }
66696
+
66697
+ @Mutation(() => MJSearchScopePermission_)
66698
+ async UpdateMJSearchScopePermission(
66699
+ @Arg('input', () => UpdateMJSearchScopePermissionInput) input: UpdateMJSearchScopePermissionInput,
66700
+ @Ctx() { providers, userPayload }: AppContext,
66701
+ @PubSub() pubSub: PubSubEngine
66702
+ ) {
66703
+ const provider = GetReadWriteProvider(providers);
66704
+ return this.UpdateRecord('MJ: Search Scope Permissions', input, provider, userPayload, pubSub);
66705
+ }
66706
+
66707
+ @Mutation(() => MJSearchScopePermission_)
66708
+ async DeleteMJSearchScopePermission(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66709
+ const provider = GetReadWriteProvider(providers);
66710
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
66711
+ return this.DeleteRecord('MJ: Search Scope Permissions', key, options, provider, userPayload, pubSub);
66712
+ }
66713
+
66714
+ }
66715
+
66716
+ //****************************************************************************
66717
+ // ENTITY CLASS for MJ: Search Scope Providers
66718
+ //****************************************************************************
66719
+ @ObjectType({ description: `Controls which SearchProviders participate in a given SearchScope. Each row enables one provider within one scope, with optional overrides.` })
66720
+ export class MJSearchScopeProvider_ {
66721
+ @Field()
66722
+ @MaxLength(36)
66723
+ ID: string;
66724
+
66725
+ @Field()
66726
+ @MaxLength(36)
66727
+ SearchScopeID: string;
66728
+
66729
+ @Field()
66730
+ @MaxLength(36)
66731
+ SearchProviderID: string;
66732
+
66733
+ @Field(() => Boolean, {description: `Whether this provider is active for this scope. Lets an admin toggle providers off per-scope without deleting the row.`})
66734
+ Enabled: boolean;
66735
+
66736
+ @Field(() => Int, {nullable: true, description: `Override the max-results value for this provider within this scope. NULL = use the provider's default.`})
66737
+ MaxResultsOverride?: number;
66738
+
66739
+ @Field({nullable: true, description: `JSON override for provider-specific configuration within this scope. Provider interprets.`})
66740
+ ProviderConfigOverride?: string;
66741
+
66742
+ @Field({nullable: true, description: `Optional FK to Templates. When set, the user/agent query is rewritten through this Template before being sent to this provider. Lets vector providers get a chunk-shaped rewrite while FTS providers get keyword extraction within the same scope. Resolution order: this > AIAgentSearchScope.QueryTemplateID > raw lastUserMessage.`})
66743
+ @MaxLength(36)
66744
+ QueryTransformTemplateID?: string;
66745
+
66746
+ @Field()
66747
+ _mj__CreatedAt: Date;
66748
+
66749
+ @Field()
66750
+ _mj__UpdatedAt: Date;
66751
+
66752
+ @Field()
66753
+ @MaxLength(200)
66754
+ SearchScope: string;
66755
+
66756
+ @Field()
66757
+ @MaxLength(200)
66758
+ SearchProvider: string;
66759
+
66760
+ @Field({nullable: true})
66761
+ @MaxLength(255)
66762
+ QueryTransformTemplate?: string;
66763
+
66764
+ }
66765
+
66766
+ //****************************************************************************
66767
+ // INPUT TYPE for MJ: Search Scope Providers
66768
+ //****************************************************************************
66769
+ @InputType()
66770
+ export class CreateMJSearchScopeProviderInput {
66771
+ @Field({ nullable: true })
66772
+ ID?: string;
66773
+
66774
+ @Field({ nullable: true })
66775
+ SearchScopeID?: string;
66776
+
66777
+ @Field({ nullable: true })
66778
+ SearchProviderID?: string;
66779
+
66780
+ @Field(() => Boolean, { nullable: true })
66781
+ Enabled?: boolean;
66782
+
66783
+ @Field(() => Int, { nullable: true })
66784
+ MaxResultsOverride: number | null;
66785
+
66786
+ @Field({ nullable: true })
66787
+ ProviderConfigOverride: string | null;
66788
+
66789
+ @Field({ nullable: true })
66790
+ QueryTransformTemplateID: string | null;
66791
+
66792
+ @Field(() => RestoreContextInput, { nullable: true })
66793
+ RestoreContext___?: RestoreContextInput;
66794
+ }
66795
+
66796
+
66797
+ //****************************************************************************
66798
+ // INPUT TYPE for MJ: Search Scope Providers
66799
+ //****************************************************************************
66800
+ @InputType()
66801
+ export class UpdateMJSearchScopeProviderInput {
66802
+ @Field()
66803
+ ID: string;
66804
+
66805
+ @Field({ nullable: true })
66806
+ SearchScopeID?: string;
66807
+
66808
+ @Field({ nullable: true })
66809
+ SearchProviderID?: string;
66810
+
66811
+ @Field(() => Boolean, { nullable: true })
66812
+ Enabled?: boolean;
66813
+
66814
+ @Field(() => Int, { nullable: true })
66815
+ MaxResultsOverride?: number | null;
66816
+
66817
+ @Field({ nullable: true })
66818
+ ProviderConfigOverride?: string | null;
66819
+
66820
+ @Field({ nullable: true })
66821
+ QueryTransformTemplateID?: string | null;
66822
+
66823
+ @Field(() => [KeyValuePairInput], { nullable: true })
66824
+ OldValues___?: KeyValuePairInput[];
66825
+
66826
+ @Field(() => RestoreContextInput, { nullable: true })
66827
+ RestoreContext___?: RestoreContextInput;
66828
+ }
66829
+
66830
+ //****************************************************************************
66831
+ // RESOLVER for MJ: Search Scope Providers
66832
+ //****************************************************************************
66833
+ @ObjectType()
66834
+ export class RunMJSearchScopeProviderViewResult {
66835
+ @Field(() => [MJSearchScopeProvider_])
66836
+ Results: MJSearchScopeProvider_[];
66837
+
66838
+ @Field(() => String, {nullable: true})
66839
+ UserViewRunID?: string;
66840
+
66841
+ @Field(() => Int, {nullable: true})
66842
+ RowCount: number;
66843
+
66844
+ @Field(() => Int, {nullable: true})
66845
+ TotalRowCount: number;
66846
+
66847
+ @Field(() => Int, {nullable: true})
66848
+ ExecutionTime: number;
66849
+
66850
+ @Field({nullable: true})
66851
+ ErrorMessage?: string;
66852
+
66853
+ @Field(() => Boolean, {nullable: false})
66854
+ Success: boolean;
66855
+ }
66856
+
66857
+ @Resolver(MJSearchScopeProvider_)
66858
+ export class MJSearchScopeProviderResolver extends ResolverBase {
66859
+ @Query(() => RunMJSearchScopeProviderViewResult)
66860
+ async RunMJSearchScopeProviderViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66861
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66862
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
66863
+ }
66864
+
66865
+ @Query(() => RunMJSearchScopeProviderViewResult)
66866
+ async RunMJSearchScopeProviderViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66867
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66868
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
66869
+ }
66870
+
66871
+ @Query(() => RunMJSearchScopeProviderViewResult)
66872
+ async RunMJSearchScopeProviderDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66873
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66874
+ input.EntityName = 'MJ: Search Scope Providers';
66875
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
66876
+ }
66877
+ @Query(() => MJSearchScopeProvider_, { nullable: true })
66878
+ async MJSearchScopeProvider(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchScopeProvider_ | null> {
66879
+ this.CheckUserReadPermissions('MJ: Search Scope Providers', userPayload);
66880
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
66881
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeProviders')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Providers', userPayload, EntityPermissionType.Read, 'AND');
66882
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
66883
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Scope Providers', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
66884
+ return result;
66885
+ }
66886
+
66887
+ @Mutation(() => MJSearchScopeProvider_)
66888
+ async CreateMJSearchScopeProvider(
66889
+ @Arg('input', () => CreateMJSearchScopeProviderInput) input: CreateMJSearchScopeProviderInput,
66890
+ @Ctx() { providers, userPayload }: AppContext,
66891
+ @PubSub() pubSub: PubSubEngine
66892
+ ) {
66893
+ const provider = GetReadWriteProvider(providers);
66894
+ return this.CreateRecord('MJ: Search Scope Providers', input, provider, userPayload, pubSub)
66895
+ }
66896
+
66897
+ @Mutation(() => MJSearchScopeProvider_)
66898
+ async UpdateMJSearchScopeProvider(
66899
+ @Arg('input', () => UpdateMJSearchScopeProviderInput) input: UpdateMJSearchScopeProviderInput,
66900
+ @Ctx() { providers, userPayload }: AppContext,
66901
+ @PubSub() pubSub: PubSubEngine
66902
+ ) {
66903
+ const provider = GetReadWriteProvider(providers);
66904
+ return this.UpdateRecord('MJ: Search Scope Providers', input, provider, userPayload, pubSub);
66905
+ }
66906
+
66907
+ @Mutation(() => MJSearchScopeProvider_)
66908
+ async DeleteMJSearchScopeProvider(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
66909
+ const provider = GetReadWriteProvider(providers);
66910
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
66911
+ return this.DeleteRecord('MJ: Search Scope Providers', key, options, provider, userPayload, pubSub);
66912
+ }
66913
+
65370
66914
  }
65371
66915
 
65372
66916
  //****************************************************************************
65373
- // INPUT TYPE for MJ: Search Providers
66917
+ // ENTITY CLASS for MJ: Search Scope Storage Accounts
66918
+ //****************************************************************************
66919
+ @ObjectType({ description: `Controls which file storage accounts/folders participate in a scope.` })
66920
+ export class MJSearchScopeStorageAccount_ {
66921
+ @Field()
66922
+ @MaxLength(36)
66923
+ ID: string;
66924
+
66925
+ @Field()
66926
+ @MaxLength(36)
66927
+ SearchScopeID: string;
66928
+
66929
+ @Field()
66930
+ @MaxLength(36)
66931
+ FileStorageAccountID: string;
66932
+
66933
+ @Field({nullable: true, description: `Optional folder path restriction. NULL = entire storage account. Example: /policies/hr/. Rendered as a Nunjucks template with SearchContext variables so platforms can do per-tenant folder routing like /tenants/{{ context.PrimaryScopeRecordID }}/.`})
66934
+ @MaxLength(1000)
66935
+ FolderPath?: string;
66936
+
66937
+ @Field()
66938
+ _mj__CreatedAt: Date;
66939
+
66940
+ @Field()
66941
+ _mj__UpdatedAt: Date;
66942
+
66943
+ @Field()
66944
+ @MaxLength(200)
66945
+ SearchScope: string;
66946
+
66947
+ @Field()
66948
+ @MaxLength(200)
66949
+ FileStorageAccount: string;
66950
+
66951
+ }
66952
+
66953
+ //****************************************************************************
66954
+ // INPUT TYPE for MJ: Search Scope Storage Accounts
65374
66955
  //****************************************************************************
65375
66956
  @InputType()
65376
- export class CreateMJSearchProviderInput {
66957
+ export class CreateMJSearchScopeStorageAccountInput {
65377
66958
  @Field({ nullable: true })
65378
66959
  ID?: string;
65379
66960
 
65380
66961
  @Field({ nullable: true })
65381
- Name?: string;
66962
+ SearchScopeID?: string;
65382
66963
 
65383
66964
  @Field({ nullable: true })
65384
- Description: string | null;
66965
+ FileStorageAccountID?: string;
65385
66966
 
65386
66967
  @Field({ nullable: true })
65387
- DriverClass?: string;
66968
+ FolderPath: string | null;
66969
+
66970
+ @Field(() => RestoreContextInput, { nullable: true })
66971
+ RestoreContext___?: RestoreContextInput;
66972
+ }
66973
+
66974
+
66975
+ //****************************************************************************
66976
+ // INPUT TYPE for MJ: Search Scope Storage Accounts
66977
+ //****************************************************************************
66978
+ @InputType()
66979
+ export class UpdateMJSearchScopeStorageAccountInput {
66980
+ @Field()
66981
+ ID: string;
65388
66982
 
65389
66983
  @Field({ nullable: true })
65390
- Status?: string;
66984
+ SearchScopeID?: string;
65391
66985
 
65392
- @Field(() => Int, { nullable: true })
65393
- Priority?: number;
66986
+ @Field({ nullable: true })
66987
+ FileStorageAccountID?: string;
65394
66988
 
65395
- @Field(() => Boolean, { nullable: true })
65396
- SupportsPreview?: boolean;
66989
+ @Field({ nullable: true })
66990
+ FolderPath?: string | null;
65397
66991
 
65398
- @Field(() => Int, { nullable: true })
65399
- MaxResultsOverride: number | null;
66992
+ @Field(() => [KeyValuePairInput], { nullable: true })
66993
+ OldValues___?: KeyValuePairInput[];
66994
+
66995
+ @Field(() => RestoreContextInput, { nullable: true })
66996
+ RestoreContext___?: RestoreContextInput;
66997
+ }
66998
+
66999
+ //****************************************************************************
67000
+ // RESOLVER for MJ: Search Scope Storage Accounts
67001
+ //****************************************************************************
67002
+ @ObjectType()
67003
+ export class RunMJSearchScopeStorageAccountViewResult {
67004
+ @Field(() => [MJSearchScopeStorageAccount_])
67005
+ Results: MJSearchScopeStorageAccount_[];
67006
+
67007
+ @Field(() => String, {nullable: true})
67008
+ UserViewRunID?: string;
67009
+
67010
+ @Field(() => Int, {nullable: true})
67011
+ RowCount: number;
67012
+
67013
+ @Field(() => Int, {nullable: true})
67014
+ TotalRowCount: number;
67015
+
67016
+ @Field(() => Int, {nullable: true})
67017
+ ExecutionTime: number;
67018
+
67019
+ @Field({nullable: true})
67020
+ ErrorMessage?: string;
67021
+
67022
+ @Field(() => Boolean, {nullable: false})
67023
+ Success: boolean;
67024
+ }
67025
+
67026
+ @Resolver(MJSearchScopeStorageAccount_)
67027
+ export class MJSearchScopeStorageAccountResolver extends ResolverBase {
67028
+ @Query(() => RunMJSearchScopeStorageAccountViewResult)
67029
+ async RunMJSearchScopeStorageAccountViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67030
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67031
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
67032
+ }
67033
+
67034
+ @Query(() => RunMJSearchScopeStorageAccountViewResult)
67035
+ async RunMJSearchScopeStorageAccountViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67036
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67037
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
67038
+ }
67039
+
67040
+ @Query(() => RunMJSearchScopeStorageAccountViewResult)
67041
+ async RunMJSearchScopeStorageAccountDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67042
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67043
+ input.EntityName = 'MJ: Search Scope Storage Accounts';
67044
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
67045
+ }
67046
+ @Query(() => MJSearchScopeStorageAccount_, { nullable: true })
67047
+ async MJSearchScopeStorageAccount(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchScopeStorageAccount_ | null> {
67048
+ this.CheckUserReadPermissions('MJ: Search Scope Storage Accounts', userPayload);
67049
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67050
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeStorageAccounts')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
67051
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67052
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Scope Storage Accounts', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
67053
+ return result;
67054
+ }
67055
+
67056
+ @Mutation(() => MJSearchScopeStorageAccount_)
67057
+ async CreateMJSearchScopeStorageAccount(
67058
+ @Arg('input', () => CreateMJSearchScopeStorageAccountInput) input: CreateMJSearchScopeStorageAccountInput,
67059
+ @Ctx() { providers, userPayload }: AppContext,
67060
+ @PubSub() pubSub: PubSubEngine
67061
+ ) {
67062
+ const provider = GetReadWriteProvider(providers);
67063
+ return this.CreateRecord('MJ: Search Scope Storage Accounts', input, provider, userPayload, pubSub)
67064
+ }
67065
+
67066
+ @Mutation(() => MJSearchScopeStorageAccount_)
67067
+ async UpdateMJSearchScopeStorageAccount(
67068
+ @Arg('input', () => UpdateMJSearchScopeStorageAccountInput) input: UpdateMJSearchScopeStorageAccountInput,
67069
+ @Ctx() { providers, userPayload }: AppContext,
67070
+ @PubSub() pubSub: PubSubEngine
67071
+ ) {
67072
+ const provider = GetReadWriteProvider(providers);
67073
+ return this.UpdateRecord('MJ: Search Scope Storage Accounts', input, provider, userPayload, pubSub);
67074
+ }
67075
+
67076
+ @Mutation(() => MJSearchScopeStorageAccount_)
67077
+ async DeleteMJSearchScopeStorageAccount(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67078
+ const provider = GetReadWriteProvider(providers);
67079
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
67080
+ return this.DeleteRecord('MJ: Search Scope Storage Accounts', key, options, provider, userPayload, pubSub);
67081
+ }
67082
+
67083
+ }
67084
+
67085
+ //****************************************************************************
67086
+ // ENTITY CLASS for MJ: Search Scope Test Queries
67087
+ //****************************************************************************
67088
+ @ObjectType({ description: `Canonical test queries owned by a SearchScope. Used by scope authors to validate tuning changes — re-run a saved query after swapping the reranker or adjusting fusion weights and compare results to the prior run.` })
67089
+ export class MJSearchScopeTestQuery_ {
67090
+ @Field()
67091
+ @MaxLength(36)
67092
+ ID: string;
67093
+
67094
+ @Field({description: `The SearchScope this test query belongs to. Cascade-restricted via FK so accidental scope deletion preserves test history.`})
67095
+ @MaxLength(36)
67096
+ SearchScopeID: string;
67097
+
67098
+ @Field({description: `Short human-readable label for the test query, shown in the form's test-query grid (e.g. "VIP customer escalation", "expense reimbursement policy").`})
67099
+ @MaxLength(200)
67100
+ Label: string;
67101
+
67102
+ @Field({description: `The query text itself. NVARCHAR(MAX) because canonical queries can be full sentences or chunks of natural-language context.`})
67103
+ Query: string;
67104
+
67105
+ @Field({nullable: true, description: `Optional MJ entity name (e.g. "Contacts", "Documents") of the expected top result. When set together with ExpectedTopResultRecordID, lets the test runner assert that the tuned scope returns the right record at rank #1 — a regression tripwire for fusion / reranker changes.`})
67106
+ @MaxLength(255)
67107
+ ExpectedTopResultEntity?: string;
67108
+
67109
+ @Field({nullable: true, description: `Optional record ID of the expected top result, paired with ExpectedTopResultEntity. NULL = no assertion (the query is exploratory).`})
67110
+ @MaxLength(36)
67111
+ ExpectedTopResultRecordID?: string;
67112
+
67113
+ @Field({nullable: true, description: `Free-form notes explaining why this query is canonical or what edge case it represents.`})
67114
+ Notes?: string;
67115
+
67116
+ @Field()
67117
+ _mj__CreatedAt: Date;
67118
+
67119
+ @Field()
67120
+ _mj__UpdatedAt: Date;
67121
+
67122
+ @Field()
67123
+ @MaxLength(200)
67124
+ SearchScope: string;
67125
+
67126
+ }
65400
67127
 
67128
+ //****************************************************************************
67129
+ // INPUT TYPE for MJ: Search Scope Test Queries
67130
+ //****************************************************************************
67131
+ @InputType()
67132
+ export class CreateMJSearchScopeTestQueryInput {
65401
67133
  @Field({ nullable: true })
65402
- ProviderConfig: string | null;
67134
+ ID?: string;
65403
67135
 
65404
67136
  @Field({ nullable: true })
65405
- CredentialID: string | null;
67137
+ SearchScopeID?: string;
65406
67138
 
65407
67139
  @Field({ nullable: true })
65408
- DisplayName: string | null;
67140
+ Label?: string;
65409
67141
 
65410
67142
  @Field({ nullable: true })
65411
- Icon: string | null;
67143
+ Query?: string;
65412
67144
 
65413
67145
  @Field({ nullable: true })
65414
- Comments: string | null;
67146
+ ExpectedTopResultEntity: string | null;
67147
+
67148
+ @Field({ nullable: true })
67149
+ ExpectedTopResultRecordID: string | null;
67150
+
67151
+ @Field({ nullable: true })
67152
+ Notes: string | null;
65415
67153
 
65416
67154
  @Field(() => RestoreContextInput, { nullable: true })
65417
67155
  RestoreContext___?: RestoreContextInput;
@@ -65419,48 +67157,301 @@ export class CreateMJSearchProviderInput {
65419
67157
 
65420
67158
 
65421
67159
  //****************************************************************************
65422
- // INPUT TYPE for MJ: Search Providers
67160
+ // INPUT TYPE for MJ: Search Scope Test Queries
65423
67161
  //****************************************************************************
65424
67162
  @InputType()
65425
- export class UpdateMJSearchProviderInput {
67163
+ export class UpdateMJSearchScopeTestQueryInput {
65426
67164
  @Field()
65427
67165
  ID: string;
65428
67166
 
67167
+ @Field({ nullable: true })
67168
+ SearchScopeID?: string;
67169
+
67170
+ @Field({ nullable: true })
67171
+ Label?: string;
67172
+
67173
+ @Field({ nullable: true })
67174
+ Query?: string;
67175
+
67176
+ @Field({ nullable: true })
67177
+ ExpectedTopResultEntity?: string | null;
67178
+
67179
+ @Field({ nullable: true })
67180
+ ExpectedTopResultRecordID?: string | null;
67181
+
67182
+ @Field({ nullable: true })
67183
+ Notes?: string | null;
67184
+
67185
+ @Field(() => [KeyValuePairInput], { nullable: true })
67186
+ OldValues___?: KeyValuePairInput[];
67187
+
67188
+ @Field(() => RestoreContextInput, { nullable: true })
67189
+ RestoreContext___?: RestoreContextInput;
67190
+ }
67191
+
67192
+ //****************************************************************************
67193
+ // RESOLVER for MJ: Search Scope Test Queries
67194
+ //****************************************************************************
67195
+ @ObjectType()
67196
+ export class RunMJSearchScopeTestQueryViewResult {
67197
+ @Field(() => [MJSearchScopeTestQuery_])
67198
+ Results: MJSearchScopeTestQuery_[];
67199
+
67200
+ @Field(() => String, {nullable: true})
67201
+ UserViewRunID?: string;
67202
+
67203
+ @Field(() => Int, {nullable: true})
67204
+ RowCount: number;
67205
+
67206
+ @Field(() => Int, {nullable: true})
67207
+ TotalRowCount: number;
67208
+
67209
+ @Field(() => Int, {nullable: true})
67210
+ ExecutionTime: number;
67211
+
67212
+ @Field({nullable: true})
67213
+ ErrorMessage?: string;
67214
+
67215
+ @Field(() => Boolean, {nullable: false})
67216
+ Success: boolean;
67217
+ }
67218
+
67219
+ @Resolver(MJSearchScopeTestQuery_)
67220
+ export class MJSearchScopeTestQueryResolver extends ResolverBase {
67221
+ @Query(() => RunMJSearchScopeTestQueryViewResult)
67222
+ async RunMJSearchScopeTestQueryViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67223
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67224
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
67225
+ }
67226
+
67227
+ @Query(() => RunMJSearchScopeTestQueryViewResult)
67228
+ async RunMJSearchScopeTestQueryViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67229
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67230
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
67231
+ }
67232
+
67233
+ @Query(() => RunMJSearchScopeTestQueryViewResult)
67234
+ async RunMJSearchScopeTestQueryDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67235
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67236
+ input.EntityName = 'MJ: Search Scope Test Queries';
67237
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
67238
+ }
67239
+ @Query(() => MJSearchScopeTestQuery_, { nullable: true })
67240
+ async MJSearchScopeTestQuery(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchScopeTestQuery_ | null> {
67241
+ this.CheckUserReadPermissions('MJ: Search Scope Test Queries', userPayload);
67242
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67243
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeTestQueries')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Test Queries', userPayload, EntityPermissionType.Read, 'AND');
67244
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67245
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Scope Test Queries', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
67246
+ return result;
67247
+ }
67248
+
67249
+ @Mutation(() => MJSearchScopeTestQuery_)
67250
+ async CreateMJSearchScopeTestQuery(
67251
+ @Arg('input', () => CreateMJSearchScopeTestQueryInput) input: CreateMJSearchScopeTestQueryInput,
67252
+ @Ctx() { providers, userPayload }: AppContext,
67253
+ @PubSub() pubSub: PubSubEngine
67254
+ ) {
67255
+ const provider = GetReadWriteProvider(providers);
67256
+ return this.CreateRecord('MJ: Search Scope Test Queries', input, provider, userPayload, pubSub)
67257
+ }
67258
+
67259
+ @Mutation(() => MJSearchScopeTestQuery_)
67260
+ async UpdateMJSearchScopeTestQuery(
67261
+ @Arg('input', () => UpdateMJSearchScopeTestQueryInput) input: UpdateMJSearchScopeTestQueryInput,
67262
+ @Ctx() { providers, userPayload }: AppContext,
67263
+ @PubSub() pubSub: PubSubEngine
67264
+ ) {
67265
+ const provider = GetReadWriteProvider(providers);
67266
+ return this.UpdateRecord('MJ: Search Scope Test Queries', input, provider, userPayload, pubSub);
67267
+ }
67268
+
67269
+ @Mutation(() => MJSearchScopeTestQuery_)
67270
+ async DeleteMJSearchScopeTestQuery(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67271
+ const provider = GetReadWriteProvider(providers);
67272
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
67273
+ return this.DeleteRecord('MJ: Search Scope Test Queries', key, options, provider, userPayload, pubSub);
67274
+ }
67275
+
67276
+ }
67277
+
67278
+ //****************************************************************************
67279
+ // ENTITY CLASS for MJ: Search Scopes
67280
+ //****************************************************************************
67281
+ @ObjectType({ description: `A named, reusable boundary defining WHICH content participates in a search (providers, external indexes, entities, storage accounts). Combined with a runtime SearchContext, it enables multi-tenant, permission-aware, agent-friendly retrieval. See plans/search-scopes-rag-plus.md.` })
67282
+ export class MJSearchScope_ {
67283
+ @Field()
67284
+ @MaxLength(36)
67285
+ ID: string;
67286
+
67287
+ @Field({description: `Human-readable scope name (e.g., "HR Policies", "Engineering Docs"). Unique across the system.`})
67288
+ @MaxLength(200)
67289
+ Name: string;
67290
+
67291
+ @Field({nullable: true, description: `Detailed description of what this scope covers. Surfaced to agents in the available-scopes prompt injection so the LLM can choose a scope.`})
67292
+ Description?: string;
67293
+
67294
+ @Field({nullable: true, description: `Font Awesome (or equivalent) icon class used by the scope selector UI.`})
67295
+ @MaxLength(200)
67296
+ Icon?: string;
67297
+
67298
+ @Field(() => Boolean, {description: `If true, this scope includes everything (equivalent to no scope filtering). Exactly one Global scope should exist; it is seeded via metadata sync.`})
67299
+ IsGlobal: boolean;
67300
+
67301
+ @Field(() => Boolean, {description: `If true, this is the default scope for users/agents that do not specify one.`})
67302
+ IsDefault: boolean;
67303
+
67304
+ @Field({nullable: true, description: `NULL = organization-wide scope. Set = personal scope owned by this user (visible/usable only by that user unless explicitly shared).`})
67305
+ @MaxLength(36)
67306
+ OwnerUserID?: string;
67307
+
67308
+ @Field({description: `Lifecycle status. Only Active scopes are considered at query time.`})
67309
+ @MaxLength(20)
67310
+ Status: string;
67311
+
67312
+ @Field({nullable: true, description: `Optional time-window activation. Scope is inactive before StartAt. NULL = immediately active.`})
67313
+ StartAt?: Date;
67314
+
67315
+ @Field({nullable: true, description: `Optional time-window deactivation. Scope is inactive after EndAt. NULL = no expiry.`})
67316
+ EndAt?: Date;
67317
+
67318
+ @Field({nullable: true, description: `JSON configuration for advanced scope behavior. Recognized keys: rrfK (RRF k parameter), fusionWeights (per-provider weights), reRanker (optional re-ranker stage config: driverClass, inputTopN, outputTopN, config), permissionOverfetchFactor.`})
67319
+ ScopeConfig?: string;
67320
+
67321
+ @Field({nullable: true, description: `JSON defining available multi-tenant SearchContext dimensions, inheritance modes, and validation rules. Uses the SecondaryScopeConfig structure shared with the agent memory system (@memberjunction/ai-core-plus). NULL = scope is not multi-tenant aware.`})
67322
+ SearchContextConfig?: string;
67323
+
67324
+ @Field(() => Int, {nullable: true, description: `Optional cap on reranker spend (in cents) per search invocation against this scope. NULL means uncapped — existing behavior. When set, the SearchEngine's budget guard short-circuits any reranker call whose projected cost would push the run total past this value, and accumulates actual post-call cost via each reranker's CostReporter callback (BaseReRanker.CostReporter). Real-provider rerankers (Cohere, Voyage, OpenAI) report cost; NoopReRanker and BGEReRanker report zero (local / pass-through).`})
67325
+ RerankerBudgetCents?: number;
67326
+
67327
+ @Field()
67328
+ _mj__CreatedAt: Date;
67329
+
67330
+ @Field()
67331
+ _mj__UpdatedAt: Date;
67332
+
67333
+ @Field({nullable: true})
67334
+ @MaxLength(100)
67335
+ OwnerUser?: string;
67336
+
67337
+ @Field(() => [MJSearchScopeExternalIndex_])
67338
+ MJSearchScopeExternalIndexes_SearchScopeIDArray: MJSearchScopeExternalIndex_[]; // Link to MJSearchScopeExternalIndexes
67339
+
67340
+ @Field(() => [MJSearchScopeEntity_])
67341
+ MJSearchScopeEntities_SearchScopeIDArray: MJSearchScopeEntity_[]; // Link to MJSearchScopeEntities
67342
+
67343
+ @Field(() => [MJSearchScopePermission_])
67344
+ MJSearchScopePermissions_SearchScopeIDArray: MJSearchScopePermission_[]; // Link to MJSearchScopePermissions
67345
+
67346
+ @Field(() => [MJSearchScopeTestQuery_])
67347
+ MJSearchScopeTestQueries_SearchScopeIDArray: MJSearchScopeTestQuery_[]; // Link to MJSearchScopeTestQueries
67348
+
67349
+ @Field(() => [MJSearchScopeProvider_])
67350
+ MJSearchScopeProviders_SearchScopeIDArray: MJSearchScopeProvider_[]; // Link to MJSearchScopeProviders
67351
+
67352
+ @Field(() => [MJSearchScopeStorageAccount_])
67353
+ MJSearchScopeStorageAccounts_SearchScopeIDArray: MJSearchScopeStorageAccount_[]; // Link to MJSearchScopeStorageAccounts
67354
+
67355
+ @Field(() => [MJAIAgentSearchScope_])
67356
+ MJAIAgentSearchScopes_SearchScopeIDArray: MJAIAgentSearchScope_[]; // Link to MJAIAgentSearchScopes
67357
+
67358
+ @Field(() => [MJSearchExecutionLog_])
67359
+ MJSearchExecutionLogs_SearchScopeIDArray: MJSearchExecutionLog_[]; // Link to MJSearchExecutionLogs
67360
+
67361
+ }
67362
+
67363
+ //****************************************************************************
67364
+ // INPUT TYPE for MJ: Search Scopes
67365
+ //****************************************************************************
67366
+ @InputType()
67367
+ export class CreateMJSearchScopeInput {
67368
+ @Field({ nullable: true })
67369
+ ID?: string;
67370
+
65429
67371
  @Field({ nullable: true })
65430
67372
  Name?: string;
65431
67373
 
65432
67374
  @Field({ nullable: true })
65433
- Description?: string | null;
67375
+ Description: string | null;
65434
67376
 
65435
67377
  @Field({ nullable: true })
65436
- DriverClass?: string;
67378
+ Icon: string | null;
67379
+
67380
+ @Field(() => Boolean, { nullable: true })
67381
+ IsGlobal?: boolean;
67382
+
67383
+ @Field(() => Boolean, { nullable: true })
67384
+ IsDefault?: boolean;
67385
+
67386
+ @Field({ nullable: true })
67387
+ OwnerUserID: string | null;
65437
67388
 
65438
67389
  @Field({ nullable: true })
65439
67390
  Status?: string;
65440
67391
 
67392
+ @Field({ nullable: true })
67393
+ StartAt: Date | null;
67394
+
67395
+ @Field({ nullable: true })
67396
+ EndAt: Date | null;
67397
+
67398
+ @Field({ nullable: true })
67399
+ ScopeConfig: string | null;
67400
+
67401
+ @Field({ nullable: true })
67402
+ SearchContextConfig: string | null;
67403
+
65441
67404
  @Field(() => Int, { nullable: true })
65442
- Priority?: number;
67405
+ RerankerBudgetCents: number | null;
67406
+
67407
+ @Field(() => RestoreContextInput, { nullable: true })
67408
+ RestoreContext___?: RestoreContextInput;
67409
+ }
67410
+
67411
+
67412
+ //****************************************************************************
67413
+ // INPUT TYPE for MJ: Search Scopes
67414
+ //****************************************************************************
67415
+ @InputType()
67416
+ export class UpdateMJSearchScopeInput {
67417
+ @Field()
67418
+ ID: string;
67419
+
67420
+ @Field({ nullable: true })
67421
+ Name?: string;
67422
+
67423
+ @Field({ nullable: true })
67424
+ Description?: string | null;
67425
+
67426
+ @Field({ nullable: true })
67427
+ Icon?: string | null;
65443
67428
 
65444
67429
  @Field(() => Boolean, { nullable: true })
65445
- SupportsPreview?: boolean;
67430
+ IsGlobal?: boolean;
65446
67431
 
65447
- @Field(() => Int, { nullable: true })
65448
- MaxResultsOverride?: number | null;
67432
+ @Field(() => Boolean, { nullable: true })
67433
+ IsDefault?: boolean;
65449
67434
 
65450
67435
  @Field({ nullable: true })
65451
- ProviderConfig?: string | null;
67436
+ OwnerUserID?: string | null;
65452
67437
 
65453
67438
  @Field({ nullable: true })
65454
- CredentialID?: string | null;
67439
+ Status?: string;
65455
67440
 
65456
67441
  @Field({ nullable: true })
65457
- DisplayName?: string | null;
67442
+ StartAt?: Date | null;
65458
67443
 
65459
67444
  @Field({ nullable: true })
65460
- Icon?: string | null;
67445
+ EndAt?: Date | null;
65461
67446
 
65462
67447
  @Field({ nullable: true })
65463
- Comments?: string | null;
67448
+ ScopeConfig?: string | null;
67449
+
67450
+ @Field({ nullable: true })
67451
+ SearchContextConfig?: string | null;
67452
+
67453
+ @Field(() => Int, { nullable: true })
67454
+ RerankerBudgetCents?: number | null;
65464
67455
 
65465
67456
  @Field(() => [KeyValuePairInput], { nullable: true })
65466
67457
  OldValues___?: KeyValuePairInput[];
@@ -65470,12 +67461,12 @@ export class UpdateMJSearchProviderInput {
65470
67461
  }
65471
67462
 
65472
67463
  //****************************************************************************
65473
- // RESOLVER for MJ: Search Providers
67464
+ // RESOLVER for MJ: Search Scopes
65474
67465
  //****************************************************************************
65475
67466
  @ObjectType()
65476
- export class RunMJSearchProviderViewResult {
65477
- @Field(() => [MJSearchProvider_])
65478
- Results: MJSearchProvider_[];
67467
+ export class RunMJSearchScopeViewResult {
67468
+ @Field(() => [MJSearchScope_])
67469
+ Results: MJSearchScope_[];
65479
67470
 
65480
67471
  @Field(() => String, {nullable: true})
65481
67472
  UserViewRunID?: string;
@@ -65496,61 +67487,141 @@ export class RunMJSearchProviderViewResult {
65496
67487
  Success: boolean;
65497
67488
  }
65498
67489
 
65499
- @Resolver(MJSearchProvider_)
65500
- export class MJSearchProviderResolver extends ResolverBase {
65501
- @Query(() => RunMJSearchProviderViewResult)
65502
- async RunMJSearchProviderViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67490
+ @Resolver(MJSearchScope_)
67491
+ export class MJSearchScopeResolver extends ResolverBase {
67492
+ @Query(() => RunMJSearchScopeViewResult)
67493
+ async RunMJSearchScopeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
65503
67494
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
65504
67495
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
65505
67496
  }
65506
67497
 
65507
- @Query(() => RunMJSearchProviderViewResult)
65508
- async RunMJSearchProviderViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67498
+ @Query(() => RunMJSearchScopeViewResult)
67499
+ async RunMJSearchScopeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
65509
67500
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
65510
67501
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
65511
67502
  }
65512
67503
 
65513
- @Query(() => RunMJSearchProviderViewResult)
65514
- async RunMJSearchProviderDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67504
+ @Query(() => RunMJSearchScopeViewResult)
67505
+ async RunMJSearchScopeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
65515
67506
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
65516
- input.EntityName = 'MJ: Search Providers';
67507
+ input.EntityName = 'MJ: Search Scopes';
65517
67508
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
65518
67509
  }
65519
- @Query(() => MJSearchProvider_, { nullable: true })
65520
- async MJSearchProvider(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchProvider_ | null> {
65521
- this.CheckUserReadPermissions('MJ: Search Providers', userPayload);
67510
+ @Query(() => MJSearchScope_, { nullable: true })
67511
+ async MJSearchScope(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJSearchScope_ | null> {
67512
+ this.CheckUserReadPermissions('MJ: Search Scopes', userPayload);
65522
67513
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
65523
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchProviders')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Providers', userPayload, EntityPermissionType.Read, 'AND');
67514
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopes')} WHERE ${provider.QuoteIdentifier('ID')}='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scopes', userPayload, EntityPermissionType.Read, 'AND');
65524
67515
  const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
65525
- const result = await this.MapFieldNamesToCodeNames('MJ: Search Providers', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
67516
+ const result = await this.MapFieldNamesToCodeNames('MJ: Search Scopes', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
65526
67517
  return result;
65527
67518
  }
65528
67519
 
65529
- @Mutation(() => MJSearchProvider_)
65530
- async CreateMJSearchProvider(
65531
- @Arg('input', () => CreateMJSearchProviderInput) input: CreateMJSearchProviderInput,
67520
+ @FieldResolver(() => [MJSearchScopeExternalIndex_])
67521
+ async MJSearchScopeExternalIndexes_SearchScopeIDArray(@Root() mjsearchscope_: MJSearchScope_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67522
+ this.CheckUserReadPermissions('MJ: Search Scope External Indexes', userPayload);
67523
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67524
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeExternalIndexes')} WHERE ${provider.QuoteIdentifier('SearchScopeID')}='${mjsearchscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope External Indexes', userPayload, EntityPermissionType.Read, 'AND');
67525
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67526
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope External Indexes', rows, this.GetUserFromPayload(userPayload));
67527
+ return result;
67528
+ }
67529
+
67530
+ @FieldResolver(() => [MJSearchScopeEntity_])
67531
+ async MJSearchScopeEntities_SearchScopeIDArray(@Root() mjsearchscope_: MJSearchScope_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67532
+ this.CheckUserReadPermissions('MJ: Search Scope Entities', userPayload);
67533
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67534
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeEntities')} WHERE ${provider.QuoteIdentifier('SearchScopeID')}='${mjsearchscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Entities', userPayload, EntityPermissionType.Read, 'AND');
67535
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67536
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Entities', rows, this.GetUserFromPayload(userPayload));
67537
+ return result;
67538
+ }
67539
+
67540
+ @FieldResolver(() => [MJSearchScopePermission_])
67541
+ async MJSearchScopePermissions_SearchScopeIDArray(@Root() mjsearchscope_: MJSearchScope_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67542
+ this.CheckUserReadPermissions('MJ: Search Scope Permissions', userPayload);
67543
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67544
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopePermissions')} WHERE ${provider.QuoteIdentifier('SearchScopeID')}='${mjsearchscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Permissions', userPayload, EntityPermissionType.Read, 'AND');
67545
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67546
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Permissions', rows, this.GetUserFromPayload(userPayload));
67547
+ return result;
67548
+ }
67549
+
67550
+ @FieldResolver(() => [MJSearchScopeTestQuery_])
67551
+ async MJSearchScopeTestQueries_SearchScopeIDArray(@Root() mjsearchscope_: MJSearchScope_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67552
+ this.CheckUserReadPermissions('MJ: Search Scope Test Queries', userPayload);
67553
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67554
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeTestQueries')} WHERE ${provider.QuoteIdentifier('SearchScopeID')}='${mjsearchscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Test Queries', userPayload, EntityPermissionType.Read, 'AND');
67555
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67556
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Test Queries', rows, this.GetUserFromPayload(userPayload));
67557
+ return result;
67558
+ }
67559
+
67560
+ @FieldResolver(() => [MJSearchScopeProvider_])
67561
+ async MJSearchScopeProviders_SearchScopeIDArray(@Root() mjsearchscope_: MJSearchScope_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67562
+ this.CheckUserReadPermissions('MJ: Search Scope Providers', userPayload);
67563
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67564
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeProviders')} WHERE ${provider.QuoteIdentifier('SearchScopeID')}='${mjsearchscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Providers', userPayload, EntityPermissionType.Read, 'AND');
67565
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67566
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Providers', rows, this.GetUserFromPayload(userPayload));
67567
+ return result;
67568
+ }
67569
+
67570
+ @FieldResolver(() => [MJSearchScopeStorageAccount_])
67571
+ async MJSearchScopeStorageAccounts_SearchScopeIDArray(@Root() mjsearchscope_: MJSearchScope_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67572
+ this.CheckUserReadPermissions('MJ: Search Scope Storage Accounts', userPayload);
67573
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67574
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeStorageAccounts')} WHERE ${provider.QuoteIdentifier('SearchScopeID')}='${mjsearchscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Storage Accounts', userPayload, EntityPermissionType.Read, 'AND');
67575
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67576
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Storage Accounts', rows, this.GetUserFromPayload(userPayload));
67577
+ return result;
67578
+ }
67579
+
67580
+ @FieldResolver(() => [MJAIAgentSearchScope_])
67581
+ async MJAIAgentSearchScopes_SearchScopeIDArray(@Root() mjsearchscope_: MJSearchScope_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67582
+ this.CheckUserReadPermissions('MJ: AI Agent Search Scopes', userPayload);
67583
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67584
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSearchScopes')} WHERE ${provider.QuoteIdentifier('SearchScopeID')}='${mjsearchscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Search Scopes', userPayload, EntityPermissionType.Read, 'AND');
67585
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67586
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Search Scopes', rows, this.GetUserFromPayload(userPayload));
67587
+ return result;
67588
+ }
67589
+
67590
+ @FieldResolver(() => [MJSearchExecutionLog_])
67591
+ async MJSearchExecutionLogs_SearchScopeIDArray(@Root() mjsearchscope_: MJSearchScope_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67592
+ this.CheckUserReadPermissions('MJ: Search Execution Logs', userPayload);
67593
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67594
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchExecutionLogs')} WHERE ${provider.QuoteIdentifier('SearchScopeID')}='${mjsearchscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Execution Logs', userPayload, EntityPermissionType.Read, 'AND');
67595
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67596
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Execution Logs', rows, this.GetUserFromPayload(userPayload));
67597
+ return result;
67598
+ }
67599
+
67600
+ @Mutation(() => MJSearchScope_)
67601
+ async CreateMJSearchScope(
67602
+ @Arg('input', () => CreateMJSearchScopeInput) input: CreateMJSearchScopeInput,
65532
67603
  @Ctx() { providers, userPayload }: AppContext,
65533
67604
  @PubSub() pubSub: PubSubEngine
65534
67605
  ) {
65535
67606
  const provider = GetReadWriteProvider(providers);
65536
- return this.CreateRecord('MJ: Search Providers', input, provider, userPayload, pubSub)
67607
+ return this.CreateRecord('MJ: Search Scopes', input, provider, userPayload, pubSub)
65537
67608
  }
65538
67609
 
65539
- @Mutation(() => MJSearchProvider_)
65540
- async UpdateMJSearchProvider(
65541
- @Arg('input', () => UpdateMJSearchProviderInput) input: UpdateMJSearchProviderInput,
67610
+ @Mutation(() => MJSearchScope_)
67611
+ async UpdateMJSearchScope(
67612
+ @Arg('input', () => UpdateMJSearchScopeInput) input: UpdateMJSearchScopeInput,
65542
67613
  @Ctx() { providers, userPayload }: AppContext,
65543
67614
  @PubSub() pubSub: PubSubEngine
65544
67615
  ) {
65545
67616
  const provider = GetReadWriteProvider(providers);
65546
- return this.UpdateRecord('MJ: Search Providers', input, provider, userPayload, pubSub);
67617
+ return this.UpdateRecord('MJ: Search Scopes', input, provider, userPayload, pubSub);
65547
67618
  }
65548
67619
 
65549
- @Mutation(() => MJSearchProvider_)
65550
- async DeleteMJSearchProvider(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
67620
+ @Mutation(() => MJSearchScope_)
67621
+ async DeleteMJSearchScope(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
65551
67622
  const provider = GetReadWriteProvider(providers);
65552
67623
  const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
65553
- return this.DeleteRecord('MJ: Search Providers', key, options, provider, userPayload, pubSub);
67624
+ return this.DeleteRecord('MJ: Search Scopes', key, options, provider, userPayload, pubSub);
65554
67625
  }
65555
67626
 
65556
67627
  }
@@ -67464,12 +69535,12 @@ export class MJTag_ {
67464
69535
  @Field(() => [MJTaggedItem_])
67465
69536
  MJTaggedItems_TagIDArray: MJTaggedItem_[]; // Link to MJTaggedItems
67466
69537
 
67467
- @Field(() => [MJTagCoOccurrence_])
67468
- MJTagCoOccurrences_TagBIDArray: MJTagCoOccurrence_[]; // Link to MJTagCoOccurrences
67469
-
67470
69538
  @Field(() => [MJContentItemTag_])
67471
69539
  MJContentItemTags_TagIDArray: MJContentItemTag_[]; // Link to MJContentItemTags
67472
69540
 
69541
+ @Field(() => [MJTagCoOccurrence_])
69542
+ MJTagCoOccurrences_TagBIDArray: MJTagCoOccurrence_[]; // Link to MJTagCoOccurrences
69543
+
67473
69544
  @Field(() => [MJTagSynonym_])
67474
69545
  MJTagSynonyms_TagIDArray: MJTagSynonym_[]; // Link to MJTagSynonyms
67475
69546
 
@@ -67694,16 +69765,6 @@ export class MJTagResolver extends ResolverBase {
67694
69765
  return result;
67695
69766
  }
67696
69767
 
67697
- @FieldResolver(() => [MJTagCoOccurrence_])
67698
- async MJTagCoOccurrences_TagBIDArray(@Root() mjtag_: MJTag_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67699
- this.CheckUserReadPermissions('MJ: Tag Co Occurrences', userPayload);
67700
- const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
67701
- const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwTagCoOccurrences')} WHERE ${provider.QuoteIdentifier('TagBID')}='${mjtag_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tag Co Occurrences', userPayload, EntityPermissionType.Read, 'AND');
67702
- const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
67703
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Tag Co Occurrences', rows, this.GetUserFromPayload(userPayload));
67704
- return result;
67705
- }
67706
-
67707
69768
  @FieldResolver(() => [MJContentItemTag_])
67708
69769
  async MJContentItemTags_TagIDArray(@Root() mjtag_: MJTag_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67709
69770
  this.CheckUserReadPermissions('MJ: Content Item Tags', userPayload);
@@ -67714,6 +69775,16 @@ export class MJTagResolver extends ResolverBase {
67714
69775
  return result;
67715
69776
  }
67716
69777
 
69778
+ @FieldResolver(() => [MJTagCoOccurrence_])
69779
+ async MJTagCoOccurrences_TagBIDArray(@Root() mjtag_: MJTag_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
69780
+ this.CheckUserReadPermissions('MJ: Tag Co Occurrences', userPayload);
69781
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
69782
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwTagCoOccurrences')} WHERE ${provider.QuoteIdentifier('TagBID')}='${mjtag_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Tag Co Occurrences', userPayload, EntityPermissionType.Read, 'AND');
69783
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
69784
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Tag Co Occurrences', rows, this.GetUserFromPayload(userPayload));
69785
+ return result;
69786
+ }
69787
+
67717
69788
  @FieldResolver(() => [MJTagSynonym_])
67718
69789
  async MJTagSynonyms_TagIDArray(@Root() mjtag_: MJTag_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
67719
69790
  this.CheckUserReadPermissions('MJ: Tag Synonyms', userPayload);
@@ -69414,6 +71485,12 @@ export class MJTemplate_ {
69414
71485
  @Field(() => [MJUserNotificationType_])
69415
71486
  MJUserNotificationTypes_SMSTemplateIDArray: MJUserNotificationType_[]; // Link to MJUserNotificationTypes
69416
71487
 
71488
+ @Field(() => [MJSearchScopeProvider_])
71489
+ MJSearchScopeProviders_QueryTransformTemplateIDArray: MJSearchScopeProvider_[]; // Link to MJSearchScopeProviders
71490
+
71491
+ @Field(() => [MJAIAgentSearchScope_])
71492
+ MJAIAgentSearchScopes_QueryTemplateIDArray: MJAIAgentSearchScope_[]; // Link to MJAIAgentSearchScopes
71493
+
69417
71494
  @Field(() => [MJEntityDocument_])
69418
71495
  MJEntityDocuments_TemplateIDArray: MJEntityDocument_[]; // Link to MJEntityDocuments
69419
71496
 
@@ -69602,6 +71679,26 @@ export class MJTemplateResolver extends ResolverBase {
69602
71679
  return result;
69603
71680
  }
69604
71681
 
71682
+ @FieldResolver(() => [MJSearchScopeProvider_])
71683
+ async MJSearchScopeProviders_QueryTransformTemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
71684
+ this.CheckUserReadPermissions('MJ: Search Scope Providers', userPayload);
71685
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
71686
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeProviders')} WHERE ${provider.QuoteIdentifier('QueryTransformTemplateID')}='${mjtemplate_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Providers', userPayload, EntityPermissionType.Read, 'AND');
71687
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
71688
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Providers', rows, this.GetUserFromPayload(userPayload));
71689
+ return result;
71690
+ }
71691
+
71692
+ @FieldResolver(() => [MJAIAgentSearchScope_])
71693
+ async MJAIAgentSearchScopes_QueryTemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
71694
+ this.CheckUserReadPermissions('MJ: AI Agent Search Scopes', userPayload);
71695
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
71696
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSearchScopes')} WHERE ${provider.QuoteIdentifier('QueryTemplateID')}='${mjtemplate_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Search Scopes', userPayload, EntityPermissionType.Read, 'AND');
71697
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
71698
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Search Scopes', rows, this.GetUserFromPayload(userPayload));
71699
+ return result;
71700
+ }
71701
+
69605
71702
  @FieldResolver(() => [MJEntityDocument_])
69606
71703
  async MJEntityDocuments_TemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
69607
71704
  this.CheckUserReadPermissions('MJ: Entity Documents', userPayload);
@@ -75325,6 +77422,9 @@ export class MJUser_ {
75325
77422
  @Field(() => [MJTagSuggestion_])
75326
77423
  MJTagSuggestions_ReviewedByUserIDArray: MJTagSuggestion_[]; // Link to MJTagSuggestions
75327
77424
 
77425
+ @Field(() => [MJSearchScope_])
77426
+ MJSearchScopes_OwnerUserIDArray: MJSearchScope_[]; // Link to MJSearchScopes
77427
+
75328
77428
  @Field(() => [MJResourcePermission_])
75329
77429
  MJResourcePermissions_UserIDArray: MJResourcePermission_[]; // Link to MJResourcePermissions
75330
77430
 
@@ -75391,6 +77491,12 @@ export class MJUser_ {
75391
77491
  @Field(() => [MJRecordMergeLog_])
75392
77492
  MJRecordMergeLogs_InitiatedByUserIDArray: MJRecordMergeLog_[]; // Link to MJRecordMergeLogs
75393
77493
 
77494
+ @Field(() => [MJSearchScopePermission_])
77495
+ MJSearchScopePermissions_UserIDArray: MJSearchScopePermission_[]; // Link to MJSearchScopePermissions
77496
+
77497
+ @Field(() => [MJSearchExecutionLog_])
77498
+ MJSearchExecutionLogs_UserIDArray: MJSearchExecutionLog_[]; // Link to MJSearchExecutionLogs
77499
+
75394
77500
  @Field(() => [MJTask_])
75395
77501
  MJTasks_UserIDArray: MJTask_[]; // Link to MJTasks
75396
77502
 
@@ -76255,6 +78361,16 @@ export class MJUserResolverBase extends ResolverBase {
76255
78361
  return result;
76256
78362
  }
76257
78363
 
78364
+ @FieldResolver(() => [MJSearchScope_])
78365
+ async MJSearchScopes_OwnerUserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
78366
+ this.CheckUserReadPermissions('MJ: Search Scopes', userPayload);
78367
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
78368
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopes')} WHERE ${provider.QuoteIdentifier('OwnerUserID')}='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scopes', userPayload, EntityPermissionType.Read, 'AND');
78369
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
78370
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scopes', rows, this.GetUserFromPayload(userPayload));
78371
+ return result;
78372
+ }
78373
+
76258
78374
  @FieldResolver(() => [MJResourcePermission_])
76259
78375
  async MJResourcePermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
76260
78376
  this.CheckUserReadPermissions('MJ: Resource Permissions', userPayload);
@@ -76475,6 +78591,26 @@ export class MJUserResolverBase extends ResolverBase {
76475
78591
  return result;
76476
78592
  }
76477
78593
 
78594
+ @FieldResolver(() => [MJSearchScopePermission_])
78595
+ async MJSearchScopePermissions_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
78596
+ this.CheckUserReadPermissions('MJ: Search Scope Permissions', userPayload);
78597
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
78598
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopePermissions')} WHERE ${provider.QuoteIdentifier('UserID')}='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope Permissions', userPayload, EntityPermissionType.Read, 'AND');
78599
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
78600
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope Permissions', rows, this.GetUserFromPayload(userPayload));
78601
+ return result;
78602
+ }
78603
+
78604
+ @FieldResolver(() => [MJSearchExecutionLog_])
78605
+ async MJSearchExecutionLogs_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
78606
+ this.CheckUserReadPermissions('MJ: Search Execution Logs', userPayload);
78607
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
78608
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchExecutionLogs')} WHERE ${provider.QuoteIdentifier('UserID')}='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Execution Logs', userPayload, EntityPermissionType.Read, 'AND');
78609
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
78610
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Execution Logs', rows, this.GetUserFromPayload(userPayload));
78611
+ return result;
78612
+ }
78613
+
76478
78614
  @FieldResolver(() => [MJTask_])
76479
78615
  async MJTasks_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
76480
78616
  this.CheckUserReadPermissions('MJ: Tasks', userPayload);
@@ -76808,6 +78944,9 @@ export class MJVectorIndex_ {
76808
78944
  @Field(() => [MJEntityRecordDocument_])
76809
78945
  MJEntityRecordDocuments_VectorIndexIDArray: MJEntityRecordDocument_[]; // Link to MJEntityRecordDocuments
76810
78946
 
78947
+ @Field(() => [MJSearchScopeExternalIndex_])
78948
+ MJSearchScopeExternalIndexes_VectorIndexIDArray: MJSearchScopeExternalIndex_[]; // Link to MJSearchScopeExternalIndexes
78949
+
76811
78950
  @Field(() => [MJEntityDocument_])
76812
78951
  MJEntityDocuments_VectorIndexIDArray: MJEntityDocument_[]; // Link to MJEntityDocuments
76813
78952
 
@@ -76962,6 +79101,16 @@ export class MJVectorIndexResolver extends ResolverBase {
76962
79101
  return result;
76963
79102
  }
76964
79103
 
79104
+ @FieldResolver(() => [MJSearchScopeExternalIndex_])
79105
+ async MJSearchScopeExternalIndexes_VectorIndexIDArray(@Root() mjvectorindex_: MJVectorIndex_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
79106
+ this.CheckUserReadPermissions('MJ: Search Scope External Indexes', userPayload);
79107
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
79108
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwSearchScopeExternalIndexes')} WHERE ${provider.QuoteIdentifier('VectorIndexID')}='${mjvectorindex_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Search Scope External Indexes', userPayload, EntityPermissionType.Read, 'AND');
79109
+ const rows = await provider.ExecuteSQL(sSQL, undefined, undefined, this.GetUserFromPayload(userPayload));
79110
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Search Scope External Indexes', rows, this.GetUserFromPayload(userPayload));
79111
+ return result;
79112
+ }
79113
+
76965
79114
  @FieldResolver(() => [MJEntityDocument_])
76966
79115
  async MJEntityDocuments_VectorIndexIDArray(@Root() mjvectorindex_: MJVectorIndex_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
76967
79116
  this.CheckUserReadPermissions('MJ: Entity Documents', userPayload);