@memberjunction/server 6.2.0-edge.6 → 6.2.0-edge.8
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/README.md +69 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/agentSessions/BridgeHostInstance.d.ts +8 -3
- package/dist/agentSessions/BridgeHostInstance.d.ts.map +1 -1
- package/dist/agentSessions/BridgeHostInstance.js +14 -4
- package/dist/agentSessions/BridgeHostInstance.js.map +1 -1
- package/dist/agentSessions/HandoffOfferExpiry.d.ts +10 -0
- package/dist/agentSessions/HandoffOfferExpiry.d.ts.map +1 -0
- package/dist/agentSessions/HandoffOfferExpiry.js +18 -0
- package/dist/agentSessions/HandoffOfferExpiry.js.map +1 -0
- package/dist/agentSessions/ReturningVisitorRecap.js +1 -0
- package/dist/agentSessions/ReturningVisitorRecap.js.map +1 -1
- package/dist/agentSessions/SessionJanitor.d.ts +31 -8
- package/dist/agentSessions/SessionJanitor.d.ts.map +1 -1
- package/dist/agentSessions/SessionJanitor.js +85 -41
- package/dist/agentSessions/SessionJanitor.js.map +1 -1
- package/dist/agentSessions/SessionManager.d.ts +14 -4
- package/dist/agentSessions/SessionManager.d.ts.map +1 -1
- package/dist/agentSessions/SessionManager.js +28 -4
- package/dist/agentSessions/SessionManager.js.map +1 -1
- package/dist/agentSessions/conversationBrowsers.d.ts +61 -0
- package/dist/agentSessions/conversationBrowsers.d.ts.map +1 -0
- package/dist/agentSessions/conversationBrowsers.js +118 -0
- package/dist/agentSessions/conversationBrowsers.js.map +1 -0
- package/dist/agentSessions/sessionDeadline.d.ts +43 -0
- package/dist/agentSessions/sessionDeadline.d.ts.map +1 -0
- package/dist/agentSessions/sessionDeadline.js +68 -0
- package/dist/agentSessions/sessionDeadline.js.map +1 -0
- package/dist/auth/APIKeyScopeAuth.d.ts.map +1 -1
- package/dist/auth/APIKeyScopeAuth.js +5 -4
- package/dist/auth/APIKeyScopeAuth.js.map +1 -1
- package/dist/auth/loginEmailResolution.d.ts +41 -0
- package/dist/auth/loginEmailResolution.d.ts.map +1 -0
- package/dist/auth/loginEmailResolution.js +47 -0
- package/dist/auth/loginEmailResolution.js.map +1 -0
- package/dist/auth/magicLink/MagicLinkKeys.d.ts +50 -2
- package/dist/auth/magicLink/MagicLinkKeys.d.ts.map +1 -1
- package/dist/auth/magicLink/MagicLinkKeys.js +129 -12
- package/dist/auth/magicLink/MagicLinkKeys.js.map +1 -1
- package/dist/auth/magicLink/MagicLinkRouter.d.ts +3 -0
- package/dist/auth/magicLink/MagicLinkRouter.d.ts.map +1 -1
- package/dist/auth/magicLink/MagicLinkRouter.js +23 -5
- package/dist/auth/magicLink/MagicLinkRouter.js.map +1 -1
- package/dist/auth/magicLink/MagicLinkService.d.ts +39 -5
- package/dist/auth/magicLink/MagicLinkService.d.ts.map +1 -1
- package/dist/auth/magicLink/MagicLinkService.js +221 -9
- package/dist/auth/magicLink/MagicLinkService.js.map +1 -1
- package/dist/auth/magicLink/index.d.ts +1 -1
- package/dist/auth/magicLink/index.d.ts.map +1 -1
- package/dist/auth/magicLink/index.js +1 -1
- package/dist/auth/magicLink/index.js.map +1 -1
- package/dist/auth/magicLink/redeemLanding.d.ts +2 -2
- package/dist/auth/magicLink/redeemLanding.d.ts.map +1 -1
- package/dist/auth/magicLink/redeemLanding.js +7 -4
- package/dist/auth/magicLink/redeemLanding.js.map +1 -1
- package/dist/auth/magicLink/types.d.ts +27 -3
- package/dist/auth/magicLink/types.d.ts.map +1 -1
- package/dist/auth/magicLink/types.js +0 -4
- package/dist/auth/magicLink/types.js.map +1 -1
- package/dist/auth/newUsers.d.ts.map +1 -1
- package/dist/auth/newUsers.js +1 -0
- package/dist/auth/newUsers.js.map +1 -1
- package/dist/backgroundSweepConfigUnits.d.ts +231 -0
- package/dist/backgroundSweepConfigUnits.d.ts.map +1 -0
- package/dist/backgroundSweepConfigUnits.js +180 -0
- package/dist/backgroundSweepConfigUnits.js.map +1 -0
- package/dist/broadcast/BaseCacheInvalidationBroadcastProvider.d.ts.map +1 -1
- package/dist/broadcast/BaseCacheInvalidationBroadcastProvider.js +2 -1
- package/dist/broadcast/BaseCacheInvalidationBroadcastProvider.js.map +1 -1
- package/dist/config.d.ts +906 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +59 -0
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +41 -12
- package/dist/context.js.map +1 -1
- package/dist/coreRoutes.d.ts +3 -1
- package/dist/coreRoutes.d.ts.map +1 -1
- package/dist/coreRoutes.js +6 -4
- package/dist/coreRoutes.js.map +1 -1
- package/dist/generated/graphql-schemas/__mj.d.ts +1072 -5
- package/dist/generated/graphql-schemas/__mj.d.ts.map +1 -1
- package/dist/generated/graphql-schemas/__mj.js +10174 -4618
- package/dist/generated/graphql-schemas/__mj.js.map +1 -1
- package/dist/generic/OrphanedConversationDetailReconciler.d.ts +11 -0
- package/dist/generic/OrphanedConversationDetailReconciler.d.ts.map +1 -1
- package/dist/generic/OrphanedConversationDetailReconciler.js +27 -1
- package/dist/generic/OrphanedConversationDetailReconciler.js.map +1 -1
- package/dist/generic/ResolverBase.d.ts +50 -5
- package/dist/generic/ResolverBase.d.ts.map +1 -1
- package/dist/generic/ResolverBase.js +329 -132
- package/dist/generic/ResolverBase.js.map +1 -1
- package/dist/generic/RunViewResolver.d.ts +4 -0
- package/dist/generic/RunViewResolver.d.ts.map +1 -1
- package/dist/generic/RunViewResolver.js +47 -7
- package/dist/generic/RunViewResolver.js.map +1 -1
- package/dist/globalCors.d.ts.map +1 -1
- package/dist/globalCors.js +1 -0
- package/dist/globalCors.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +201 -43
- package/dist/index.js.map +1 -1
- package/dist/integration/ConnectionPause.d.ts +121 -0
- package/dist/integration/ConnectionPause.d.ts.map +1 -0
- package/dist/integration/ConnectionPause.js +183 -0
- package/dist/integration/ConnectionPause.js.map +1 -0
- package/dist/integration/CustomColumnPromoter.d.ts +72 -6
- package/dist/integration/CustomColumnPromoter.d.ts.map +1 -1
- package/dist/integration/CustomColumnPromoter.js +87 -46
- package/dist/integration/CustomColumnPromoter.js.map +1 -1
- package/dist/integration/EntityMapLifecycle.d.ts +78 -4
- package/dist/integration/EntityMapLifecycle.d.ts.map +1 -1
- package/dist/integration/EntityMapLifecycle.js +199 -5
- package/dist/integration/EntityMapLifecycle.js.map +1 -1
- package/dist/integration/InactiveRowWarnings.d.ts +31 -0
- package/dist/integration/InactiveRowWarnings.d.ts.map +1 -1
- package/dist/integration/InactiveRowWarnings.js +29 -0
- package/dist/integration/InactiveRowWarnings.js.map +1 -1
- package/dist/integration/ObjectNamesByID.d.ts +28 -0
- package/dist/integration/ObjectNamesByID.d.ts.map +1 -0
- package/dist/integration/ObjectNamesByID.js +87 -0
- package/dist/integration/ObjectNamesByID.js.map +1 -0
- package/dist/integration/PostRestartIntrospect.d.ts +26 -0
- package/dist/integration/PostRestartIntrospect.d.ts.map +1 -0
- package/dist/integration/PostRestartIntrospect.js +27 -0
- package/dist/integration/PostRestartIntrospect.js.map +1 -0
- package/dist/integration/RSUPostRestartProgress.d.ts +176 -0
- package/dist/integration/RSUPostRestartProgress.d.ts.map +1 -0
- package/dist/integration/RSUPostRestartProgress.js +323 -0
- package/dist/integration/RSUPostRestartProgress.js.map +1 -0
- package/dist/integration/RSUProgressBridge.d.ts +41 -2
- package/dist/integration/RSUProgressBridge.d.ts.map +1 -1
- package/dist/integration/RSUProgressBridge.js +84 -1
- package/dist/integration/RSUProgressBridge.js.map +1 -1
- package/dist/integration/RunArtifactAuthorization.d.ts +39 -0
- package/dist/integration/RunArtifactAuthorization.d.ts.map +1 -0
- package/dist/integration/RunArtifactAuthorization.js +45 -0
- package/dist/integration/RunArtifactAuthorization.js.map +1 -0
- package/dist/integration/SchemaRefreshLaunch.d.ts +9 -0
- package/dist/integration/SchemaRefreshLaunch.d.ts.map +1 -1
- package/dist/integration/SchemaRefreshLaunch.js +3 -2
- package/dist/integration/SchemaRefreshLaunch.js.map +1 -1
- package/dist/integration/ScopedFieldsForBuild.d.ts +46 -0
- package/dist/integration/ScopedFieldsForBuild.d.ts.map +1 -0
- package/dist/integration/ScopedFieldsForBuild.js +91 -0
- package/dist/integration/ScopedFieldsForBuild.js.map +1 -0
- package/dist/integration/TargetConfigGuard.d.ts +40 -0
- package/dist/integration/TargetConfigGuard.d.ts.map +1 -0
- package/dist/integration/TargetConfigGuard.js +40 -0
- package/dist/integration/TargetConfigGuard.js.map +1 -0
- package/dist/logging/StartupLogger.d.ts +50 -0
- package/dist/logging/StartupLogger.d.ts.map +1 -1
- package/dist/logging/StartupLogger.js +15 -22
- package/dist/logging/StartupLogger.js.map +1 -1
- package/dist/middleware/BaseServerMiddleware.d.ts +21 -3
- package/dist/middleware/BaseServerMiddleware.d.ts.map +1 -1
- package/dist/middleware/BaseServerMiddleware.js +4 -2
- package/dist/middleware/BaseServerMiddleware.js.map +1 -1
- package/dist/realtimeSessions/ownedRealtimeSession.d.ts.map +1 -1
- package/dist/realtimeSessions/ownedRealtimeSession.js +2 -3
- package/dist/realtimeSessions/ownedRealtimeSession.js.map +1 -1
- package/dist/realtimeSessions/sessionAccess.d.ts +15 -0
- package/dist/realtimeSessions/sessionAccess.d.ts.map +1 -1
- package/dist/realtimeSessions/sessionAccess.js +22 -0
- package/dist/realtimeSessions/sessionAccess.js.map +1 -1
- package/dist/realtimeWidget/WidgetSessionService.d.ts.map +1 -1
- package/dist/realtimeWidget/WidgetSessionService.js +2 -0
- package/dist/realtimeWidget/WidgetSessionService.js.map +1 -1
- package/dist/realtimeWidget/visitorIdentity.d.ts.map +1 -1
- package/dist/realtimeWidget/visitorIdentity.js +1 -0
- package/dist/realtimeWidget/visitorIdentity.js.map +1 -1
- package/dist/realtimeWidget/widgetCore.d.ts.map +1 -1
- package/dist/realtimeWidget/widgetCore.js +4 -7
- package/dist/realtimeWidget/widgetCore.js.map +1 -1
- package/dist/realtimeWidget/widgetGuestElevation.js +1 -0
- package/dist/realtimeWidget/widgetGuestElevation.js.map +1 -1
- package/dist/requestOrigin.d.ts +22 -0
- package/dist/requestOrigin.d.ts.map +1 -0
- package/dist/requestOrigin.js +60 -0
- package/dist/requestOrigin.js.map +1 -0
- package/dist/resolvers/AgentRunStatusPublisher.d.ts +10 -0
- package/dist/resolvers/AgentRunStatusPublisher.d.ts.map +1 -1
- package/dist/resolvers/AgentRunStatusPublisher.js +18 -2
- package/dist/resolvers/AgentRunStatusPublisher.js.map +1 -1
- package/dist/resolvers/AgentSessionResolver.d.ts.map +1 -1
- package/dist/resolvers/AgentSessionResolver.js +6 -2
- package/dist/resolvers/AgentSessionResolver.js.map +1 -1
- package/dist/resolvers/AutotagPipelineResolver.d.ts +1 -1
- package/dist/resolvers/AutotagPipelineResolver.d.ts.map +1 -1
- package/dist/resolvers/AutotagPipelineResolver.js +61 -16
- package/dist/resolvers/AutotagPipelineResolver.js.map +1 -1
- package/dist/resolvers/ConversationRunEventsResolver.d.ts.map +1 -1
- package/dist/resolvers/ConversationRunEventsResolver.js +2 -0
- package/dist/resolvers/ConversationRunEventsResolver.js.map +1 -1
- package/dist/resolvers/ExecuteRemoteOperationResolver.d.ts +6 -0
- package/dist/resolvers/ExecuteRemoteOperationResolver.d.ts.map +1 -1
- package/dist/resolvers/ExecuteRemoteOperationResolver.js +30 -7
- package/dist/resolvers/ExecuteRemoteOperationResolver.js.map +1 -1
- package/dist/resolvers/GetDataResolver.d.ts.map +1 -1
- package/dist/resolvers/GetDataResolver.js +34 -13
- package/dist/resolvers/GetDataResolver.js.map +1 -1
- package/dist/resolvers/InfoResolver.js +1 -1
- package/dist/resolvers/InfoResolver.js.map +1 -1
- package/dist/resolvers/IntegrationDiscoveryResolver.d.ts +401 -11
- package/dist/resolvers/IntegrationDiscoveryResolver.d.ts.map +1 -1
- package/dist/resolvers/IntegrationDiscoveryResolver.js +2690 -1305
- package/dist/resolvers/IntegrationDiscoveryResolver.js.map +1 -1
- package/dist/resolvers/MCPResolver.d.ts.map +1 -1
- package/dist/resolvers/MCPResolver.js +13 -2
- package/dist/resolvers/MCPResolver.js.map +1 -1
- package/dist/resolvers/QuerySystemUserResolver.d.ts +38 -1
- package/dist/resolvers/QuerySystemUserResolver.d.ts.map +1 -1
- package/dist/resolvers/QuerySystemUserResolver.js +181 -88
- package/dist/resolvers/QuerySystemUserResolver.js.map +1 -1
- package/dist/resolvers/RealtimeBridgeResolver.d.ts.map +1 -1
- package/dist/resolvers/RealtimeBridgeResolver.js +1 -0
- package/dist/resolvers/RealtimeBridgeResolver.js.map +1 -1
- package/dist/resolvers/RealtimeClientSessionResolver.d.ts +6 -0
- package/dist/resolvers/RealtimeClientSessionResolver.d.ts.map +1 -1
- package/dist/resolvers/RealtimeClientSessionResolver.js +36 -5
- package/dist/resolvers/RealtimeClientSessionResolver.js.map +1 -1
- package/dist/resolvers/RemoteBrowserActionResolver.d.ts +62 -10
- package/dist/resolvers/RemoteBrowserActionResolver.d.ts.map +1 -1
- package/dist/resolvers/RemoteBrowserActionResolver.js +217 -34
- package/dist/resolvers/RemoteBrowserActionResolver.js.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.d.ts +24 -8
- package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.js +185 -67
- package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
- package/dist/resolvers/RunAIPromptResolver.d.ts +5 -3
- package/dist/resolvers/RunAIPromptResolver.d.ts.map +1 -1
- package/dist/resolvers/RunAIPromptResolver.js +19 -18
- package/dist/resolvers/RunAIPromptResolver.js.map +1 -1
- package/dist/resolvers/RunTemplateResolver.d.ts.map +1 -1
- package/dist/resolvers/RunTemplateResolver.js +3 -1
- package/dist/resolvers/RunTemplateResolver.js.map +1 -1
- package/dist/resolvers/SqlLoggingConfigResolver.d.ts.map +1 -1
- package/dist/resolvers/SqlLoggingConfigResolver.js +7 -8
- package/dist/resolvers/SqlLoggingConfigResolver.js.map +1 -1
- package/dist/resolvers/TagGovernanceResolver.d.ts +12 -0
- package/dist/resolvers/TagGovernanceResolver.d.ts.map +1 -1
- package/dist/resolvers/TagGovernanceResolver.js +84 -0
- package/dist/resolvers/TagGovernanceResolver.js.map +1 -1
- package/dist/resolvers/TelemetryResolver.d.ts +13 -8
- package/dist/resolvers/TelemetryResolver.d.ts.map +1 -1
- package/dist/resolvers/TelemetryResolver.js +40 -9
- package/dist/resolvers/TelemetryResolver.js.map +1 -1
- package/dist/resolvers/meetingRecordingRegistration.d.ts.map +1 -1
- package/dist/resolvers/meetingRecordingRegistration.js +2 -0
- package/dist/resolvers/meetingRecordingRegistration.js.map +1 -1
- package/dist/resolvers/meetings/meetingMutations.d.ts.map +1 -1
- package/dist/resolvers/meetings/meetingMutations.js +34 -4
- package/dist/resolvers/meetings/meetingMutations.js.map +1 -1
- package/dist/rest/MediaAccessKeys.d.ts.map +1 -1
- package/dist/rest/MediaAccessKeys.js +6 -2
- package/dist/rest/MediaAccessKeys.js.map +1 -1
- package/dist/rest/OAuthCallbackHandler.d.ts.map +1 -1
- package/dist/rest/OAuthCallbackHandler.js +11 -5
- package/dist/rest/OAuthCallbackHandler.js.map +1 -1
- package/dist/rest/RealtimeRecordingHandler.d.ts +3 -3
- package/dist/rest/RealtimeRecordingHandler.d.ts.map +1 -1
- package/dist/rest/RealtimeRecordingHandler.js +2 -4
- package/dist/rest/RealtimeRecordingHandler.js.map +1 -1
- package/dist/rest/ViewOperationsHandler.d.ts.map +1 -1
- package/dist/rest/ViewOperationsHandler.js +2 -1
- package/dist/rest/ViewOperationsHandler.js.map +1 -1
- package/dist/rest/setupRESTEndpoints.d.ts +3 -1
- package/dist/rest/setupRESTEndpoints.d.ts.map +1 -1
- package/dist/rest/setupRESTEndpoints.js +11 -2
- package/dist/rest/setupRESTEndpoints.js.map +1 -1
- package/dist/services/DurableEntityActionTaskSubmitter.d.ts.map +1 -1
- package/dist/services/DurableEntityActionTaskSubmitter.js +6 -1
- package/dist/services/DurableEntityActionTaskSubmitter.js.map +1 -1
- package/dist/services/TaskGraphActionRunner.d.ts.map +1 -1
- package/dist/services/TaskGraphActionRunner.js +2 -26
- package/dist/services/TaskGraphActionRunner.js.map +1 -1
- package/dist/services/TaskGraphAgentRunner.d.ts +6 -0
- package/dist/services/TaskGraphAgentRunner.d.ts.map +1 -1
- package/dist/services/TaskGraphAgentRunner.js +38 -0
- package/dist/services/TaskGraphAgentRunner.js.map +1 -1
- package/dist/services/TaskGraphContinuationDeliverer.d.ts.map +1 -1
- package/dist/services/TaskGraphContinuationDeliverer.js +1 -0
- package/dist/services/TaskGraphContinuationDeliverer.js.map +1 -1
- package/dist/services/WorkQueueHostService.d.ts +2 -1
- package/dist/services/WorkQueueHostService.d.ts.map +1 -1
- package/dist/services/WorkQueueHostService.js +19 -4
- package/dist/services/WorkQueueHostService.js.map +1 -1
- package/dist/services/workQueueConfig.d.ts +2 -2
- package/dist/services/workQueueConfig.js +5 -5
- package/dist/services/workQueueConfig.js.map +1 -1
- package/dist/sharedCache.js +1 -1
- package/dist/sharedCache.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +55 -2
- package/dist/util.js.map +1 -1
- package/package.json +107 -100
- package/src/__tests__/APIKeyScopeAuth.test.ts +4 -8
- package/src/__tests__/ActiveOperations.test.ts +68 -0
- package/src/__tests__/AgentSessionResolver.ownership.test.ts +13 -0
- package/src/__tests__/AssertTargetConfigs.test.ts +75 -0
- package/src/__tests__/BatchApplyParity.test.ts +109 -0
- package/src/__tests__/BridgeHostInstance.test.ts +42 -0
- package/src/__tests__/CollectInactiveRowWarnings.test.ts +115 -0
- package/src/__tests__/ConnectionPause.test.ts +192 -0
- package/src/__tests__/ConnectionPauseResolver.test.ts +166 -0
- package/src/__tests__/ConnectionPauseSave.test.ts +143 -0
- package/src/__tests__/CustomColumnPromoterCompletion.test.ts +142 -0
- package/src/__tests__/DeleteConnectionRemovesPerConnectionCatalog.test.ts +51 -0
- package/src/__tests__/DetachedDiscoveryStart.test.ts +65 -0
- package/src/__tests__/DurableEntityActionTaskSubmitter.test.ts +73 -0
- package/src/__tests__/EntityMapLifecycle.rekey.test.ts +252 -0
- package/src/__tests__/ExecuteRemoteOperationResolver.test.ts +213 -0
- package/src/__tests__/HandoffOfferExpiry.test.ts +40 -0
- package/src/__tests__/IntegrationRunArtifactAuthorization.test.ts +126 -0
- package/src/__tests__/MagicLinkKeys.test.ts +102 -0
- package/src/__tests__/MediaAccessKeys.test.ts +57 -10
- package/src/__tests__/NewArrivalsDefaultDisabled.test.ts +50 -0
- package/src/__tests__/ObjectNamesByID.test.ts +176 -0
- package/src/__tests__/PostRestartMapsInCatalogScope.test.ts +146 -0
- package/src/__tests__/QuerySystemUserResolver.childRows.test.ts +80 -0
- package/src/__tests__/QuerySystemUserResolver.collision.test.ts +200 -0
- package/src/__tests__/QuerySystemUserResolver.permissions.test.ts +132 -0
- package/src/__tests__/RSUPostRestartProgress.test.ts +343 -0
- package/src/__tests__/RSUProgressBridge.test.ts +188 -5
- package/src/__tests__/RSUStartupSweepWiring.test.ts +30 -0
- package/src/__tests__/ReactivateRefreshMessage.test.ts +10 -3
- package/src/__tests__/RealtimeClientSessionResolver.test.ts +22 -0
- package/src/__tests__/{RefreshAdoptsNewColumns.test.ts → RefreshReportsNewColumns.test.ts} +25 -16
- package/src/__tests__/RemoteBrowserActionRecovery.test.ts +287 -0
- package/src/__tests__/RemoteBrowserActionResolver.goalRunLink.test.ts +3 -0
- package/src/__tests__/RemoteBrowserActionResolver.ownership.test.ts +6 -4
- package/src/__tests__/RemoteBrowserAudioStream.test.ts +3 -0
- package/src/__tests__/RemoteBrowserSnapshot.test.ts +3 -0
- package/src/__tests__/ResolverBase.clientOldValues.test.ts +327 -26
- package/src/__tests__/ResolverBase.diagnosticSenderRegistrations.test.ts +26 -0
- package/src/__tests__/ResolverBase.encryptedApiZeroReencrypt.test.ts +307 -0
- package/src/__tests__/ResolverBase.entityMessageRelay.test.ts +53 -2
- package/src/__tests__/ResolverBase.includeBinaryFields.test.ts +60 -0
- package/src/__tests__/RunAIAgentResolver.branch.test.ts +4 -0
- package/src/__tests__/RunAIAgentResolver.consultPredecessor.test.ts +289 -0
- package/src/__tests__/RunAIAgentResolver.handoff.test.ts +649 -0
- package/src/__tests__/RunAIAgentResolver.historyFrom.test.ts +2 -0
- package/src/__tests__/RunAIAgentResolver.runDataGuard.test.ts +2 -0
- package/src/__tests__/RunAIAgentResolver.stoppedPredecessor.test.ts +87 -12
- package/src/__tests__/RunAIAgentResolver.streaming.test.ts +28 -4
- package/src/__tests__/SchemaEvolutionCustomColumns.test.ts +119 -0
- package/src/__tests__/SchemaRefreshLaunch.test.ts +24 -2
- package/src/__tests__/ScopedFieldsForBuild.test.ts +192 -0
- package/src/__tests__/SessionJanitor.test.ts +195 -4
- package/src/__tests__/SessionManager.test.ts +69 -0
- package/src/__tests__/TagGovernanceAndAutotagResolvers.test.ts +261 -0
- package/src/__tests__/TagGovernanceResolver.test.ts +60 -2
- package/src/__tests__/TaskGraphActionRunner.durablePayload.test.ts +2 -2
- package/src/__tests__/TaskGraphAgentRunner.test.ts +272 -16
- package/src/__tests__/ViewOperationsHandler.test.ts +2 -5
- package/src/__tests__/WorkQueueHostService.test.ts +25 -7
- package/src/__tests__/backgroundSweepConfigUnits.test.ts +153 -0
- package/src/__tests__/contextRequestOrigin.test.ts +105 -0
- package/src/__tests__/conversationBrowsers.test.ts +62 -0
- package/src/__tests__/globalCors.test.ts +12 -0
- package/src/__tests__/magicLinkExtensionCapabilities.test.ts +413 -0
- package/src/__tests__/orphanedConversationDetailReconciler.start.test.ts +82 -0
- package/src/__tests__/ownedRealtimeSession.test.ts +14 -0
- package/src/__tests__/realtimeRecordingHandler.test.ts +7 -2
- package/src/__tests__/realtimeSessions/sessionAccess.test.ts +79 -1
- package/src/__tests__/requestOrigin.test.ts +104 -0
- package/src/__tests__/review-capture-valid-token-log.test.ts +98 -0
- package/src/__tests__/runStreams.fieldSecurity.test.ts +5 -5
- package/src/__tests__/securityHardeningPr6034.test.ts +120 -0
- package/src/__tests__/sessionDeadline.test.ts +51 -0
- package/src/__tests__/sharedCache.test.ts +11 -0
- package/src/__tests__/unifiedAuth.test.ts +73 -1
- package/src/agentSessions/BridgeHostInstance.ts +20 -5
- package/src/agentSessions/HandoffOfferExpiry.ts +18 -0
- package/src/agentSessions/ReturningVisitorRecap.ts +1 -0
- package/src/agentSessions/SessionJanitor.ts +92 -42
- package/src/agentSessions/SessionManager.ts +38 -8
- package/src/agentSessions/conversationBrowsers.ts +143 -0
- package/src/agentSessions/sessionDeadline.ts +81 -0
- package/src/auth/APIKeyScopeAuth.ts +5 -4
- package/src/auth/__tests__/loginEmailResolution.test.ts +67 -0
- package/src/auth/loginEmailResolution.ts +67 -0
- package/src/auth/magicLink/MagicLinkKeys.ts +146 -14
- package/src/auth/magicLink/MagicLinkRouter.ts +33 -6
- package/src/auth/magicLink/MagicLinkService.ts +250 -10
- package/src/auth/magicLink/index.ts +1 -1
- package/src/auth/magicLink/redeemLanding.ts +7 -4
- package/src/auth/magicLink/types.ts +28 -3
- package/src/auth/newUsers.ts +1 -0
- package/src/backgroundSweepConfigUnits.ts +213 -0
- package/src/broadcast/BaseCacheInvalidationBroadcastProvider.ts +2 -1
- package/src/config.ts +69 -0
- package/src/context.ts +46 -15
- package/src/coreRoutes.ts +14 -7
- package/src/generated/graphql-schemas/__mj.ts +10360 -6479
- package/src/generic/OrphanedConversationDetailReconciler.ts +32 -1
- package/src/generic/ResolverBase.ts +422 -143
- package/src/generic/RunViewResolver.ts +96 -49
- package/src/globalCors.ts +1 -0
- package/src/index.ts +246 -44
- package/src/integration/ConnectionPause.ts +222 -0
- package/src/integration/CustomColumnPromoter.ts +123 -53
- package/src/integration/EntityMapLifecycle.ts +229 -6
- package/src/integration/InactiveRowWarnings.ts +50 -0
- package/src/integration/ObjectNamesByID.ts +97 -0
- package/src/integration/PostRestartIntrospect.ts +49 -0
- package/src/integration/RSUPostRestartProgress.ts +359 -0
- package/src/integration/RSUProgressBridge.ts +85 -2
- package/src/integration/RunArtifactAuthorization.ts +65 -0
- package/src/integration/SchemaRefreshLaunch.ts +12 -2
- package/src/integration/ScopedFieldsForBuild.ts +113 -0
- package/src/integration/TargetConfigGuard.ts +71 -0
- package/src/logging/StartupLogger.ts +24 -0
- package/src/middleware/BaseServerMiddleware.ts +20 -3
- package/src/realtimeSessions/ownedRealtimeSession.ts +2 -6
- package/src/realtimeSessions/sessionAccess.ts +30 -0
- package/src/realtimeWidget/WidgetSessionService.ts +2 -0
- package/src/realtimeWidget/visitorIdentity.ts +1 -0
- package/src/realtimeWidget/widgetCore.ts +4 -8
- package/src/realtimeWidget/widgetGuestElevation.ts +1 -0
- package/src/requestOrigin.ts +64 -0
- package/src/resolvers/AgentRunStatusPublisher.ts +27 -2
- package/src/resolvers/AgentSessionResolver.ts +6 -2
- package/src/resolvers/AutotagPipelineResolver.ts +59 -14
- package/src/resolvers/ConversationRunEventsResolver.ts +2 -0
- package/src/resolvers/ExecuteRemoteOperationResolver.ts +41 -9
- package/src/resolvers/GetDataResolver.ts +35 -13
- package/src/resolvers/InfoResolver.ts +1 -1
- package/src/resolvers/IntegrationDiscoveryResolver.ts +1522 -203
- package/src/resolvers/MCPResolver.ts +15 -2
- package/src/resolvers/QuerySystemUserResolver.ts +211 -100
- package/src/resolvers/RealtimeBridgeResolver.ts +1 -0
- package/src/resolvers/RealtimeClientSessionResolver.ts +40 -7
- package/src/resolvers/RemoteBrowserActionResolver.ts +242 -32
- package/src/resolvers/RunAIAgentResolver.ts +265 -86
- package/src/resolvers/RunAIPromptResolver.ts +18 -18
- package/src/resolvers/RunTemplateResolver.ts +3 -1
- package/src/resolvers/SqlLoggingConfigResolver.ts +7 -9
- package/src/resolvers/TagGovernanceResolver.ts +65 -0
- package/src/resolvers/TelemetryResolver.ts +44 -9
- package/src/resolvers/__tests__/GetDataResolver.tokens.test.ts +52 -0
- package/src/resolvers/meetingRecordingRegistration.ts +2 -0
- package/src/resolvers/meetings/meetingMutations.ts +37 -7
- package/src/rest/MediaAccessKeys.ts +6 -2
- package/src/rest/OAuthCallbackHandler.ts +13 -5
- package/src/rest/RealtimeRecordingHandler.ts +5 -9
- package/src/rest/ViewOperationsHandler.ts +2 -1
- package/src/rest/setupRESTEndpoints.ts +11 -2
- package/src/services/DurableEntityActionTaskSubmitter.ts +10 -2
- package/src/services/TaskGraphActionRunner.ts +2 -23
- package/src/services/TaskGraphAgentRunner.ts +43 -0
- package/src/services/TaskGraphContinuationDeliverer.ts +1 -0
- package/src/services/WorkQueueHostService.ts +26 -4
- package/src/services/workQueueConfig.ts +5 -5
- package/src/sharedCache.ts +1 -1
- package/src/types.ts +18 -0
- package/src/util.ts +55 -3
- package/src/services/TaskOrchestration-Integration.md +0 -188
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConnectionPause — what "pause this connection" has to mean, beyond a flag.
|
|
3
|
+
*
|
|
4
|
+
* `IntegrationDeactivateConnection` used to set `IsActive = false` and stop. The engine reads
|
|
5
|
+
* that flag before a sync, so syncs did stop — but nothing else did:
|
|
6
|
+
*
|
|
7
|
+
* - The SCHEDULED jobs kept firing. A sync schedule woke on cron, was refused, and wrote a
|
|
8
|
+
* failed run. Every cron tick, for as long as the connection stayed paused, so a paused
|
|
9
|
+
* connector's history filled with failures it did not cause.
|
|
10
|
+
* - The DISCOVERY schedule kept firing and was NOT refused, because nothing gated discovery
|
|
11
|
+
* on IsActive. A paused connection went on rescanning the vendor on a timer — spending the
|
|
12
|
+
* customer's rate budget, and rewriting the very catalog the pause was meant to freeze.
|
|
13
|
+
* - An IN-FLIGHT sync ran to completion. "Paused" arrived only after the thing the operator
|
|
14
|
+
* was watching had finished.
|
|
15
|
+
*
|
|
16
|
+
* So pause has to touch three things, and resume has to put back exactly what pause took —
|
|
17
|
+
* which is the part that needs state rather than a rule.
|
|
18
|
+
*
|
|
19
|
+
* WHY THE PRIOR STATE IS RECORDED RATHER THAN INFERRED. "Resume = set every schedule Active" is
|
|
20
|
+
* wrong: a connection can legitimately be paused while one of its two schedules was ALREADY off
|
|
21
|
+
* because the operator turned it off weeks ago. Inferring would silently re-enable it, and the
|
|
22
|
+
* first symptom is a sync nobody asked for. So pause records which jobs it actually moved, and
|
|
23
|
+
* resume restores only those.
|
|
24
|
+
*
|
|
25
|
+
* WHY PAUSE IS IDEMPOTENT AT THE RECORD, NOT AT THE WRITE. Deactivating an already-deactivated
|
|
26
|
+
* connection finds every job already Paused, so the set it "moved" is empty. Writing that empty
|
|
27
|
+
* set over the real record is the bug that loses the state — resume would then restore nothing
|
|
28
|
+
* and both schedules would stay off forever, with no error anywhere. {@link DecidePauseWrite}
|
|
29
|
+
* is the guard: the FIRST pause's record stands until a resume consumes it, and a later pause only
|
|
30
|
+
* ever adds to it.
|
|
31
|
+
*
|
|
32
|
+
* Everything here is a pure function over plain values. The resolver owns the reads and writes.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import { UUIDSet } from '@memberjunction/global';
|
|
36
|
+
|
|
37
|
+
/** The two schedule kinds a connection can own. Mirrors ScheduledJob's DriverClass split. */
|
|
38
|
+
export type PausedScheduleKind = 'sync' | 'discovery';
|
|
39
|
+
|
|
40
|
+
/** One schedule that PAUSE moved from Active to Paused, and that RESUME should move back. */
|
|
41
|
+
export interface PausedScheduleRecord {
|
|
42
|
+
/** ScheduledJob.ID */
|
|
43
|
+
ID: string;
|
|
44
|
+
/** Recorded for the operator-facing message only; restoration keys on ID. */
|
|
45
|
+
Kind: PausedScheduleKind;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Minimal shape this module needs from a ScheduledJob row. */
|
|
49
|
+
export interface ScheduleJobState {
|
|
50
|
+
ID: string;
|
|
51
|
+
Status: string | null;
|
|
52
|
+
Kind: PausedScheduleKind;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Key under CompanyIntegration.Configuration where the record lives. */
|
|
56
|
+
export const PAUSED_SCHEDULES_KEY = 'pausedSchedules';
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Which schedules a pause should move, and the record to remember them by.
|
|
60
|
+
*
|
|
61
|
+
* Only jobs that are currently `Active` are moved. A job already `Paused`, or in any other
|
|
62
|
+
* status, is left exactly as found and is deliberately absent from the record — that absence
|
|
63
|
+
* is what stops resume from turning it on.
|
|
64
|
+
*/
|
|
65
|
+
export function DecideSchedulesToPause(jobs: ReadonlyArray<ScheduleJobState>): PausedScheduleRecord[] {
|
|
66
|
+
return jobs
|
|
67
|
+
.filter(j => j.Status === 'Active')
|
|
68
|
+
.map(j => ({ ID: j.ID, Kind: j.Kind }));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Whether this pause's record should be written, given whatever record is already stored.
|
|
73
|
+
*
|
|
74
|
+
* Returns the record to persist, or `null` to leave the stored one untouched. A second pause of
|
|
75
|
+
* an already-paused connection moves nothing, and must not overwrite the first pause's record
|
|
76
|
+
* with its own empty one — see the class comment.
|
|
77
|
+
*
|
|
78
|
+
* A pause that DOES move jobs while a record is stored adds them to it: the stored entries stay
|
|
79
|
+
* exactly as they were, and the new ones are appended by job ID. That happens when a job was
|
|
80
|
+
* created or switched back on while the connection was paused, or when a resume could not clear
|
|
81
|
+
* its record. A job paused here but left out of the record is one resume can never put back.
|
|
82
|
+
*/
|
|
83
|
+
export function DecidePauseWrite(
|
|
84
|
+
stored: ReadonlyArray<PausedScheduleRecord>,
|
|
85
|
+
newlyPaused: ReadonlyArray<PausedScheduleRecord>
|
|
86
|
+
): PausedScheduleRecord[] | null {
|
|
87
|
+
const known = new UUIDSet(stored.map(r => r.ID));
|
|
88
|
+
const added = newlyPaused.filter(r => !known.Has(r.ID));
|
|
89
|
+
if (added.length === 0) return null; // nothing new moved — any stored record stands as it is
|
|
90
|
+
return [...stored, ...added];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Which schedules a resume should re-activate.
|
|
95
|
+
*
|
|
96
|
+
* A recorded job is restored only when it STILL EXISTS and is STILL `Paused`. Both guards matter:
|
|
97
|
+
* a job deleted while the connection was paused must not be resurrected, and a job someone has
|
|
98
|
+
* already moved back to Active must not be written again for no reason. Jobs absent from the
|
|
99
|
+
* record are never touched, however they look now.
|
|
100
|
+
*/
|
|
101
|
+
export function DecideSchedulesToResume(
|
|
102
|
+
stored: ReadonlyArray<PausedScheduleRecord>,
|
|
103
|
+
jobs: ReadonlyArray<ScheduleJobState>
|
|
104
|
+
): string[] {
|
|
105
|
+
const live = new Map(jobs.map(j => [j.ID, j]));
|
|
106
|
+
return stored
|
|
107
|
+
.filter(r => live.get(r.ID)?.Status === 'Paused')
|
|
108
|
+
.map(r => r.ID);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Reads the stored record out of a CompanyIntegration.Configuration JSON blob. */
|
|
112
|
+
export function ReadPausedSchedules(configuration: string | null | undefined): PausedScheduleRecord[] {
|
|
113
|
+
if (!configuration) return [];
|
|
114
|
+
let parsed: unknown;
|
|
115
|
+
try {
|
|
116
|
+
parsed = JSON.parse(configuration);
|
|
117
|
+
} catch {
|
|
118
|
+
// A Configuration we cannot parse is not an error to raise here: pause/resume is not the
|
|
119
|
+
// operation that owns that blob. Report "no record" and let the rest of the flow proceed.
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
if (typeof parsed !== 'object' || parsed === null) return [];
|
|
123
|
+
const raw = (parsed as Record<string, unknown>)[PAUSED_SCHEDULES_KEY];
|
|
124
|
+
if (!Array.isArray(raw)) return [];
|
|
125
|
+
const out: PausedScheduleRecord[] = [];
|
|
126
|
+
for (const item of raw) {
|
|
127
|
+
if (typeof item !== 'object' || item === null) continue;
|
|
128
|
+
const rec = item as Record<string, unknown>;
|
|
129
|
+
const id = rec.ID;
|
|
130
|
+
const kind = rec.Kind;
|
|
131
|
+
if (typeof id !== 'string' || id.length === 0) continue;
|
|
132
|
+
out.push({ ID: id, Kind: kind === 'discovery' ? 'discovery' : 'sync' });
|
|
133
|
+
}
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Returns the Configuration JSON with the record set (or cleared, when `record` is empty).
|
|
139
|
+
*
|
|
140
|
+
* Preserves every other key. An unparseable Configuration is REPLACED rather than merged — the
|
|
141
|
+
* alternative is refusing to pause because of unrelated corruption, and losing one broken blob
|
|
142
|
+
* is the better failure.
|
|
143
|
+
*/
|
|
144
|
+
export function WritePausedSchedules(
|
|
145
|
+
configuration: string | null | undefined,
|
|
146
|
+
record: ReadonlyArray<PausedScheduleRecord>
|
|
147
|
+
): string {
|
|
148
|
+
let base: Record<string, unknown> = {};
|
|
149
|
+
if (configuration) {
|
|
150
|
+
try {
|
|
151
|
+
const parsed = JSON.parse(configuration);
|
|
152
|
+
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
|
153
|
+
base = parsed as Record<string, unknown>;
|
|
154
|
+
}
|
|
155
|
+
} catch {
|
|
156
|
+
base = {};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (record.length === 0) {
|
|
160
|
+
delete base[PAUSED_SCHEDULES_KEY];
|
|
161
|
+
} else {
|
|
162
|
+
base[PAUSED_SCHEDULES_KEY] = record.map(r => ({ ID: r.ID, Kind: r.Kind }));
|
|
163
|
+
}
|
|
164
|
+
return JSON.stringify(base);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* How far a cancel request actually reaches — reported to the caller so the UI can say something
|
|
169
|
+
* TRUE rather than something reassuring.
|
|
170
|
+
*
|
|
171
|
+
* `durable` the request is recorded where the owning process will observe it, whichever
|
|
172
|
+
* process that is. "Stopping after the current batch" is honest.
|
|
173
|
+
* `this-process` a sync is running HERE and was signalled in-process. Honest, but only because
|
|
174
|
+
* this happens to be the owner.
|
|
175
|
+
* `unknown` a run is live and we could neither record the request durably nor find it in
|
|
176
|
+
* this process. It will finish. What pause still guarantees is that no NEW sync
|
|
177
|
+
* starts — say that, and do not claim the running one is stopping.
|
|
178
|
+
* `none` nothing was running. There is nothing to say.
|
|
179
|
+
*/
|
|
180
|
+
export type CancelScope = 'durable' | 'this-process' | 'unknown' | 'none';
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Classifies the cancel from observable facts, not from which API was called.
|
|
184
|
+
*
|
|
185
|
+
* Deliberately derived rather than hardcoded per lineage: the durable path needs a run-row column
|
|
186
|
+
* that only exists on newer tenants, so the SAME code has to tell the truth on a tenant where
|
|
187
|
+
* that column is absent and the in-process registry is the only signal there is.
|
|
188
|
+
*/
|
|
189
|
+
export function DescribeCancelScope(facts: {
|
|
190
|
+
liveRunPresent: boolean;
|
|
191
|
+
durableRequestRecorded: boolean;
|
|
192
|
+
runningInThisProcess: boolean;
|
|
193
|
+
}): CancelScope {
|
|
194
|
+
if (!facts.liveRunPresent) return 'none';
|
|
195
|
+
if (facts.durableRequestRecorded) return 'durable';
|
|
196
|
+
if (facts.runningInThisProcess) return 'this-process';
|
|
197
|
+
return 'unknown';
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Operator-facing sentence for a cancel scope. Never claims a stop it cannot deliver. */
|
|
201
|
+
export function DescribeCancelOutcome(scope: CancelScope): string {
|
|
202
|
+
switch (scope) {
|
|
203
|
+
case 'durable':
|
|
204
|
+
case 'this-process':
|
|
205
|
+
return 'A sync was running — it will stop after the current batch.';
|
|
206
|
+
case 'unknown':
|
|
207
|
+
return 'A sync is running in another process and will finish; no new sync will start.';
|
|
208
|
+
case 'none':
|
|
209
|
+
return '';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Operator-facing sentence for what pause did to the schedules. */
|
|
214
|
+
export function DescribePauseOutcome(paused: ReadonlyArray<PausedScheduleRecord>, alreadyPaused: boolean): string {
|
|
215
|
+
if (alreadyPaused) return 'Schedules were already paused.';
|
|
216
|
+
if (paused.length === 0) return 'No active schedules to pause.';
|
|
217
|
+
const kinds = paused.map(p => p.Kind);
|
|
218
|
+
const parts: string[] = [];
|
|
219
|
+
if (kinds.includes('sync')) parts.push('data sync');
|
|
220
|
+
if (kinds.includes('discovery')) parts.push('schema refresh');
|
|
221
|
+
return `Paused the ${parts.join(' and ')} schedule${parts.length > 1 ? 's' : ''}.`;
|
|
222
|
+
}
|
|
@@ -47,7 +47,11 @@ import {
|
|
|
47
47
|
type PromotionCandidate,
|
|
48
48
|
type CustomKeyStat,
|
|
49
49
|
type InferredColumnType,
|
|
50
|
+
BuildCatalogWriter,
|
|
51
|
+
WithCatalogScope,
|
|
50
52
|
} from '@memberjunction/integration-engine';
|
|
53
|
+
import { UUIDsEqual } from '@memberjunction/global';
|
|
54
|
+
import { IntegrationEngineBase } from '@memberjunction/integration-engine-base';
|
|
51
55
|
|
|
52
56
|
/**
|
|
53
57
|
* A custom-key candidate persisted to CompanyIntegration.Configuration.customKeyCandidates
|
|
@@ -179,6 +183,27 @@ async function readAutoPromoteFlag(companyIntegrationID: string, user: UserInfo,
|
|
|
179
183
|
} catch { return false; }
|
|
180
184
|
}
|
|
181
185
|
|
|
186
|
+
interface EntityPlan {
|
|
187
|
+
entityName: string;
|
|
188
|
+
entityInfo: EntityInfo;
|
|
189
|
+
entityMap: { ID: string; ExternalObjectName: string };
|
|
190
|
+
work: WorkItem[];
|
|
191
|
+
/** Index of this entity's input in the RSU batch; -1 when it needs no DDL. */
|
|
192
|
+
batchIndex: number;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** What {@link IntegrationCustomColumnPromoter.PlanPromotion} worked out, before anything runs. */
|
|
196
|
+
export interface PromotionPlan {
|
|
197
|
+
IntegrationID: string;
|
|
198
|
+
Plans: EntityPlan[];
|
|
199
|
+
/**
|
|
200
|
+
* The ADD COLUMN migrations, ready to run. The FIRST entry carries the durable post-restart
|
|
201
|
+
* PendingWork for the whole plan — RSU registers PendingWork from every input in a batch, so
|
|
202
|
+
* these can be appended to someone else's batch without losing it.
|
|
203
|
+
*/
|
|
204
|
+
BatchInputs: RSUPipelineInput[];
|
|
205
|
+
}
|
|
206
|
+
|
|
182
207
|
const NOT_PROMOTED: SchemaPromotionResult = { Promoted: false, ColumnsAdded: [], SchemaUpdatePending: false };
|
|
183
208
|
|
|
184
209
|
/**
|
|
@@ -199,30 +224,38 @@ export class IntegrationCustomColumnPromoter {
|
|
|
199
224
|
return this.provider as unknown as DatabaseProviderBase;
|
|
200
225
|
}
|
|
201
226
|
|
|
202
|
-
/**
|
|
203
|
-
|
|
227
|
+
/**
|
|
228
|
+
* PHASE 1 only: work out what WOULD be promoted, and the ADD COLUMN migrations that would do
|
|
229
|
+
* it, without running a pipeline.
|
|
230
|
+
*
|
|
231
|
+
* Split out so a caller that is ALREADY running an RSU batch can fold these migrations into
|
|
232
|
+
* it. A schema refresh that offers the accumulated overflow columns and then promotes them in
|
|
233
|
+
* its own second batch would restart the workspace twice in a row for one user action, and a
|
|
234
|
+
* restart storm is its own incident class here. One batch, one migration, one restart.
|
|
235
|
+
*
|
|
236
|
+
* Side effects are deliberate and belong to planning, not to promotion: stale already-promoted
|
|
237
|
+
* keys are purged from the staging JSON here, BEFORE any column is created and before the RSU
|
|
238
|
+
* pass that would restart this process. That runs even when nothing new is promoted, which is
|
|
239
|
+
* the only way residue on rows a sync never rewrites gets cleaned rather than endlessly
|
|
240
|
+
* re-detected as a phantom "new column".
|
|
241
|
+
*
|
|
242
|
+
* Returns null when there is nothing to do.
|
|
243
|
+
*/
|
|
244
|
+
public async PlanPromotion(
|
|
204
245
|
companyIntegrationID: string,
|
|
205
|
-
|
|
246
|
+
entityNames: string[],
|
|
206
247
|
customKeyStats?: Record<string, CustomKeyStat[]>,
|
|
207
|
-
): Promise<
|
|
248
|
+
): Promise<PromotionPlan | null> {
|
|
208
249
|
const integrationID = await this.resolveIntegrationID(companyIntegrationID);
|
|
209
|
-
if (!integrationID) return
|
|
250
|
+
if (!integrationID) return null;
|
|
210
251
|
|
|
211
252
|
// ── PHASE 1: PLAN — build every entity's work list + its RSU input; run NO pipeline. ──
|
|
212
253
|
// The old shape ran the FULL RSU pipeline per entity — a sync touching N entities with
|
|
213
254
|
// candidates paid N CodeGen + compile passes where the batch API exists precisely to pay
|
|
214
255
|
// one. Plan everything first, then promote once.
|
|
215
|
-
interface EntityPlan {
|
|
216
|
-
entityName: string;
|
|
217
|
-
entityInfo: EntityInfo;
|
|
218
|
-
entityMap: { ID: string; ExternalObjectName: string };
|
|
219
|
-
work: WorkItem[];
|
|
220
|
-
/** Index of this entity's input in the RSU batch; -1 when it needs no DDL. */
|
|
221
|
-
batchIndex: number;
|
|
222
|
-
}
|
|
223
256
|
const plans: EntityPlan[] = [];
|
|
224
257
|
const batchInputs: RSUPipelineInput[] = [];
|
|
225
|
-
for (const entityName of
|
|
258
|
+
for (const entityName of entityNames) {
|
|
226
259
|
try {
|
|
227
260
|
const planned = await this.planWorkForEntity(companyIntegrationID, entityName, customKeyStats?.[entityName]);
|
|
228
261
|
if (!planned) continue; // no overflow column / no captured customs / no entity map
|
|
@@ -256,7 +289,7 @@ export class IntegrationCustomColumnPromoter {
|
|
|
256
289
|
LogError(`[CustomColumnPromoter] Planning failed for entity '${entityName}': ${this.msg(err)}`);
|
|
257
290
|
}
|
|
258
291
|
}
|
|
259
|
-
if (plans.length === 0) return
|
|
292
|
+
if (plans.length === 0) return null;
|
|
260
293
|
|
|
261
294
|
// Register the follow-up DURABLY before the restart, the way the apply-objects path does
|
|
262
295
|
// (IntegrationDiscoveryResolver: `rsuInput.PendingWork = [pendingPayload]`). The restart is
|
|
@@ -290,6 +323,19 @@ export class IntegrationCustomColumnPromoter {
|
|
|
290
323
|
}];
|
|
291
324
|
batchInputs[0].ContextUser = this.user;
|
|
292
325
|
}
|
|
326
|
+
return { IntegrationID: integrationID, Plans: plans, BatchInputs: batchInputs };
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** Entry point: promote custom columns for every entity touched by the sync. */
|
|
330
|
+
public async PromoteForSync(
|
|
331
|
+
companyIntegrationID: string,
|
|
332
|
+
syncedEntityNames: string[],
|
|
333
|
+
customKeyStats?: Record<string, CustomKeyStat[]>,
|
|
334
|
+
): Promise<SchemaPromotionResult> {
|
|
335
|
+
const promotionPlan = await this.PlanPromotion(companyIntegrationID, syncedEntityNames, customKeyStats);
|
|
336
|
+
if (!promotionPlan) return NOT_PROMOTED;
|
|
337
|
+
const plans = promotionPlan.Plans;
|
|
338
|
+
const batchInputs = promotionPlan.BatchInputs;
|
|
293
339
|
|
|
294
340
|
// ── PHASE 2: ONE batched RSU pass for ALL entities' ADD COLUMN migrations. ──
|
|
295
341
|
// RunPipelineBatch runs every migration under one lock, then ONE CodeGen + compile +
|
|
@@ -355,7 +401,7 @@ export class IntegrationCustomColumnPromoter {
|
|
|
355
401
|
EntityName: plan.entityName,
|
|
356
402
|
EntityMapID: plan.entityMap.ID,
|
|
357
403
|
ExternalObjectName: plan.entityMap.ExternalObjectName,
|
|
358
|
-
IntegrationID:
|
|
404
|
+
IntegrationID: promotionPlan.IntegrationID,
|
|
359
405
|
Columns: plan.work.map(w => ({
|
|
360
406
|
SourceKey: w.sourceKey,
|
|
361
407
|
ColumnName: w.columnName,
|
|
@@ -390,12 +436,19 @@ export class IntegrationCustomColumnPromoter {
|
|
|
390
436
|
* Idempotent, because a pending row is marked Completed only after success and so stays
|
|
391
437
|
* re-processable after a crash: field maps are filtered against those already active, and the
|
|
392
438
|
* spread only fills a destination that is still empty.
|
|
439
|
+
*
|
|
440
|
+
* One entity's failure does not stop the others, but it is not swallowed either: after every
|
|
441
|
+
* entry has run, any failure is THROWN, so the caller fails the pending row instead of marking
|
|
442
|
+
* it Completed over columns that exist in the database and are never mapped.
|
|
443
|
+
*
|
|
444
|
+
* @throws PROMOTION_INCOMPLETE naming each entity that failed.
|
|
393
445
|
*/
|
|
394
446
|
public async CompletePromotion(
|
|
395
447
|
promoted: NonNullable<RSUPendingWork['PromotedColumns']>,
|
|
396
448
|
knownEntities?: ReadonlyMap<string, EntityInfo>,
|
|
397
449
|
): Promise<Array<{ EntityName: string; ColumnName: string }>> {
|
|
398
450
|
const columnsAdded: Array<{ EntityName: string; ColumnName: string }> = [];
|
|
451
|
+
const failures: string[] = [];
|
|
399
452
|
for (const entry of promoted) {
|
|
400
453
|
try {
|
|
401
454
|
// Provider first — post-restart it holds the REGENERATED class, which is the whole
|
|
@@ -404,6 +457,7 @@ export class IntegrationCustomColumnPromoter {
|
|
|
404
457
|
const entityInfo = this.provider.EntityByName(entry.EntityName) ?? knownEntities?.get(entry.EntityName);
|
|
405
458
|
if (!entityInfo) {
|
|
406
459
|
LogError(`[CustomColumnPromoter] Post-restart: entity '${entry.EntityName}' not found; skipping.`);
|
|
460
|
+
failures.push(`${entry.EntityName}: entity not found`);
|
|
407
461
|
continue;
|
|
408
462
|
}
|
|
409
463
|
// Destination names are CARRIED, never recomputed: uniqueColumnName may have
|
|
@@ -429,17 +483,23 @@ export class IntegrationCustomColumnPromoter {
|
|
|
429
483
|
needsFieldMap: !existingMaps.has(c.SourceKey.toLowerCase()),
|
|
430
484
|
}));
|
|
431
485
|
|
|
432
|
-
await this.createIntegrationObjectFields(entry.IntegrationID, entry.ExternalObjectName, named);
|
|
486
|
+
await this.createIntegrationObjectFields(entry.IntegrationID, entry.EntityMapID, entry.ExternalObjectName, named);
|
|
433
487
|
await this.createFieldMaps(entry.EntityMapID, named.filter(n => n.needsFieldMap));
|
|
434
488
|
await this.spreadAndRebaseline(entry.EntityName, entry.EntityMapID, entityInfo, named);
|
|
435
489
|
|
|
436
490
|
LogStatus(`[CustomColumnPromoter] Post-restart: completed ${named.length} promoted column(s) on ${entry.EntityName}: ${named.map(n => n.columnName).join(', ')}`);
|
|
437
491
|
columnsAdded.push(...named.map(n => ({ EntityName: entry.EntityName, ColumnName: n.columnName })));
|
|
438
492
|
} catch (err) {
|
|
439
|
-
// One entity must not abort the others; the
|
|
493
|
+
// One entity must not abort the others; the failure is thrown once they have all run.
|
|
440
494
|
LogError(`[CustomColumnPromoter] Post-restart completion failed for '${entry.EntityName}': ${this.msg(err)}`);
|
|
495
|
+
failures.push(`${entry.EntityName}: ${this.msg(err)}`);
|
|
441
496
|
}
|
|
442
497
|
}
|
|
498
|
+
if (failures.length > 0) {
|
|
499
|
+
throw new Error(
|
|
500
|
+
`PROMOTION_INCOMPLETE: ${failures.length} of ${promoted.length} entity(ies) failed to complete — ${failures.join('; ')}`
|
|
501
|
+
);
|
|
502
|
+
}
|
|
443
503
|
return columnsAdded;
|
|
444
504
|
}
|
|
445
505
|
|
|
@@ -786,13 +846,45 @@ export class IntegrationCustomColumnPromoter {
|
|
|
786
846
|
|
|
787
847
|
/** Creates an IOF row per promoted field (IsCustom, MetadataSource='Discovered'). */
|
|
788
848
|
private async createIntegrationObjectFields(
|
|
849
|
+
integrationID: string,
|
|
850
|
+
entityMapID: string,
|
|
851
|
+
externalObjectName: string,
|
|
852
|
+
named: WorkItem[],
|
|
853
|
+
): Promise<void> {
|
|
854
|
+
// Resolve the CONNECTION from the entity map rather than hopping connection → integration
|
|
855
|
+
// and writing the shared rows. That hop is what let one tenant's promoted column appear in
|
|
856
|
+
// the catalog every other tenant on the same connector reads.
|
|
857
|
+
const entityMap = IntegrationEngineBase.Instance.EntityMaps.find(m => UUIDsEqual(m.ID, entityMapID));
|
|
858
|
+
const companyIntegration = entityMap
|
|
859
|
+
? IntegrationEngineBase.Instance.GetCompanyIntegrationByID(entityMap.CompanyIntegrationID)
|
|
860
|
+
: undefined;
|
|
861
|
+
if (!companyIntegration) {
|
|
862
|
+
LogError(`[CustomColumnPromoter] Could not resolve the connection behind entity map ${entityMapID}; catalog rows skipped for '${externalObjectName}'.`);
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
// In the connection's own scope, entered here per entry: the post-restart consumer calls
|
|
866
|
+
// in with no scope, and unscoped a connection with per-connection rows reads as having none,
|
|
867
|
+
// so BuildCatalogWriter throws PER_CONNECTION_CATALOG_MISSING. Per entry, so a batch that
|
|
868
|
+
// spans connections resolves each one to its own catalog.
|
|
869
|
+
await WithCatalogScope(
|
|
870
|
+
companyIntegration.ID,
|
|
871
|
+
() => this.writeIntegrationObjectFields(companyIntegration, integrationID, externalObjectName, named),
|
|
872
|
+
this.user,
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/** The catalog writes of {@link createIntegrationObjectFields}, run inside the connection's scope. */
|
|
877
|
+
private async writeIntegrationObjectFields(
|
|
878
|
+
companyIntegration: MJCompanyIntegrationEntity,
|
|
789
879
|
integrationID: string,
|
|
790
880
|
externalObjectName: string,
|
|
791
881
|
named: WorkItem[],
|
|
792
882
|
): Promise<void> {
|
|
793
|
-
const
|
|
883
|
+
const writer = BuildCatalogWriter(this.provider, companyIntegration, this.user);
|
|
884
|
+
const objectID = (await writer.ObjectsInScope())
|
|
885
|
+
.find(o => o.Name.toLowerCase() === externalObjectName.toLowerCase())?.ID ?? null;
|
|
794
886
|
if (!objectID) {
|
|
795
|
-
LogError(`[CustomColumnPromoter] No
|
|
887
|
+
LogError(`[CustomColumnPromoter] No catalog object '${externalObjectName}' for integration ${integrationID}; catalog field rows skipped.`);
|
|
796
888
|
return;
|
|
797
889
|
}
|
|
798
890
|
// Lookup-or-reactivate-or-create — NEVER blind-create over an existing field. A field the source
|
|
@@ -800,13 +892,16 @@ export class IntegrationCustomColumnPromoter {
|
|
|
800
892
|
// key reappears in the payload and reaches promotion, the IOF already exists: reactivate it (so the
|
|
801
893
|
// active-filtered ApplyAll re-materializes the still-present column) instead of creating a duplicate.
|
|
802
894
|
// This is the "removed-then-re-added" case + the recovery case (column existed, field map missing).
|
|
803
|
-
const existingIOFs =
|
|
895
|
+
const existingIOFs = new Map<string, { ID: string; Status: string }>();
|
|
896
|
+
for (const f of await writer.FieldsForObject(objectID)) {
|
|
897
|
+
existingIOFs.set((f.Name ?? '').toLowerCase(), { ID: f.ID, Status: f.Status ?? 'Active' });
|
|
898
|
+
}
|
|
804
899
|
for (const n of named) {
|
|
805
900
|
const existing = existingIOFs.get(n.sourceKey.toLowerCase());
|
|
806
901
|
if (existing) {
|
|
807
902
|
if (existing.Status !== 'Active') {
|
|
808
|
-
const reIof = await
|
|
809
|
-
if (
|
|
903
|
+
const reIof = await writer.LoadField(existing.ID);
|
|
904
|
+
if (reIof) {
|
|
810
905
|
reIof.Status = 'Active';
|
|
811
906
|
const ok = await reIof.Save();
|
|
812
907
|
if (!ok) LogError(`[CustomColumnPromoter] Failed to reactivate IOF '${n.sourceKey}': ${reIof.LatestResult?.CompleteMessage ?? 'unknown'}`);
|
|
@@ -814,8 +909,10 @@ export class IntegrationCustomColumnPromoter {
|
|
|
814
909
|
}
|
|
815
910
|
continue;
|
|
816
911
|
}
|
|
817
|
-
const iof = await
|
|
818
|
-
|
|
912
|
+
const iof = await writer.NewFieldRow();
|
|
913
|
+
// An overflow-promoted column was seen in live data, never described by an endpoint and
|
|
914
|
+
// never declared — so its provenance is 'Sampled', and it has no declared row behind it.
|
|
915
|
+
writer.StampNewField(iof, null, 'Sampled');
|
|
819
916
|
iof.IntegrationObjectID = objectID;
|
|
820
917
|
iof.Name = n.sourceKey;
|
|
821
918
|
iof.DisplayName = n.sourceKey;
|
|
@@ -1107,40 +1204,13 @@ export class IntegrationCustomColumnPromoter {
|
|
|
1107
1204
|
ExtraFilter: `CompanyIntegrationID='${companyIntegrationID}' AND Entity='${this.escape(entityName)}'`,
|
|
1108
1205
|
ResultType: 'simple',
|
|
1109
1206
|
MaxRows: 1,
|
|
1207
|
+
SkipTotalRowCount: true,
|
|
1110
1208
|
}, this.user);
|
|
1111
1209
|
const row = res.Success ? res.Results?.[0] : undefined;
|
|
1112
1210
|
return row ? { ID: row.ID, ExternalObjectName: row.ExternalObjectName } : null;
|
|
1113
1211
|
}
|
|
1114
1212
|
|
|
1115
|
-
/** Existing IOF field names (lowercased) for an object — for idempotent IOF creation. */
|
|
1116
|
-
private async existingIOFsByName(objectID: string): Promise<ReadonlyMap<string, { ID: string; Status: string }>> {
|
|
1117
|
-
const rv = new RunView();
|
|
1118
|
-
const res = await rv.RunView<MJIntegrationObjectFieldEntity>({
|
|
1119
|
-
EntityName: 'MJ: Integration Object Fields',
|
|
1120
|
-
ExtraFilter: `IntegrationObjectID='${objectID}'`,
|
|
1121
|
-
Fields: ['ID', 'Name', 'Status'],
|
|
1122
|
-
ResultType: 'simple',
|
|
1123
|
-
}, this.user);
|
|
1124
|
-
const map = new Map<string, { ID: string; Status: string }>();
|
|
1125
|
-
if (res.Success) for (const r of res.Results ?? []) {
|
|
1126
|
-
map.set((r.Name ?? '').toLowerCase(), { ID: String(r.ID), Status: r.Status ?? 'Active' });
|
|
1127
|
-
}
|
|
1128
|
-
return map;
|
|
1129
|
-
}
|
|
1130
1213
|
|
|
1131
|
-
/** Resolves the IntegrationObject ID for an external object name under an integration. */
|
|
1132
|
-
private async resolveIntegrationObjectID(integrationID: string, externalObjectName: string): Promise<string | null> {
|
|
1133
|
-
const rv = new RunView();
|
|
1134
|
-
const res = await rv.RunView<MJIntegrationObjectEntity>({
|
|
1135
|
-
EntityName: 'MJ: Integration Objects',
|
|
1136
|
-
ExtraFilter: `IntegrationID='${integrationID}' AND Name='${this.escape(externalObjectName)}'`,
|
|
1137
|
-
Fields: ['ID', 'Name', 'IntegrationID'],
|
|
1138
|
-
ResultType: 'simple',
|
|
1139
|
-
MaxRows: 1,
|
|
1140
|
-
}, this.user);
|
|
1141
|
-
const row = res.Success ? res.Results?.[0] : undefined;
|
|
1142
|
-
return row ? row.ID : null;
|
|
1143
|
-
}
|
|
1144
1214
|
|
|
1145
1215
|
private escape(value: string): string {
|
|
1146
1216
|
return value.replace(/'/g, "''");
|