Member Junction
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    AfterCreate AfterDelete AfterUpdate AllMJEntities applyRestoreContext ArrayFilterEncryptedFieldsForAPI ArrayMapFieldNamesToCodeNames BeforeCreate BeforeDelete BeforeUpdate CheckAPIKeyScopeAuthorization CheckUserReadPermissions createAuditLogRecord CreateMJEntity CreateRecord createRecordAccessAuditLogRecord DeleteMJEntity DeleteRecord EmitCloudEvent FilterEncryptedFieldsForAPI findBy getRowLevelSecurityWhereClause GetUserFromEmail GetUserFromPayload ListenForEntityMessages LoadExternalRecordByKey MapFieldNamesToCodeNames MJAccessControlRules_EntityIDArray MJAIAgentExamples_PrimaryScopeEntityIDArray MJAIAgentNotes_PrimaryScopeEntityIDArray MJAIAgentRuns_PrimaryScopeEntityIDArray MJAIAgentSessions_LinkedEntityIDArray MJApplicationEntities_EntityIDArray MJArchiveConfigurationEntities_EntityIDArray MJArchiveRunDetails_EntityIDArray MJAuditLogs_EntityIDArray MJClusterAnalysis_EntityIDArray MJCompanyIntegrationEntityMaps_EntityIDArray MJCompanyIntegrationRecordMaps_EntityIDArray MJCompanyIntegrationRunDetails_EntityIDArray MJContentSources_EntityIDArray MJConversations_LinkedEntityIDArray MJDataContextItems_EntityIDArray MJDatasetItems_EntityIDArray MJDuplicateRuns_EntityIDArray MJEntities_ParentIDArray MJEntity MJEntityActions_EntityIDArray MJEntityAIActions_EntityIDArray MJEntityAIActions_OutputEntityIDArray MJEntityCommunicationMessageTypes_EntityIDArray MJEntityDocuments_EntityIDArray MJEntityFields_EntityIDArray MJEntityFields_RelatedEntityIDArray MJEntityFormOverrides_EntityIDArray MJEntityOrganicKeyRelatedEntities_RelatedEntityIDArray MJEntityOrganicKeys_EntityIDArray MJEntityPermissions_EntityIDArray MJEntityRecordDocuments_EntityIDArray MJEntityRelationships_EntityIDArray MJEntityRelationships_RelatedEntityIDArray MJEntitySettings_EntityIDArray MJFileEntityRecordLinks_EntityIDArray MJGeneratedCodes_LinkedEntityIDArray MJIntegrationURLFormats_EntityIDArray MJLists_EntityIDArray MJMLModelScoringBindings_TargetEntityIDArray MJMLTrainingPipelines_TargetEntityIDArray MJProcessRunDetails_EntityIDArray MJProcessRuns_EntityIDArray MJQueryEntities_EntityIDArray MJQueryFields_SourceEntityIDArray MJRecommendationItems_DestinationEntityIDArray MJRecommendations_SourceEntityIDArray MJRecordChanges_EntityIDArray MJRecordGeoCodes_EntityIDArray MJRecordLinks_SourceEntityIDArray MJRecordLinks_TargetEntityIDArray MJRecordMergeLogs_EntityIDArray MJRecordProcesses_EntityIDArray MJRecordProcessWatermarks_EntityIDArray MJResourceTypes_CategoryEntityIDArray MJResourceTypes_EntityIDArray MJScopedPromptConfigs_PrimaryScopeEntityIDArray MJScopedPromptParts_PrimaryScopeEntityIDArray MJSearchScopeEntities_EntityIDArray MJSignatureRequests_EntityIDArray MJTaggedItems_EntityIDArray MJTagScopes_ScopeEntityIDArray MJTemplateParams_EntityIDArray MJTestRuns_TargetLogEntityIDArray MJUserApplicationEntities_EntityIDArray MJUserFavorites_EntityIDArray MJUserRecordLogs_EntityIDArray MJUsers_LinkedEntityIDArray MJUserViewCategories_EntityIDArray MJUserViews_EntityIDArray MJVersionLabelItems_EntityIDArray MJVersionLabels_EntityIDArray packageSPParam PublishCacheInvalidation ReverseMapInputFieldNames RunDynamicViewGeneric RunMJEntityDynamicView RunMJEntityViewByID RunMJEntityViewByName RunViewByIDGeneric RunViewByNameGeneric RunViewGenericInternal RunViewsGeneric RunViewsGenericInternal safeFirstArrayElement TestAndSetClientOldValuesToDBValues UpdateMJEntity UpdateRecord

    Constructors

    Accessors

    Methods

    • Applies an inbound RestoreContext___ blob to a server-side BaseEntity. Mirrors the OldValues___ pattern — the client-side BaseEntity's _restoreContext doesn't traverse the network, so the server must reconstruct it from the mutation input before calling Save().

      Returns true when context was applied; false when no context was on the input.

      Parameters

      • entityObject: BaseEntity
      • input: { RestoreContext___?: { Reason?: string; SourceChangeID?: string } }

      Returns boolean

    • Checks API key scope authorization. Only performs check if request was authenticated via API key (apiKeyHash present in userPayload). For OAuth/JWT auth, this is a no-op.

      Parameters

      • scopePath: string

        The scope path (e.g., 'entity:read', 'agent:execute')

      • resource: string

        The resource name (e.g., entity name, agent name)

      • userPayload: UserPayload

        The user payload from context

      Returns Promise<void>

      AuthorizationError if API key lacks required scope

    • Filters encrypted field values before sending to the API client.

      For each encrypted field in the entity:

      • If AllowDecryptInAPI is true: value passes through unchanged (already decrypted by data provider)
      • If AllowDecryptInAPI is false and SendEncryptedValue is true: re-encrypt and send ciphertext
      • If AllowDecryptInAPI is false and SendEncryptedValue is false: replace with sentinel value

      Parameters

      • entityName: string

        Name of the entity

      • dataObject: Record<string, unknown>

        The data object containing field values

      • contextUser: UserInfo

        User context for encryption operations

      • Optionalprovider: IMetadataProvider

      Returns Promise<Record<string, unknown>>

      The filtered data object

    • Loads a single external-data-source-backed entity record by primary key and returns it in GraphQL field-name (CodeName) shape, or null if not found.

      External entities (Entity.ExternalDataSourceID set) have no MJ base view or sproc — their data is proxied live from a remote system — so the generated single-record resolver cannot run SELECT * FROM <baseView>. Instead it loads through a BaseEntity object, whose InnerLoad the data provider dispatches to the external read router's LoadExternalRecord (a composite-key aware, quoted, parameter-bound single-record lookup), applying the same RLS gate and field post-processing (decryption / datetime normalization) as the MJ-DB path. The caller is responsible for the CheckUserReadPermissions gate beforehand.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

    • Maps field names to their GraphQL-safe CodeNames and handles encryption for API responses.

      For encrypted fields coming from raw SQL queries (not entity objects):

      • AllowDecryptInAPI=true: Decrypt the value before sending to client
      • AllowDecryptInAPI=false + SendEncryptedValue=true: Keep encrypted ciphertext
      • AllowDecryptInAPI=false + SendEncryptedValue=false: Replace with sentinel

      Parameters

      • entityName: string

        The entity name

      • dataObject: any

        The data object with field values

      • OptionalcontextUser: UserInfo

        Optional user context for decryption (required for encrypted fields)

      • Optionalprovider: IMetadataProvider

      Returns Promise<any>

      The processed data object

    • Reverse-maps GraphQL-safe field names back to entity CodeNames in a mutation input object. For example, _mj__integration_SyncStatus is mapped back to __mj_integration_SyncStatus. Also reverse-maps keys inside the OldValues___ array if present. This is the inverse of MapFieldNamesToCodeNames and must be called before passing GraphQL input to entity SetMany() or field lookups.

      Parameters

      • input: Record<string, unknown>

      Returns Record<string, unknown>

    • Optimized RunViewGenericInternal implementation with:

      • Field filtering at source (Fix #7)
      • Improved error handling (Fix #9)

      Parameters

      • provider: DatabaseProviderBase
      • viewInfo: MJUserViewEntityExtended
      • extraFilter: string
      • orderBy: string
      • userSearchString: string
      • excludeUserViewRunID: string
      • overrideExcludeFilter: string
      • saveViewResults: boolean
      • fields: string[]
      • ignoreMaxRows: boolean
      • excludeDataFromAllPriorViewRuns: boolean
      • forceAuditLog: boolean
      • auditLogDescription: string
      • resultType: string
      • userPayload: UserPayload
      • maxRows: number
      • startRow: number
      • Optionalaggregates: AggregateExpression[]
      • OptionalafterKey: CompositeKey
      • OptionalbypassCache: boolean

      Returns Promise<RunViewResult<any>>

    • This routine compares the OldValues property in the input object to the values in the DB that we just loaded. If there are differences, we need to check to see if the client is trying to update any of those fields (e.g. overlap). If there is overlap, we throw an error. If there is no overlap, we can proceed with the update even if the DB Values and the ClientOldValues are not 100% the same, so long as there is no overlap in the specific FIELDS that are different.

      ASSUMES: input object has an OldValues___ property that is an array of Key/Value pairs that represent the old values of the record that the client is trying to update.

      Parameters

      Returns Promise<void>