@memberjunction/server 6.2.0-edge.0 → 6.2.0-edge.1
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/agentSessions/ReturningVisitorRecap.d.ts +2 -0
- package/dist/agentSessions/ReturningVisitorRecap.d.ts.map +1 -1
- package/dist/agentSessions/ReturningVisitorRecap.js +5 -1
- package/dist/agentSessions/ReturningVisitorRecap.js.map +1 -1
- package/dist/agentSessions/SessionManager.js +2 -2
- package/dist/agentSessions/remoteBrowserGoalEngine.d.ts +8 -0
- package/dist/agentSessions/remoteBrowserGoalEngine.d.ts.map +1 -1
- package/dist/agentSessions/remoteBrowserGoalEngine.js +21 -5
- package/dist/agentSessions/remoteBrowserGoalEngine.js.map +1 -1
- package/dist/auth/AuthProviderCatalogRouter.d.ts +2 -0
- package/dist/auth/AuthProviderCatalogRouter.d.ts.map +1 -1
- package/dist/auth/AuthProviderCatalogRouter.js +5 -1
- package/dist/auth/AuthProviderCatalogRouter.js.map +1 -1
- package/dist/auth/index.d.ts +20 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +20 -10
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/initializeProviders.d.ts +8 -0
- package/dist/auth/initializeProviders.d.ts.map +1 -1
- package/dist/auth/initializeProviders.js +21 -5
- package/dist/auth/initializeProviders.js.map +1 -1
- package/dist/auth/magicLink/MagicLinkRouter.d.ts +9 -0
- package/dist/auth/magicLink/MagicLinkRouter.d.ts.map +1 -1
- package/dist/auth/magicLink/MagicLinkRouter.js +22 -10
- package/dist/auth/magicLink/MagicLinkRouter.js.map +1 -1
- package/dist/auth/magicLink/MagicLinkService.d.ts +17 -15
- package/dist/auth/magicLink/MagicLinkService.d.ts.map +1 -1
- package/dist/auth/magicLink/MagicLinkService.js +65 -51
- package/dist/auth/magicLink/MagicLinkService.js.map +1 -1
- package/dist/auth/magicLink/index.d.ts +2 -2
- package/dist/auth/magicLink/index.d.ts.map +1 -1
- package/dist/auth/magicLink/index.js +2 -2
- package/dist/auth/magicLink/index.js.map +1 -1
- package/dist/auth/magicLink/magicLinkCore.d.ts +54 -33
- package/dist/auth/magicLink/magicLinkCore.d.ts.map +1 -1
- package/dist/auth/magicLink/magicLinkCore.js +61 -61
- package/dist/auth/magicLink/magicLinkCore.js.map +1 -1
- package/dist/auth/magicLink/redeemLanding.d.ts +4 -0
- package/dist/auth/magicLink/redeemLanding.d.ts.map +1 -1
- package/dist/auth/magicLink/redeemLanding.js +12 -4
- package/dist/auth/magicLink/redeemLanding.js.map +1 -1
- package/dist/auth/magicLink/types.d.ts +4 -4
- package/dist/auth/principals.d.ts +2 -0
- package/dist/auth/principals.d.ts.map +1 -1
- package/dist/auth/principals.js +6 -2
- package/dist/auth/principals.js.map +1 -1
- package/dist/cache.d.ts +2 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +3 -1
- package/dist/cache.js.map +1 -1
- package/dist/config.d.ts +346 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +34 -4
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +20 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +27 -19
- package/dist/context.js.map +1 -1
- package/dist/directives/Public.d.ts +2 -0
- package/dist/directives/Public.d.ts.map +1 -1
- package/dist/directives/Public.js +3 -1
- package/dist/directives/Public.js.map +1 -1
- package/dist/directives/RequireSystemUser.d.ts +2 -0
- package/dist/directives/RequireSystemUser.d.ts.map +1 -1
- package/dist/directives/RequireSystemUser.js +3 -1
- package/dist/directives/RequireSystemUser.js.map +1 -1
- package/dist/generated/graphql-schemas/__mj.d.ts +11 -0
- package/dist/generated/graphql-schemas/__mj.d.ts.map +1 -1
- package/dist/generated/graphql-schemas/__mj.js +48 -0
- package/dist/generated/graphql-schemas/__mj.js.map +1 -1
- package/dist/generic/CacheInvalidationResolver.d.ts +94 -4
- package/dist/generic/CacheInvalidationResolver.d.ts.map +1 -1
- package/dist/generic/CacheInvalidationResolver.js +122 -3
- package/dist/generic/CacheInvalidationResolver.js.map +1 -1
- package/dist/generic/DeleteOptionsInput.d.ts +8 -1
- package/dist/generic/DeleteOptionsInput.d.ts.map +1 -1
- package/dist/generic/DeleteOptionsInput.js +1 -1
- package/dist/generic/DeleteOptionsInput.js.map +1 -1
- package/dist/generic/FireAndForgetHeartbeat.d.ts +3 -1
- package/dist/generic/FireAndForgetHeartbeat.d.ts.map +1 -1
- package/dist/generic/FireAndForgetHeartbeat.js +8 -4
- package/dist/generic/FireAndForgetHeartbeat.js.map +1 -1
- package/dist/generic/PushStatusResolver.d.ts +10 -1
- package/dist/generic/PushStatusResolver.d.ts.map +1 -1
- package/dist/generic/PushStatusResolver.js +11 -3
- package/dist/generic/PushStatusResolver.js.map +1 -1
- package/dist/generic/ResolverBase.d.ts +5 -1
- package/dist/generic/ResolverBase.d.ts.map +1 -1
- package/dist/generic/ResolverBase.js +15 -8
- package/dist/generic/ResolverBase.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -9
- package/dist/index.js.map +1 -1
- package/dist/integration/CustomColumnPromoter.d.ts +2 -0
- package/dist/integration/CustomColumnPromoter.d.ts.map +1 -1
- package/dist/integration/CustomColumnPromoter.js +5 -1
- package/dist/integration/CustomColumnPromoter.js.map +1 -1
- package/dist/integration/EntityMapLifecycle.d.ts +4 -0
- package/dist/integration/EntityMapLifecycle.d.ts.map +1 -1
- package/dist/integration/EntityMapLifecycle.js +10 -2
- package/dist/integration/EntityMapLifecycle.js.map +1 -1
- package/dist/logging/NoLog.d.ts +4 -0
- package/dist/logging/NoLog.d.ts.map +1 -1
- package/dist/logging/NoLog.js +10 -2
- package/dist/logging/NoLog.js.map +1 -1
- package/dist/logging/StartupLogger.d.ts +2 -0
- package/dist/logging/StartupLogger.d.ts.map +1 -1
- package/dist/logging/StartupLogger.js +5 -1
- package/dist/logging/StartupLogger.js.map +1 -1
- package/dist/logging/bootAudit.d.ts +11 -7
- package/dist/logging/bootAudit.d.ts.map +1 -1
- package/dist/logging/bootAudit.js +15 -7
- package/dist/logging/bootAudit.js.map +1 -1
- package/dist/logging/boundaryLogPayload.d.ts +4 -0
- package/dist/logging/boundaryLogPayload.d.ts.map +1 -1
- package/dist/logging/boundaryLogPayload.js +5 -1
- package/dist/logging/boundaryLogPayload.js.map +1 -1
- package/dist/logging/secretRedactor.d.ts +2 -0
- package/dist/logging/secretRedactor.d.ts.map +1 -1
- package/dist/logging/secretRedactor.js +8 -4
- package/dist/logging/secretRedactor.js.map +1 -1
- package/dist/logging/shortenForLog.d.ts +2 -0
- package/dist/logging/shortenForLog.d.ts.map +1 -1
- package/dist/logging/shortenForLog.js +7 -3
- package/dist/logging/shortenForLog.js.map +1 -1
- package/dist/logging/variablesLoggingMiddleware.d.ts +2 -0
- package/dist/logging/variablesLoggingMiddleware.d.ts.map +1 -1
- package/dist/logging/variablesLoggingMiddleware.js +8 -6
- package/dist/logging/variablesLoggingMiddleware.js.map +1 -1
- package/dist/metadataRefreshSignal.d.ts +19 -0
- package/dist/metadataRefreshSignal.d.ts.map +1 -0
- package/dist/metadataRefreshSignal.js +45 -0
- package/dist/metadataRefreshSignal.js.map +1 -0
- package/dist/middleware/MJTenantFilterMiddleware.js +4 -4
- package/dist/multiTenancy/index.d.ts +8 -0
- package/dist/multiTenancy/index.d.ts.map +1 -1
- package/dist/multiTenancy/index.js +21 -5
- package/dist/multiTenancy/index.js.map +1 -1
- package/dist/realtimeWidget/WidgetRouter.d.ts +5 -0
- package/dist/realtimeWidget/WidgetRouter.d.ts.map +1 -1
- package/dist/realtimeWidget/WidgetRouter.js +14 -10
- package/dist/realtimeWidget/WidgetRouter.js.map +1 -1
- package/dist/realtimeWidget/WidgetSessionService.d.ts +6 -6
- package/dist/realtimeWidget/WidgetSessionService.js +27 -27
- package/dist/realtimeWidget/host-identity.d.ts +5 -1
- package/dist/realtimeWidget/host-identity.d.ts.map +1 -1
- package/dist/realtimeWidget/host-identity.js +11 -3
- package/dist/realtimeWidget/host-identity.js.map +1 -1
- package/dist/realtimeWidget/index.d.ts +2 -2
- package/dist/realtimeWidget/index.d.ts.map +1 -1
- package/dist/realtimeWidget/index.js +2 -2
- package/dist/realtimeWidget/index.js.map +1 -1
- package/dist/realtimeWidget/visitorIdentity.d.ts +21 -1
- package/dist/realtimeWidget/visitorIdentity.d.ts.map +1 -1
- package/dist/realtimeWidget/visitorIdentity.js +16 -4
- package/dist/realtimeWidget/visitorIdentity.js.map +1 -1
- package/dist/realtimeWidget/widgetCore.d.ts +48 -0
- package/dist/realtimeWidget/widgetCore.d.ts.map +1 -1
- package/dist/realtimeWidget/widgetCore.js +38 -10
- package/dist/realtimeWidget/widgetCore.js.map +1 -1
- package/dist/realtimeWidget/widgetGuestElevation.d.ts +10 -6
- package/dist/realtimeWidget/widgetGuestElevation.d.ts.map +1 -1
- package/dist/realtimeWidget/widgetGuestElevation.js +14 -6
- package/dist/realtimeWidget/widgetGuestElevation.js.map +1 -1
- package/dist/resolvers/AdhocQueryResolver.js +3 -3
- package/dist/resolvers/FileResolver.js +3 -3
- package/dist/resolvers/GeoResolver.d.ts +2 -2
- package/dist/resolvers/GeoResolver.js +4 -4
- package/dist/resolvers/GetDataResolver.d.ts +14 -0
- package/dist/resolvers/GetDataResolver.d.ts.map +1 -1
- package/dist/resolvers/GetDataResolver.js +43 -15
- package/dist/resolvers/GetDataResolver.js.map +1 -1
- package/dist/resolvers/IntegrationDiscoveryResolver.js +2 -2
- package/dist/resolvers/ListOperationsResolver.d.ts +20 -0
- package/dist/resolvers/ListOperationsResolver.d.ts.map +1 -1
- package/dist/resolvers/ListOperationsResolver.js +68 -28
- package/dist/resolvers/ListOperationsResolver.js.map +1 -1
- package/dist/resolvers/MCPResolver.d.ts +11 -1
- package/dist/resolvers/MCPResolver.d.ts.map +1 -1
- package/dist/resolvers/MCPResolver.js +7 -3
- package/dist/resolvers/MCPResolver.js.map +1 -1
- package/dist/resolvers/RealtimeBridgeResolver.js +3 -3
- package/dist/resolvers/RealtimeClientSessionResolver.js +3 -3
- package/dist/resolvers/RemoteBrowserActionResolver.js +5 -5
- package/dist/resolvers/RunAIAgentResolver.d.ts +10 -4
- package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.js +69 -38
- package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
- package/dist/resolvers/RunAIPromptResolver.d.ts +1 -1
- package/dist/resolvers/RunAIPromptResolver.js +2 -2
- package/dist/resolvers/RunTestResolver.js +5 -5
- package/dist/resolvers/SqlLoggingConfigResolver.d.ts +8 -4
- package/dist/resolvers/SqlLoggingConfigResolver.d.ts.map +1 -1
- package/dist/resolvers/SqlLoggingConfigResolver.js +5 -5
- package/dist/resolvers/TaskGraphFrameResolver.d.ts +8 -1
- package/dist/resolvers/TaskGraphFrameResolver.d.ts.map +1 -1
- package/dist/resolvers/TaskGraphFrameResolver.js +6 -2
- package/dist/resolvers/TaskGraphFrameResolver.js.map +1 -1
- package/dist/resolvers/adhoc-query-helpers.d.ts +6 -0
- package/dist/resolvers/adhoc-query-helpers.d.ts.map +1 -1
- package/dist/resolvers/adhoc-query-helpers.js +10 -2
- package/dist/resolvers/adhoc-query-helpers.js.map +1 -1
- package/dist/resolvers/artifact-routing.d.ts +8 -8
- package/dist/resolvers/artifact-routing.js +2 -2
- package/dist/resolvers/artifact-routing.js.map +1 -1
- package/dist/resolvers/meetingRecordingRegistration.d.ts +10 -2
- package/dist/resolvers/meetingRecordingRegistration.d.ts.map +1 -1
- package/dist/resolvers/meetingRecordingRegistration.js +24 -8
- package/dist/resolvers/meetingRecordingRegistration.js.map +1 -1
- package/dist/resolvers/peaksSidecar.d.ts +4 -0
- package/dist/resolvers/peaksSidecar.d.ts.map +1 -1
- package/dist/resolvers/peaksSidecar.js +10 -2
- package/dist/resolvers/peaksSidecar.js.map +1 -1
- package/dist/rest/EntityCRUDHandler.d.ts +28 -0
- package/dist/rest/EntityCRUDHandler.d.ts.map +1 -1
- package/dist/rest/EntityCRUDHandler.js +20 -4
- package/dist/rest/EntityCRUDHandler.js.map +1 -1
- package/dist/rest/MediaStreamHandler.d.ts +2 -0
- package/dist/rest/MediaStreamHandler.d.ts.map +1 -1
- package/dist/rest/MediaStreamHandler.js +10 -6
- package/dist/rest/MediaStreamHandler.js.map +1 -1
- package/dist/rest/OAuthCallbackHandler.d.ts +9 -0
- package/dist/rest/OAuthCallbackHandler.d.ts.map +1 -1
- package/dist/rest/OAuthCallbackHandler.js +15 -3
- package/dist/rest/OAuthCallbackHandler.js.map +1 -1
- package/dist/rest/RESTEndpointHandler.d.ts +6 -4
- package/dist/rest/RESTEndpointHandler.d.ts.map +1 -1
- package/dist/rest/RESTEndpointHandler.js +15 -11
- package/dist/rest/RESTEndpointHandler.js.map +1 -1
- package/dist/rest/RealtimeSdpBrokerHandler.d.ts +5 -1
- package/dist/rest/RealtimeSdpBrokerHandler.d.ts.map +1 -1
- package/dist/rest/RealtimeSdpBrokerHandler.js +12 -4
- package/dist/rest/RealtimeSdpBrokerHandler.js.map +1 -1
- package/dist/rest/SignatureWebhookHandler.d.ts +2 -0
- package/dist/rest/SignatureWebhookHandler.d.ts.map +1 -1
- package/dist/rest/SignatureWebhookHandler.js +5 -1
- package/dist/rest/SignatureWebhookHandler.js.map +1 -1
- package/dist/rest/UploadTokenManager.d.ts +24 -8
- package/dist/rest/UploadTokenManager.d.ts.map +1 -1
- package/dist/rest/UploadTokenManager.js +53 -21
- package/dist/rest/UploadTokenManager.js.map +1 -1
- package/dist/rest/ViewOperationsHandler.d.ts +20 -0
- package/dist/rest/ViewOperationsHandler.d.ts.map +1 -1
- package/dist/rest/ViewOperationsHandler.js +20 -4
- package/dist/rest/ViewOperationsHandler.js.map +1 -1
- package/dist/rest/mediaRange.d.ts +4 -0
- package/dist/rest/mediaRange.d.ts.map +1 -1
- package/dist/rest/mediaRange.js +10 -2
- package/dist/rest/mediaRange.js.map +1 -1
- package/dist/rest/setupRESTEndpoints.d.ts +4 -0
- package/dist/rest/setupRESTEndpoints.d.ts.map +1 -1
- package/dist/rest/setupRESTEndpoints.js +13 -7
- package/dist/rest/setupRESTEndpoints.js.map +1 -1
- package/dist/serverExtensionReservedRoots.d.ts +2 -0
- package/dist/serverExtensionReservedRoots.d.ts.map +1 -1
- package/dist/serverExtensionReservedRoots.js +5 -1
- package/dist/serverExtensionReservedRoots.js.map +1 -1
- package/dist/services/TaskGraphActionRunner.d.ts +13 -8
- package/dist/services/TaskGraphActionRunner.d.ts.map +1 -1
- package/dist/services/TaskGraphActionRunner.js +16 -15
- package/dist/services/TaskGraphActionRunner.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -3
- package/dist/types.js.map +1 -1
- package/dist/util.d.ts +6 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +13 -5
- package/dist/util.js.map +1 -1
- package/package.json +92 -92
- package/src/__tests__/DeleteOptionsInput.wireShape.test.ts +62 -0
- package/src/__tests__/FileResolverPeaks.test.ts +13 -13
- package/src/__tests__/ListOperationsResolver.test.ts +17 -17
- package/src/__tests__/MediaStreamHandler.test.ts +28 -28
- package/src/__tests__/NoLog.test.ts +11 -11
- package/src/__tests__/PrimaryKeyAlwaysMapped.test.ts +10 -10
- package/src/__tests__/RESTEndpointHandler.test.ts +14 -14
- package/src/__tests__/RealtimeBridgeResolver.test.ts +4 -2
- package/src/__tests__/RealtimeSdpBrokerHandler.test.ts +6 -6
- package/src/__tests__/RefreshAdoptsNewColumns.test.ts +8 -8
- package/src/__tests__/RemoteBrowserGoalEngine.test.ts +18 -18
- package/src/__tests__/RunAIAgentResolver.historyFrom.test.ts +228 -0
- package/src/__tests__/TaskGraphActionRunner.durablePayload.test.ts +129 -0
- package/src/__tests__/TaskGraphFrameResolver.test.ts +2 -2
- package/src/__tests__/WidgetSessionService.test.ts +8 -4
- package/src/__tests__/adhoc-query-helpers.test.ts +21 -21
- package/src/__tests__/bootAudit.test.ts +11 -11
- package/src/__tests__/boundaryLogPayload.test.ts +6 -6
- package/src/__tests__/cacheInvalidationRecordData.test.ts +177 -0
- package/src/__tests__/databaseAbstraction.test.ts +12 -6
- package/src/__tests__/getDataTokenRedaction.test.ts +7 -7
- package/src/__tests__/initializeProviders.refresh.test.ts +4 -4
- package/src/__tests__/magicLink.test.ts +73 -134
- package/src/__tests__/magicLinkService.consume.test.ts +224 -0
- package/src/__tests__/meetingRecordingRegistration.test.ts +12 -12
- package/src/__tests__/metadataRefreshSignal.test.ts +78 -0
- package/src/__tests__/multiTenancy.security.test.ts +40 -40
- package/src/__tests__/multiTenancy.test.ts +18 -18
- package/src/__tests__/newUsers.test.ts +24 -23
- package/src/__tests__/principals.test.ts +22 -22
- package/src/__tests__/pushStatusResolver.filter.test.ts +8 -8
- package/src/__tests__/secretRedactor.failOpen.test.ts +12 -12
- package/src/__tests__/secretRedactor.test.ts +12 -12
- package/src/__tests__/serverExtensionReservedRoots.test.ts +7 -7
- package/src/__tests__/subscriptionRedaction.test.ts +5 -5
- package/src/__tests__/unifiedAuth.test.ts +15 -9
- package/src/__tests__/visitorIdentity.resolve.test.ts +6 -6
- package/src/__tests__/widget.test.ts +45 -45
- package/src/__tests__/widgetGuestElevation.test.ts +7 -7
- package/src/__tests__/widgetHostIdentity.test.ts +14 -14
- package/src/agentSessions/ReturningVisitorRecap.ts +12 -1
- package/src/agentSessions/SessionManager.ts +2 -2
- package/src/agentSessions/remoteBrowserGoalEngine.ts +30 -5
- package/src/auth/AuthProviderCatalogRouter.ts +6 -1
- package/src/auth/__tests__/backward-compatibility.test.ts +3 -3
- package/src/auth/index.ts +43 -28
- package/src/auth/initializeProviders.ts +25 -5
- package/src/auth/magicLink/MagicLinkRouter.ts +28 -10
- package/src/auth/magicLink/MagicLinkService.ts +71 -52
- package/src/auth/magicLink/index.ts +7 -7
- package/src/auth/magicLink/magicLinkCore.ts +96 -64
- package/src/auth/magicLink/redeemLanding.ts +14 -4
- package/src/auth/magicLink/types.ts +54 -54
- package/src/auth/newUsers.ts +1 -1
- package/src/auth/principals.ts +11 -2
- package/src/cache.ts +4 -1
- package/src/config.ts +37 -4
- package/src/context.ts +37 -24
- package/src/directives/Public.ts +4 -1
- package/src/directives/RequireSystemUser.ts +4 -1
- package/src/generated/graphql-schemas/__mj.ts +37 -0
- package/src/generic/CacheInvalidationResolver.ts +148 -4
- package/src/generic/DeleteOptionsInput.ts +9 -2
- package/src/generic/FireAndForgetHeartbeat.ts +19 -14
- package/src/generic/PushStatusResolver.ts +21 -7
- package/src/generic/ResolverBase.ts +16 -8
- package/src/generic/RunViewResolver.ts +22 -22
- package/src/generic/__tests__/FireAndForgetHeartbeat.test.ts +7 -7
- package/src/index.ts +35 -9
- package/src/integration/CustomColumnPromoter.ts +6 -1
- package/src/integration/EntityMapLifecycle.ts +20 -2
- package/src/logging/NoLog.ts +16 -2
- package/src/logging/StartupLogger.ts +6 -1
- package/src/logging/bootAudit.ts +26 -16
- package/src/logging/boundaryLogPayload.ts +8 -1
- package/src/logging/secretRedactor.ts +14 -9
- package/src/logging/shortenForLog.ts +8 -3
- package/src/logging/variablesLoggingMiddleware.ts +9 -6
- package/src/metadataRefreshSignal.ts +45 -0
- package/src/middleware/MJTenantFilterMiddleware.ts +4 -4
- package/src/multiTenancy/index.ts +29 -5
- package/src/realtimeWidget/WidgetRouter.ts +15 -10
- package/src/realtimeWidget/WidgetSessionService.ts +76 -76
- package/src/realtimeWidget/host-identity.ts +24 -10
- package/src/realtimeWidget/index.ts +3 -3
- package/src/realtimeWidget/visitorIdentity.ts +39 -8
- package/src/realtimeWidget/widgetCore.ts +75 -10
- package/src/realtimeWidget/widgetGuestElevation.ts +25 -12
- package/src/resolvers/AdhocQueryResolver.ts +3 -3
- package/src/resolvers/AgentSessionResolver.ts +3 -3
- package/src/resolvers/ColorResolver.ts +6 -6
- package/src/resolvers/ComponentRegistryResolver.ts +36 -36
- package/src/resolvers/EntityCommunicationsResolver.ts +4 -4
- package/src/resolvers/ExecuteRemoteOperationResolver.ts +9 -9
- package/src/resolvers/FileResolver.ts +42 -42
- package/src/resolvers/GeoResolver.ts +4 -4
- package/src/resolvers/GetDataResolver.ts +50 -15
- package/src/resolvers/IntegrationDiscoveryResolver.ts +2 -2
- package/src/resolvers/ListOperationsResolver.ts +78 -28
- package/src/resolvers/MCPResolver.ts +30 -15
- package/src/resolvers/QueryResolver.ts +13 -13
- package/src/resolvers/RealtimeBridgeResolver.ts +3 -3
- package/src/resolvers/RealtimeClientSessionResolver.ts +3 -3
- package/src/resolvers/RemoteBrowserActionResolver.ts +5 -5
- package/src/resolvers/RunAIAgentResolver.ts +113 -72
- package/src/resolvers/RunAIPromptResolver.ts +22 -22
- package/src/resolvers/RunTemplateResolver.ts +4 -4
- package/src/resolvers/RunTestResolver.ts +25 -25
- package/src/resolvers/SqlLoggingConfigResolver.ts +56 -56
- package/src/resolvers/TaskGraphFrameResolver.ts +37 -28
- package/src/resolvers/TelemetryResolver.ts +79 -79
- package/src/resolvers/__tests__/GetDataResolver.tokens.test.ts +40 -38
- package/src/resolvers/__tests__/artifact-routing.test.ts +23 -23
- package/src/resolvers/adhoc-query-helpers.ts +19 -2
- package/src/resolvers/artifact-routing.ts +19 -19
- package/src/resolvers/meetingRecordingRegistration.ts +44 -10
- package/src/resolvers/peaksSidecar.ts +12 -2
- package/src/rest/EntityCRUDHandler.ts +24 -4
- package/src/rest/MediaStreamHandler.ts +11 -6
- package/src/rest/OAuthCallbackHandler.ts +25 -7
- package/src/rest/RESTEndpointHandler.ts +20 -15
- package/src/rest/RealtimeSdpBrokerHandler.ts +14 -4
- package/src/rest/SignatureWebhookHandler.ts +6 -1
- package/src/rest/UploadTokenManager.ts +66 -30
- package/src/rest/ViewOperationsHandler.ts +24 -4
- package/src/rest/mediaRange.ts +16 -6
- package/src/rest/setupRESTEndpoints.ts +24 -12
- package/src/serverExtensionReservedRoots.ts +6 -1
- package/src/services/TaskGraphActionRunner.ts +16 -15
- package/src/types.ts +21 -16
- package/src/util.ts +16 -6
|
@@ -19,13 +19,13 @@ import { MJLruCache, UUIDsEqual } from '@memberjunction/global';
|
|
|
19
19
|
import type { MJConversationWidgetInstanceEntity, MJConversationEntity } from '@memberjunction/core-entities';
|
|
20
20
|
import { ResolveConfiguredPrincipal } from '../auth/principals.js';
|
|
21
21
|
import { MagicLinkKeyManager } from '../auth/magicLink/MagicLinkKeys.js';
|
|
22
|
-
import {
|
|
22
|
+
import { GenerateSessionId } from '../auth/magicLink/magicLinkCore.js';
|
|
23
23
|
import { MagicLinkService } from '../auth/magicLink/MagicLinkService.js';
|
|
24
24
|
import { configInfo, type WidgetConfig } from '../config.js';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
25
|
+
import { BuildWidgetGuestClaims, EvaluateWidgetMint, ParseEnabledChannels, type WidgetMintErrorCode } from './widgetCore.js';
|
|
26
|
+
import { VerifyHostAssertion, type HostAssertedIdentity } from './host-identity.js';
|
|
27
|
+
import { WriteReturningVisitorRecap } from '../agentSessions/ReturningVisitorRecap.js';
|
|
28
|
+
import { ResolveIdentityByEmail, MergeVisitorIdentity, ForgetVisitor, type ResolvedVisitorIdentity } from './visitorIdentity.js';
|
|
29
29
|
|
|
30
30
|
const WIDGET_ENTITY = 'MJ: Conversation Widget Instances';
|
|
31
31
|
const CONVERSATIONS_ENTITY = 'MJ: Conversations';
|
|
@@ -43,115 +43,115 @@ interface ReturningVisitorResolution {
|
|
|
43
43
|
|
|
44
44
|
/** Per-request forensic context captured for audit (sourced from the HTTP request). */
|
|
45
45
|
export interface WidgetMintAuditContext {
|
|
46
|
-
ipAddress?: string;
|
|
47
|
-
userAgent?: string;
|
|
48
|
-
origin?: string;
|
|
46
|
+
ipAddress?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
47
|
+
userAgent?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
48
|
+
origin?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/** Input to mint a guest session. */
|
|
52
52
|
export interface MintGuestSessionInput {
|
|
53
53
|
/** The widget's public embed key (pk_live_…). */
|
|
54
|
-
widgetKey: string;
|
|
54
|
+
widgetKey: string; // case-violation-ok-legacy-back-compat: the old name is also read off a value typed `any`, where a rename would compile and silently return undefined
|
|
55
55
|
/** The request's Origin header — enforced against the instance allowlist. */
|
|
56
|
-
origin?: string;
|
|
56
|
+
origin?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
57
57
|
/**
|
|
58
58
|
* A host-signed RS256 identity assertion (D1 `host-identity` strategy). Required when the
|
|
59
59
|
* resolved widget's AuthStrategy is `HostIdentity`; ignored otherwise. Verified against the
|
|
60
60
|
* host's registered public key; its identity is carried as informational claims only.
|
|
61
61
|
*/
|
|
62
|
-
hostAssertion?: string;
|
|
62
|
+
hostAssertion?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
63
63
|
/**
|
|
64
64
|
* The durable returning-visitor anchor (RV1) the client presents from its first-party cookie.
|
|
65
65
|
* Honored only when the widget's `RememberReturningVisitors` toggle is on: a valid presented key
|
|
66
66
|
* chains this visit to the visitor's prior conversation; absent/invalid on a first visit, the
|
|
67
67
|
* server mints a fresh one. Ignored entirely when remembering is off.
|
|
68
68
|
*/
|
|
69
|
-
visitorKey?: string;
|
|
70
|
-
audit?: WidgetMintAuditContext;
|
|
69
|
+
visitorKey?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
70
|
+
audit?: WidgetMintAuditContext; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/** Result of a guest-session mint. */
|
|
74
74
|
export interface MintGuestSessionResult {
|
|
75
|
-
success: boolean;
|
|
75
|
+
success: boolean; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
76
76
|
/** The minted session JWT (RS256), held by the widget in memory and refreshed before expiry. */
|
|
77
|
-
token?: string;
|
|
77
|
+
token?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
78
78
|
/** ISO expiry of the session token. */
|
|
79
|
-
expiresAt?: string;
|
|
79
|
+
expiresAt?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
80
80
|
/** The widget instance id (also carried as the `mj_widget_id` claim). */
|
|
81
|
-
widgetId?: string;
|
|
81
|
+
widgetId?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
82
82
|
/** The Application the session is scoped to. */
|
|
83
|
-
applicationId?: string;
|
|
83
|
+
applicationId?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
84
84
|
/** The pinned support agent the widget passes as explicitAgentId for every turn (D5). */
|
|
85
|
-
pinnedAgentId?: string;
|
|
85
|
+
pinnedAgentId?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
86
86
|
/** Which modalities this widget exposes (drives the widget UI). */
|
|
87
|
-
modality?: string;
|
|
87
|
+
modality?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
88
88
|
/**
|
|
89
89
|
* The opaque per-session id (also the signed scope resourceId). The widget stamps
|
|
90
90
|
* Conversation.ExternalID with this so the Widget Guest RLS filters isolate this guest's rows.
|
|
91
91
|
*/
|
|
92
|
-
sessionId?: string;
|
|
92
|
+
sessionId?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
93
93
|
/**
|
|
94
94
|
* Optional hard ceiling (minutes) on a voice session for this widget. Surfaced so the client
|
|
95
95
|
* voice-abuse guard uses the deployment-configured limit; also enforced server-side at mint.
|
|
96
96
|
*/
|
|
97
|
-
voiceMaxSessionMinutes?: number;
|
|
97
|
+
voiceMaxSessionMinutes?: number; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
98
98
|
/** Whether returning-visitor memory is enabled for this widget (gates the cookie + chaining). */
|
|
99
|
-
rememberReturningVisitors?: boolean;
|
|
99
|
+
rememberReturningVisitors?: boolean; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
100
100
|
/**
|
|
101
101
|
* The durable visitor anchor to persist as a cookie (RV1). Set only when remembering is on:
|
|
102
102
|
* the validated key the client presented, or a freshly minted one on a first visit.
|
|
103
103
|
*/
|
|
104
|
-
visitorKey?: string;
|
|
104
|
+
visitorKey?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
105
105
|
/** The visitor's prior conversation for this anchor (RV2 chain); set only on a returning visit. */
|
|
106
|
-
lastConversationId?: string;
|
|
106
|
+
lastConversationId?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
107
107
|
/**
|
|
108
108
|
* The resolved polymorphic identity entity id (RV4), set only when a host-identity widget asserted a
|
|
109
109
|
* resolvable identity at mint. The client stamps it (with {@link MintGuestSessionResult.linkedRecordId})
|
|
110
110
|
* onto the new conversation so memory injection (RV3) keys off the resolved record, not the cookie.
|
|
111
111
|
*/
|
|
112
|
-
linkedEntityId?: string;
|
|
112
|
+
linkedEntityId?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
113
113
|
/** The resolved polymorphic identity record id (RV4); paired with {@link MintGuestSessionResult.linkedEntityId}. */
|
|
114
|
-
linkedRecordId?: string;
|
|
114
|
+
linkedRecordId?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
115
115
|
/**
|
|
116
116
|
* Interactive channels (by name, e.g. `["Whiteboard"]`) this widget may attach when voice is active
|
|
117
117
|
* (Phase 2). Mirrors the widget instance's `EnabledChannels`; empty (the default) = no channels.
|
|
118
118
|
*/
|
|
119
|
-
enabledChannels?: string[];
|
|
120
|
-
error?: string;
|
|
121
|
-
errorCode?: WidgetMintErrorCode;
|
|
119
|
+
enabledChannels?: string[]; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
120
|
+
error?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
121
|
+
errorCode?: WidgetMintErrorCode; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/** Input to resolve a returning visitor's identity after they verify (RV4, magic-link upgrade path). */
|
|
125
125
|
export interface ResolveVisitorIdentityInput {
|
|
126
126
|
/** The widget's public embed key. */
|
|
127
|
-
|
|
127
|
+
WidgetKey: string;
|
|
128
128
|
/** The durable returning-visitor anchor whose trail should be promoted to the verified identity. */
|
|
129
|
-
|
|
129
|
+
VisitorKey: string;
|
|
130
130
|
/** The verified visitor's email (from the authenticated session) — resolved to a record via config. */
|
|
131
|
-
|
|
131
|
+
VerifiedEmail: string;
|
|
132
132
|
/** The request's Origin header — enforced against the instance allowlist. */
|
|
133
|
-
origin?: string;
|
|
133
|
+
origin?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/** Result of an RV4 identity resolve+merge. */
|
|
137
137
|
export interface ResolveVisitorIdentityResult {
|
|
138
|
-
success: boolean;
|
|
138
|
+
success: boolean; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
139
139
|
/** The resolved polymorphic pair, when a record matched the verified email. */
|
|
140
|
-
resolved?: ResolvedVisitorIdentity;
|
|
140
|
+
resolved?: ResolvedVisitorIdentity; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
141
141
|
/** How many conversations were stamped with the resolved identity. */
|
|
142
|
-
mergedConversations?: number;
|
|
143
|
-
error?: string;
|
|
144
|
-
errorCode?: WidgetMintErrorCode;
|
|
142
|
+
mergedConversations?: number; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
143
|
+
error?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
144
|
+
errorCode?: WidgetMintErrorCode; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/** Input to a "forget me" request (RV5). */
|
|
148
148
|
export interface ForgetVisitorInput {
|
|
149
149
|
/** The widget's public embed key. */
|
|
150
|
-
|
|
150
|
+
WidgetKey: string;
|
|
151
151
|
/** The durable returning-visitor anchor to forget. */
|
|
152
|
-
|
|
152
|
+
VisitorKey: string;
|
|
153
153
|
/** The request's Origin header — enforced against the instance allowlist. */
|
|
154
|
-
origin?: string;
|
|
154
|
+
origin?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
@@ -169,32 +169,32 @@ interface VisitorPrivacyGateResult {
|
|
|
169
169
|
|
|
170
170
|
/** Result of a "forget me" request (RV5). */
|
|
171
171
|
export interface ForgetVisitorResult {
|
|
172
|
-
success: boolean;
|
|
172
|
+
success: boolean; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
173
173
|
/** Count of memory notes archived. */
|
|
174
|
-
notesArchived?: number;
|
|
174
|
+
notesArchived?: number; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
175
175
|
/** Count of conversations whose VisitorKey linkage was cleared. */
|
|
176
|
-
conversationsCleared?: number;
|
|
177
|
-
error?: string;
|
|
178
|
-
errorCode?: WidgetMintErrorCode;
|
|
176
|
+
conversationsCleared?: number; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
177
|
+
error?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
178
|
+
errorCode?: WidgetMintErrorCode; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/** Input to request a magic-link identity upgrade for a live guest session (W5). */
|
|
182
182
|
export interface UpgradeGuestSessionInput {
|
|
183
183
|
/** The widget's public embed key. */
|
|
184
|
-
|
|
184
|
+
WidgetKey: string;
|
|
185
185
|
/** The email to send the verification link to (becomes the provisioned user's email). */
|
|
186
|
-
email: string;
|
|
186
|
+
email: string; // case-violation-ok-legacy-back-compat: the old name is also read off a value typed `any`, where a rename would compile and silently return undefined
|
|
187
187
|
/** The request's Origin header — enforced against the instance allowlist. */
|
|
188
|
-
origin?: string;
|
|
188
|
+
origin?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/** Result of a magic-link upgrade request. Never carries the token (delivered by email, out-of-band). */
|
|
192
192
|
export interface UpgradeGuestSessionResult {
|
|
193
|
-
success: boolean;
|
|
193
|
+
success: boolean; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
194
194
|
/** Whether the verification email was dispatched (false when no comms provider is configured). */
|
|
195
|
-
emailSent?: boolean;
|
|
196
|
-
error?: string;
|
|
197
|
-
errorCode?: WidgetMintErrorCode;
|
|
195
|
+
emailSent?: boolean; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
196
|
+
error?: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
197
|
+
errorCode?: WidgetMintErrorCode; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/** Minimal email sanity check (presence + single `@` with a dotted domain) — not full RFC validation. */
|
|
@@ -229,7 +229,7 @@ export class WidgetSessionService {
|
|
|
229
229
|
return this.audited({ success: false, errorCode: 'not_found', error: 'Unknown widget key.' }, input, undefined);
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
const eligibility =
|
|
232
|
+
const eligibility = EvaluateWidgetMint(
|
|
233
233
|
{ Status: widget.Status, AllowedOrigins: widget.AllowedOrigins, Modality: widget.Modality },
|
|
234
234
|
input.origin,
|
|
235
235
|
);
|
|
@@ -357,11 +357,11 @@ export class WidgetSessionService {
|
|
|
357
357
|
if (!contextUser) {
|
|
358
358
|
return { success: false, errorCode: 'server_error', error: 'Server not configured for widget sessions.' };
|
|
359
359
|
}
|
|
360
|
-
const widget = await this.loadWidgetByKey(input.
|
|
360
|
+
const widget = await this.loadWidgetByKey(input.WidgetKey, contextUser);
|
|
361
361
|
if (!widget) {
|
|
362
362
|
return { success: false, errorCode: 'not_found', error: 'Unknown widget key.' };
|
|
363
363
|
}
|
|
364
|
-
const eligibility =
|
|
364
|
+
const eligibility = EvaluateWidgetMint({ Status: widget.Status, AllowedOrigins: widget.AllowedOrigins, Modality: widget.Modality }, input.origin);
|
|
365
365
|
if (!eligibility.ok) {
|
|
366
366
|
return { success: false, errorCode: eligibility.errorCode, error: 'Widget upgrade rejected.' };
|
|
367
367
|
}
|
|
@@ -374,7 +374,7 @@ export class WidgetSessionService {
|
|
|
374
374
|
return { success: false, errorCode: 'server_error', error: 'Identity verification is not configured.' };
|
|
375
375
|
}
|
|
376
376
|
const service = new MagicLinkService(this.publicUrl, magicLinkConfig);
|
|
377
|
-
const result = await service.CreateInvite({ email,
|
|
377
|
+
const result = await service.CreateInvite({ email, ApplicationId: widget.ApplicationID }, contextUser);
|
|
378
378
|
if (!result.success) {
|
|
379
379
|
LogError(`[Widget] Upgrade invite failed for widget ${widget.ID}: ${result.error ?? result.errorCode ?? 'unknown'}`);
|
|
380
380
|
return { success: false, errorCode: 'server_error', error: 'Could not start identity verification.' };
|
|
@@ -397,9 +397,9 @@ export class WidgetSessionService {
|
|
|
397
397
|
// Prefer the per-instance HostPublicKey column (Phase 3 — no config-resident keys); fall back to the
|
|
398
398
|
// interim config map (keyed by PublicKey) for deployments that haven't migrated their key yet.
|
|
399
399
|
const hostKey = widget.HostPublicKey ?? this.config.hostPublicKeys?.[widget.PublicKey];
|
|
400
|
-
const result =
|
|
401
|
-
if (result.ok && result.
|
|
402
|
-
return result.
|
|
400
|
+
const result = VerifyHostAssertion(assertion, hostKey, widget.PublicKey);
|
|
401
|
+
if (result.ok && result.Identity) {
|
|
402
|
+
return result.Identity;
|
|
403
403
|
}
|
|
404
404
|
LogError(`[Widget] Host assertion rejected for widget ${widget.ID}: ${result.errorCode ?? 'unknown'}`);
|
|
405
405
|
return null;
|
|
@@ -417,8 +417,8 @@ export class WidgetSessionService {
|
|
|
417
417
|
const ttlMinutes = widget.SessionTTLMinutes || this.config.defaultSessionTtlMinutes;
|
|
418
418
|
// Generated once and returned to the client: the widget stamps Conversation.ExternalID with
|
|
419
419
|
// this id so the Widget Guest RLS filters ({{ScopeResourceID}}) isolate this guest's rows.
|
|
420
|
-
const sessionId =
|
|
421
|
-
const claims =
|
|
420
|
+
const sessionId = GenerateSessionId();
|
|
421
|
+
const claims = BuildWidgetGuestClaims({
|
|
422
422
|
issuer: this.publicUrl,
|
|
423
423
|
audience: this.config.audience,
|
|
424
424
|
widgetId: widget.ID,
|
|
@@ -452,7 +452,7 @@ export class WidgetSessionService {
|
|
|
452
452
|
sessionId,
|
|
453
453
|
// Phase 2: which interactive channels this widget may attach during a voice session. Read from the
|
|
454
454
|
// per-instance EnabledChannels column (added by the Widget_Public_Hardening migration + CodeGen).
|
|
455
|
-
enabledChannels:
|
|
455
|
+
enabledChannels: ParseEnabledChannels(widget.EnabledChannels),
|
|
456
456
|
voiceMaxSessionMinutes: widget.VoiceMaxSessionMinutes ?? undefined,
|
|
457
457
|
rememberReturningVisitors: !!returningVisitor,
|
|
458
458
|
visitorKey: returningVisitor?.visitorKey,
|
|
@@ -477,11 +477,11 @@ export class WidgetSessionService {
|
|
|
477
477
|
if (!widget.RememberReturningVisitors || !hostIdentity?.email || !returningVisitor?.visitorKey) {
|
|
478
478
|
return undefined;
|
|
479
479
|
}
|
|
480
|
-
const identity = await
|
|
480
|
+
const identity = await ResolveIdentityByEmail(hostIdentity.email, contextUser, Metadata.Provider, this.config.identityResolution); // global-provider-ok: server-side mint under the single default provider
|
|
481
481
|
if (!identity) {
|
|
482
482
|
return undefined;
|
|
483
483
|
}
|
|
484
|
-
await
|
|
484
|
+
await MergeVisitorIdentity({
|
|
485
485
|
visitorKey: returningVisitor.visitorKey,
|
|
486
486
|
applicationId: widget.ApplicationID,
|
|
487
487
|
identity,
|
|
@@ -499,17 +499,17 @@ export class WidgetSessionService {
|
|
|
499
499
|
*/
|
|
500
500
|
public async ResolveVisitorIdentity(input: ResolveVisitorIdentityInput): Promise<ResolveVisitorIdentityResult> {
|
|
501
501
|
try {
|
|
502
|
-
const gate = await this.gateVisitorPrivacyRequest(input.
|
|
502
|
+
const gate = await this.gateVisitorPrivacyRequest(input.WidgetKey, input.VisitorKey, input.origin);
|
|
503
503
|
if (!gate.ok) {
|
|
504
504
|
return { success: false, errorCode: gate.errorCode, error: gate.error };
|
|
505
505
|
}
|
|
506
|
-
const identity = await
|
|
506
|
+
const identity = await ResolveIdentityByEmail(input.VerifiedEmail, gate.contextUser, Metadata.Provider, this.config.identityResolution); // global-provider-ok: server-side mint under the single default provider
|
|
507
507
|
if (!identity) {
|
|
508
508
|
// Verified, but no record matches the email under the configured target — nothing to merge.
|
|
509
509
|
return { success: true, mergedConversations: 0 };
|
|
510
510
|
}
|
|
511
|
-
const mergedConversations = await
|
|
512
|
-
visitorKey: input.
|
|
511
|
+
const mergedConversations = await MergeVisitorIdentity({
|
|
512
|
+
visitorKey: input.VisitorKey,
|
|
513
513
|
applicationId: gate.widget.ApplicationID,
|
|
514
514
|
identity,
|
|
515
515
|
contextUser: gate.contextUser,
|
|
@@ -529,12 +529,12 @@ export class WidgetSessionService {
|
|
|
529
529
|
*/
|
|
530
530
|
public async ForgetVisitor(input: ForgetVisitorInput): Promise<ForgetVisitorResult> {
|
|
531
531
|
try {
|
|
532
|
-
const gate = await this.gateVisitorPrivacyRequest(input.
|
|
532
|
+
const gate = await this.gateVisitorPrivacyRequest(input.WidgetKey, input.VisitorKey, input.origin);
|
|
533
533
|
if (!gate.ok) {
|
|
534
534
|
return { success: false, errorCode: gate.errorCode, error: gate.error };
|
|
535
535
|
}
|
|
536
|
-
const { notesArchived, conversationsCleared } = await
|
|
537
|
-
visitorKey: input.
|
|
536
|
+
const { notesArchived, conversationsCleared } = await ForgetVisitor({
|
|
537
|
+
visitorKey: input.VisitorKey,
|
|
538
538
|
applicationId: gate.widget.ApplicationID,
|
|
539
539
|
contextUser: gate.contextUser,
|
|
540
540
|
provider: Metadata.Provider, // global-provider-ok: server-side mint under the single default provider
|
|
@@ -564,7 +564,7 @@ export class WidgetSessionService {
|
|
|
564
564
|
if (!widget) {
|
|
565
565
|
return { ok: false, errorCode: 'not_found', error: 'Unknown widget key.' };
|
|
566
566
|
}
|
|
567
|
-
const eligibility =
|
|
567
|
+
const eligibility = EvaluateWidgetMint(
|
|
568
568
|
{ Status: widget.Status, AllowedOrigins: widget.AllowedOrigins, Modality: widget.Modality },
|
|
569
569
|
origin,
|
|
570
570
|
);
|
|
@@ -597,7 +597,7 @@ export class WidgetSessionService {
|
|
|
597
597
|
}
|
|
598
598
|
const presented = (presentedKey ?? '').trim();
|
|
599
599
|
const isReturning = VISITOR_KEY_PATTERN.test(presented);
|
|
600
|
-
const visitorKey = isReturning ? presented :
|
|
600
|
+
const visitorKey = isReturning ? presented : GenerateSessionId();
|
|
601
601
|
const lastConversationId = isReturning
|
|
602
602
|
? await this.findPreviousConversationByVisitorKey(visitorKey, widget.ApplicationID, contextUser)
|
|
603
603
|
: undefined;
|
|
@@ -622,7 +622,7 @@ export class WidgetSessionService {
|
|
|
622
622
|
return;
|
|
623
623
|
}
|
|
624
624
|
// global-provider-ok: server-side mint under the single default provider (same rationale as resolveGuestRoleName).
|
|
625
|
-
await
|
|
625
|
+
await WriteReturningVisitorRecap(
|
|
626
626
|
priorConversationId,
|
|
627
627
|
widget.PinnedAgentID,
|
|
628
628
|
contextUser,
|
|
@@ -20,18 +20,18 @@ export type { HostAssertionError };
|
|
|
20
20
|
|
|
21
21
|
/** The visitor identity a host asserts. Standard OIDC-ish claims so synthesis is uniform. */
|
|
22
22
|
export interface HostAssertedIdentity {
|
|
23
|
-
email: string;
|
|
24
|
-
firstName?: string;
|
|
25
|
-
lastName?: string;
|
|
23
|
+
email: string; // case-violation-ok-legacy-back-compat: the old name is also read off a value typed `any`, where a rename would compile and silently return undefined
|
|
24
|
+
firstName?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
25
|
+
lastName?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
26
26
|
/** The host's opaque user id for this visitor (audit correlation; not an MJ user id). */
|
|
27
|
-
hostUserId?: string;
|
|
27
|
+
hostUserId?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/** Result of verifying a host assertion. `identity` is present iff `ok` is true. */
|
|
31
31
|
export interface HostAssertionResult {
|
|
32
|
-
ok: boolean;
|
|
33
|
-
|
|
34
|
-
errorCode?: HostAssertionError;
|
|
32
|
+
ok: boolean; // case-violation-ok-legacy-back-compat: the old name is also read off a value typed `any`, where a rename would compile and silently return undefined
|
|
33
|
+
Identity?: HostAssertedIdentity;
|
|
34
|
+
errorCode?: HostAssertionError; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -52,7 +52,7 @@ const hostIdentityProvider = new HostIdentityProvider({
|
|
|
52
52
|
* asserted visitor identity. Thin adapter over {@link HostIdentityProvider.VerifyHostAssertion} (the single
|
|
53
53
|
* implementation, registered in the AuthProviderFactory) preserving this module's result shape. Never throws.
|
|
54
54
|
*/
|
|
55
|
-
export function
|
|
55
|
+
export function VerifyHostAssertion(
|
|
56
56
|
assertion: string | undefined,
|
|
57
57
|
hostPublicKeyPem: string | undefined,
|
|
58
58
|
expectedAudience: string,
|
|
@@ -63,7 +63,7 @@ export function verifyHostAssertion(
|
|
|
63
63
|
}
|
|
64
64
|
return {
|
|
65
65
|
ok: true,
|
|
66
|
-
|
|
66
|
+
Identity: {
|
|
67
67
|
email: result.userInfo.email,
|
|
68
68
|
firstName: result.userInfo.firstName,
|
|
69
69
|
lastName: result.userInfo.lastName,
|
|
@@ -72,8 +72,17 @@ export function verifyHostAssertion(
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/** @deprecated Use {@link VerifyHostAssertion}. */
|
|
76
|
+
export function verifyHostAssertion(
|
|
77
|
+
assertion: string | undefined,
|
|
78
|
+
hostPublicKeyPem: string | undefined,
|
|
79
|
+
expectedAudience: string,
|
|
80
|
+
): HostAssertionResult {
|
|
81
|
+
return VerifyHostAssertion(assertion, hostPublicKeyPem, expectedAudience);
|
|
82
|
+
}
|
|
83
|
+
|
|
75
84
|
/** Pulls the visitor identity from a verified host-assertion payload (delegates to the provider). */
|
|
76
|
-
export function
|
|
85
|
+
export function ExtractHostIdentity(payload: jwt.JwtPayload): HostAssertedIdentity {
|
|
77
86
|
const info = hostIdentityProvider.extractUserInfo(payload);
|
|
78
87
|
return {
|
|
79
88
|
email: info.email ?? '',
|
|
@@ -82,3 +91,8 @@ export function extractHostIdentity(payload: jwt.JwtPayload): HostAssertedIdenti
|
|
|
82
91
|
hostUserId: typeof payload.sub === 'string' ? payload.sub : undefined,
|
|
83
92
|
};
|
|
84
93
|
}
|
|
94
|
+
|
|
95
|
+
/** @deprecated Use {@link ExtractHostIdentity}. */
|
|
96
|
+
export function extractHostIdentity(payload: jwt.JwtPayload): HostAssertedIdentity {
|
|
97
|
+
return ExtractHostIdentity(payload);
|
|
98
|
+
}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export * from './widgetCore.js';
|
|
6
6
|
export {
|
|
7
|
-
verifyHostAssertion,
|
|
8
|
-
extractHostIdentity,
|
|
7
|
+
VerifyHostAssertion, verifyHostAssertion,
|
|
8
|
+
ExtractHostIdentity, extractHostIdentity,
|
|
9
9
|
type HostAssertedIdentity,
|
|
10
10
|
type HostAssertionResult,
|
|
11
11
|
type HostAssertionError,
|
|
12
12
|
} from './host-identity.js';
|
|
13
13
|
export { WidgetSessionService } from './WidgetSessionService.js';
|
|
14
14
|
export type { MintGuestSessionInput, MintGuestSessionResult, WidgetMintAuditContext } from './WidgetSessionService.js';
|
|
15
|
-
export { createWidgetHandler, WIDGET_MOUNT_PATH } from './WidgetRouter.js';
|
|
15
|
+
export { CreateWidgetHandler, createWidgetHandler, WIDGET_MOUNT_PATH } from './WidgetRouter.js';
|
|
@@ -32,14 +32,14 @@ const AGENT_NOTES_ENTITY = 'MJ: AI Agent Notes';
|
|
|
32
32
|
|
|
33
33
|
/** A resolved polymorphic identity: the entity the visitor maps to, and that record's id. */
|
|
34
34
|
export interface ResolvedVisitorIdentity {
|
|
35
|
-
entityId: string;
|
|
36
|
-
recordId: string;
|
|
35
|
+
entityId: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
36
|
+
recordId: string; // case-violation-ok-legacy-back-compat: the type crosses a serialization boundary (JSON / HTTP body), so this member name is part of a wire or on-disk shape
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/** The deployment-configurable resolution target (defaults to the core `Users` entity keyed by `Email`). */
|
|
40
40
|
export interface IdentityResolutionTarget {
|
|
41
|
-
entityName?: string;
|
|
42
|
-
|
|
41
|
+
entityName?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
42
|
+
EmailField?: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -47,7 +47,7 @@ export interface IdentityResolutionTarget {
|
|
|
47
47
|
* target (default: the `Users` entity keyed by `Email`). Returns undefined when no record matches — the
|
|
48
48
|
* visitor simply stays anonymous. Never throws; email is escaped for the filter literal.
|
|
49
49
|
*/
|
|
50
|
-
export async function
|
|
50
|
+
export async function ResolveIdentityByEmail(
|
|
51
51
|
email: string,
|
|
52
52
|
contextUser: UserInfo,
|
|
53
53
|
provider: IMetadataProvider,
|
|
@@ -59,7 +59,7 @@ export async function resolveIdentityByEmail(
|
|
|
59
59
|
return undefined;
|
|
60
60
|
}
|
|
61
61
|
const entityName = target?.entityName?.trim() || 'Users';
|
|
62
|
-
const emailField = target?.
|
|
62
|
+
const emailField = target?.EmailField?.trim() || 'Email';
|
|
63
63
|
const entityInfo = provider.EntityByName(entityName);
|
|
64
64
|
if (!entityInfo) {
|
|
65
65
|
LogError(`[VisitorIdentity] identity-resolution entity '${entityName}' not found in metadata.`);
|
|
@@ -103,6 +103,16 @@ export async function resolveIdentityByEmail(
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/** @deprecated Use {@link ResolveIdentityByEmail}. */
|
|
107
|
+
export async function resolveIdentityByEmail(
|
|
108
|
+
email: string,
|
|
109
|
+
contextUser: UserInfo,
|
|
110
|
+
provider: IMetadataProvider,
|
|
111
|
+
target?: IdentityResolutionTarget,
|
|
112
|
+
): Promise<ResolvedVisitorIdentity | undefined> {
|
|
113
|
+
return ResolveIdentityByEmail(email, contextUser, provider, target);
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
/** Loads every conversation sharing a VisitorKey within one application (entity objects, for mutation). */
|
|
107
117
|
async function loadVisitorConversations(
|
|
108
118
|
visitorKey: string,
|
|
@@ -134,7 +144,7 @@ async function loadVisitorConversations(
|
|
|
134
144
|
*
|
|
135
145
|
* @returns the number of conversations stamped (0 when nothing matched the key).
|
|
136
146
|
*/
|
|
137
|
-
export async function
|
|
147
|
+
export async function MergeVisitorIdentity(args: {
|
|
138
148
|
visitorKey: string;
|
|
139
149
|
applicationId: string;
|
|
140
150
|
identity: ResolvedVisitorIdentity;
|
|
@@ -174,6 +184,17 @@ export async function mergeVisitorIdentity(args: {
|
|
|
174
184
|
}
|
|
175
185
|
}
|
|
176
186
|
|
|
187
|
+
/** @deprecated Use {@link MergeVisitorIdentity}. */
|
|
188
|
+
export async function mergeVisitorIdentity(args: {
|
|
189
|
+
visitorKey: string;
|
|
190
|
+
applicationId: string;
|
|
191
|
+
identity: ResolvedVisitorIdentity;
|
|
192
|
+
contextUser: UserInfo;
|
|
193
|
+
provider: IMetadataProvider;
|
|
194
|
+
}): Promise<number> {
|
|
195
|
+
return MergeVisitorIdentity(args);
|
|
196
|
+
}
|
|
197
|
+
|
|
177
198
|
/** Re-keys notes scoped to `(Conversations entity, conversationId)` onto the resolved pair. */
|
|
178
199
|
async function rekeyAnonymousNotes(
|
|
179
200
|
conversationIds: string[],
|
|
@@ -217,7 +238,7 @@ async function rekeyAnonymousNotes(
|
|
|
217
238
|
*
|
|
218
239
|
* @returns a summary of what was archived/cleared.
|
|
219
240
|
*/
|
|
220
|
-
export async function
|
|
241
|
+
export async function ForgetVisitor(args: {
|
|
221
242
|
visitorKey: string;
|
|
222
243
|
applicationId: string;
|
|
223
244
|
contextUser: UserInfo;
|
|
@@ -271,3 +292,13 @@ export async function forgetVisitor(args: {
|
|
|
271
292
|
}
|
|
272
293
|
return { notesArchived, conversationsCleared };
|
|
273
294
|
}
|
|
295
|
+
|
|
296
|
+
/** @deprecated Use {@link ForgetVisitor}. */
|
|
297
|
+
export async function forgetVisitor(args: {
|
|
298
|
+
visitorKey: string;
|
|
299
|
+
applicationId: string;
|
|
300
|
+
contextUser: UserInfo;
|
|
301
|
+
provider: IMetadataProvider;
|
|
302
|
+
}): Promise<{ notesArchived: number; conversationsCleared: number }> {
|
|
303
|
+
return ForgetVisitor(args);
|
|
304
|
+
}
|