@memberjunction/server 5.44.0 → 5.45.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.
Files changed (267) hide show
  1. package/dist/agentSessions/ReturningVisitorRecap.d.ts +39 -0
  2. package/dist/agentSessions/ReturningVisitorRecap.d.ts.map +1 -0
  3. package/dist/agentSessions/ReturningVisitorRecap.js +198 -0
  4. package/dist/agentSessions/ReturningVisitorRecap.js.map +1 -0
  5. package/dist/agentSessions/SessionJanitor.d.ts +13 -0
  6. package/dist/agentSessions/SessionJanitor.d.ts.map +1 -1
  7. package/dist/agentSessions/SessionJanitor.js +65 -7
  8. package/dist/agentSessions/SessionJanitor.js.map +1 -1
  9. package/dist/agentSessions/SessionManager.d.ts.map +1 -1
  10. package/dist/agentSessions/SessionManager.js +37 -0
  11. package/dist/agentSessions/SessionManager.js.map +1 -1
  12. package/dist/auth/magicLink/MagicLinkRouter.d.ts +10 -0
  13. package/dist/auth/magicLink/MagicLinkRouter.d.ts.map +1 -1
  14. package/dist/auth/magicLink/MagicLinkRouter.js +16 -0
  15. package/dist/auth/magicLink/MagicLinkRouter.js.map +1 -1
  16. package/dist/auth/magicLink/MagicLinkService.d.ts +7 -0
  17. package/dist/auth/magicLink/MagicLinkService.d.ts.map +1 -1
  18. package/dist/auth/magicLink/MagicLinkService.js +13 -3
  19. package/dist/auth/magicLink/MagicLinkService.js.map +1 -1
  20. package/dist/auth/magicLink/index.d.ts +1 -1
  21. package/dist/auth/magicLink/index.d.ts.map +1 -1
  22. package/dist/auth/magicLink/index.js +1 -1
  23. package/dist/auth/magicLink/index.js.map +1 -1
  24. package/dist/auth/magicLink/magicLinkCore.d.ts +38 -1
  25. package/dist/auth/magicLink/magicLinkCore.d.ts.map +1 -1
  26. package/dist/auth/magicLink/magicLinkCore.js +42 -19
  27. package/dist/auth/magicLink/magicLinkCore.js.map +1 -1
  28. package/dist/auth/magicLink/types.d.ts +26 -0
  29. package/dist/auth/magicLink/types.d.ts.map +1 -1
  30. package/dist/config.d.ts +1883 -144
  31. package/dist/config.d.ts.map +1 -1
  32. package/dist/config.js +160 -36
  33. package/dist/config.js.map +1 -1
  34. package/dist/context.d.ts.map +1 -1
  35. package/dist/context.js +45 -2
  36. package/dist/context.js.map +1 -1
  37. package/dist/generated/generated.d.ts +522 -0
  38. package/dist/generated/generated.d.ts.map +1 -1
  39. package/dist/generated/generated.js +2860 -0
  40. package/dist/generated/generated.js.map +1 -1
  41. package/dist/generic/ResolverBase.d.ts +13 -0
  42. package/dist/generic/ResolverBase.d.ts.map +1 -1
  43. package/dist/generic/ResolverBase.js +22 -0
  44. package/dist/generic/ResolverBase.js.map +1 -1
  45. package/dist/generic/RunViewResolver.d.ts.map +1 -1
  46. package/dist/generic/RunViewResolver.js +4 -0
  47. package/dist/generic/RunViewResolver.js.map +1 -1
  48. package/dist/index.d.ts +0 -2
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +101 -3
  51. package/dist/index.js.map +1 -1
  52. package/dist/integration/CustomColumnPromoter.d.ts.map +1 -1
  53. package/dist/integration/CustomColumnPromoter.js +6 -0
  54. package/dist/integration/CustomColumnPromoter.js.map +1 -1
  55. package/dist/realtimeWidget/WidgetRouter.d.ts +26 -0
  56. package/dist/realtimeWidget/WidgetRouter.d.ts.map +1 -0
  57. package/dist/realtimeWidget/WidgetRouter.js +182 -0
  58. package/dist/realtimeWidget/WidgetRouter.js.map +1 -0
  59. package/dist/realtimeWidget/WidgetSessionService.d.ts +265 -0
  60. package/dist/realtimeWidget/WidgetSessionService.d.ts.map +1 -0
  61. package/dist/realtimeWidget/WidgetSessionService.js +477 -0
  62. package/dist/realtimeWidget/WidgetSessionService.js.map +1 -0
  63. package/dist/realtimeWidget/host-identity.d.ts +40 -0
  64. package/dist/realtimeWidget/host-identity.d.ts.map +1 -0
  65. package/dist/realtimeWidget/host-identity.js +58 -0
  66. package/dist/realtimeWidget/host-identity.js.map +1 -0
  67. package/dist/realtimeWidget/index.d.ts +10 -0
  68. package/dist/realtimeWidget/index.d.ts.map +1 -0
  69. package/dist/realtimeWidget/index.js +9 -0
  70. package/dist/realtimeWidget/index.js.map +1 -0
  71. package/dist/realtimeWidget/visitorIdentity.d.ts +76 -0
  72. package/dist/realtimeWidget/visitorIdentity.d.ts.map +1 -0
  73. package/dist/realtimeWidget/visitorIdentity.js +202 -0
  74. package/dist/realtimeWidget/visitorIdentity.js.map +1 -0
  75. package/dist/realtimeWidget/widgetCore.d.ts +106 -0
  76. package/dist/realtimeWidget/widgetCore.d.ts.map +1 -0
  77. package/dist/realtimeWidget/widgetCore.js +173 -0
  78. package/dist/realtimeWidget/widgetCore.js.map +1 -0
  79. package/dist/realtimeWidget/widgetGuestElevation.d.ts +51 -0
  80. package/dist/realtimeWidget/widgetGuestElevation.d.ts.map +1 -0
  81. package/dist/realtimeWidget/widgetGuestElevation.js +79 -0
  82. package/dist/realtimeWidget/widgetGuestElevation.js.map +1 -0
  83. package/dist/resolvers/ComponentRegistryResolver.d.ts +7 -0
  84. package/dist/resolvers/ComponentRegistryResolver.d.ts.map +1 -1
  85. package/dist/resolvers/ComponentRegistryResolver.js +31 -8
  86. package/dist/resolvers/ComponentRegistryResolver.js.map +1 -1
  87. package/dist/resolvers/EntityPermissionResolver.d.ts.map +1 -1
  88. package/dist/resolvers/EntityPermissionResolver.js +1 -2
  89. package/dist/resolvers/EntityPermissionResolver.js.map +1 -1
  90. package/dist/resolvers/QuerySystemUserResolver.d.ts +9 -6
  91. package/dist/resolvers/QuerySystemUserResolver.d.ts.map +1 -1
  92. package/dist/resolvers/QuerySystemUserResolver.js +15 -13
  93. package/dist/resolvers/QuerySystemUserResolver.js.map +1 -1
  94. package/dist/resolvers/RealtimeClientSessionResolver.d.ts +10 -0
  95. package/dist/resolvers/RealtimeClientSessionResolver.d.ts.map +1 -1
  96. package/dist/resolvers/RealtimeClientSessionResolver.js +47 -3
  97. package/dist/resolvers/RealtimeClientSessionResolver.js.map +1 -1
  98. package/dist/resolvers/RingCentralTelephonyResolver.d.ts +27 -0
  99. package/dist/resolvers/RingCentralTelephonyResolver.d.ts.map +1 -0
  100. package/dist/resolvers/RingCentralTelephonyResolver.js +87 -0
  101. package/dist/resolvers/RingCentralTelephonyResolver.js.map +1 -0
  102. package/dist/resolvers/RunAIAgentResolver.d.ts +9 -0
  103. package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
  104. package/dist/resolvers/RunAIAgentResolver.js +20 -4
  105. package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
  106. package/dist/resolvers/SearchKnowledgeResolver.d.ts.map +1 -1
  107. package/dist/resolvers/SearchKnowledgeResolver.js +2 -0
  108. package/dist/resolvers/SearchKnowledgeResolver.js.map +1 -1
  109. package/dist/resolvers/TeamsMeetingsResolver.d.ts +28 -0
  110. package/dist/resolvers/TeamsMeetingsResolver.d.ts.map +1 -0
  111. package/dist/resolvers/TeamsMeetingsResolver.js +91 -0
  112. package/dist/resolvers/TeamsMeetingsResolver.js.map +1 -0
  113. package/dist/resolvers/TelephonyResolver.d.ts +26 -0
  114. package/dist/resolvers/TelephonyResolver.d.ts.map +1 -0
  115. package/dist/resolvers/TelephonyResolver.js +86 -0
  116. package/dist/resolvers/TelephonyResolver.js.map +1 -0
  117. package/dist/resolvers/TestQuerySQLResolver.d.ts +1 -1
  118. package/dist/resolvers/TestQuerySQLResolver.d.ts.map +1 -1
  119. package/dist/resolvers/TestQuerySQLResolver.js +2 -3
  120. package/dist/resolvers/TestQuerySQLResolver.js.map +1 -1
  121. package/dist/resolvers/VonageTelephonyResolver.d.ts +26 -0
  122. package/dist/resolvers/VonageTelephonyResolver.d.ts.map +1 -0
  123. package/dist/resolvers/VonageTelephonyResolver.js +86 -0
  124. package/dist/resolvers/VonageTelephonyResolver.js.map +1 -0
  125. package/dist/rest/MediaStreamHandler.js +4 -1
  126. package/dist/rest/MediaStreamHandler.js.map +1 -1
  127. package/dist/telephony/RingCentralTelephonyService.d.ts +115 -0
  128. package/dist/telephony/RingCentralTelephonyService.d.ts.map +1 -0
  129. package/dist/telephony/RingCentralTelephonyService.js +262 -0
  130. package/dist/telephony/RingCentralTelephonyService.js.map +1 -0
  131. package/dist/telephony/TeamsMeetingsRouter.d.ts +40 -0
  132. package/dist/telephony/TeamsMeetingsRouter.d.ts.map +1 -0
  133. package/dist/telephony/TeamsMeetingsRouter.js +96 -0
  134. package/dist/telephony/TeamsMeetingsRouter.js.map +1 -0
  135. package/dist/telephony/TeamsMeetingsService.d.ts +113 -0
  136. package/dist/telephony/TeamsMeetingsService.d.ts.map +1 -0
  137. package/dist/telephony/TeamsMeetingsService.js +196 -0
  138. package/dist/telephony/TeamsMeetingsService.js.map +1 -0
  139. package/dist/telephony/TwilioTelephonyRouter.d.ts +36 -0
  140. package/dist/telephony/TwilioTelephonyRouter.d.ts.map +1 -0
  141. package/dist/telephony/TwilioTelephonyRouter.js +143 -0
  142. package/dist/telephony/TwilioTelephonyRouter.js.map +1 -0
  143. package/dist/telephony/TwilioTelephonyService.d.ts +95 -0
  144. package/dist/telephony/TwilioTelephonyService.d.ts.map +1 -0
  145. package/dist/telephony/TwilioTelephonyService.js +193 -0
  146. package/dist/telephony/TwilioTelephonyService.js.map +1 -0
  147. package/dist/telephony/VonageTelephonyRouter.d.ts +41 -0
  148. package/dist/telephony/VonageTelephonyRouter.d.ts.map +1 -0
  149. package/dist/telephony/VonageTelephonyRouter.js +201 -0
  150. package/dist/telephony/VonageTelephonyRouter.js.map +1 -0
  151. package/dist/telephony/VonageTelephonyService.d.ts +90 -0
  152. package/dist/telephony/VonageTelephonyService.d.ts.map +1 -0
  153. package/dist/telephony/VonageTelephonyService.js +191 -0
  154. package/dist/telephony/VonageTelephonyService.js.map +1 -0
  155. package/dist/telephony/calendar-scheduler.d.ts +67 -0
  156. package/dist/telephony/calendar-scheduler.d.ts.map +1 -0
  157. package/dist/telephony/calendar-scheduler.js +133 -0
  158. package/dist/telephony/calendar-scheduler.js.map +1 -0
  159. package/dist/telephony/index.d.ts +29 -0
  160. package/dist/telephony/index.d.ts.map +1 -0
  161. package/dist/telephony/index.js +38 -0
  162. package/dist/telephony/index.js.map +1 -0
  163. package/dist/telephony/media-upgrade-router.d.ts +33 -0
  164. package/dist/telephony/media-upgrade-router.d.ts.map +1 -0
  165. package/dist/telephony/media-upgrade-router.js +56 -0
  166. package/dist/telephony/media-upgrade-router.js.map +1 -0
  167. package/dist/telephony/ringcentral-runtime.d.ts +14 -0
  168. package/dist/telephony/ringcentral-runtime.d.ts.map +1 -0
  169. package/dist/telephony/ringcentral-runtime.js +18 -0
  170. package/dist/telephony/ringcentral-runtime.js.map +1 -0
  171. package/dist/telephony/teams-meetings-runtime.d.ts +16 -0
  172. package/dist/telephony/teams-meetings-runtime.d.ts.map +1 -0
  173. package/dist/telephony/teams-meetings-runtime.js +20 -0
  174. package/dist/telephony/teams-meetings-runtime.js.map +1 -0
  175. package/dist/telephony/teamsAcsMediaRegistry.d.ts +69 -0
  176. package/dist/telephony/teamsAcsMediaRegistry.d.ts.map +1 -0
  177. package/dist/telephony/teamsAcsMediaRegistry.js +118 -0
  178. package/dist/telephony/teamsAcsMediaRegistry.js.map +1 -0
  179. package/dist/telephony/telephony-runtime.d.ts +14 -0
  180. package/dist/telephony/telephony-runtime.d.ts.map +1 -0
  181. package/dist/telephony/telephony-runtime.js +18 -0
  182. package/dist/telephony/telephony-runtime.js.map +1 -0
  183. package/dist/telephony/twilioMediaRegistry.d.ts +60 -0
  184. package/dist/telephony/twilioMediaRegistry.d.ts.map +1 -0
  185. package/dist/telephony/twilioMediaRegistry.js +106 -0
  186. package/dist/telephony/twilioMediaRegistry.js.map +1 -0
  187. package/dist/telephony/vonage-runtime.d.ts +14 -0
  188. package/dist/telephony/vonage-runtime.d.ts.map +1 -0
  189. package/dist/telephony/vonage-runtime.js +18 -0
  190. package/dist/telephony/vonage-runtime.js.map +1 -0
  191. package/dist/telephony/vonageMediaRegistry.d.ts +78 -0
  192. package/dist/telephony/vonageMediaRegistry.d.ts.map +1 -0
  193. package/dist/telephony/vonageMediaRegistry.js +158 -0
  194. package/dist/telephony/vonageMediaRegistry.js.map +1 -0
  195. package/package.json +88 -83
  196. package/src/__tests__/RunAIAgentResolver.streaming.test.ts +128 -0
  197. package/src/__tests__/magicLink.test.ts +53 -3
  198. package/src/__tests__/search-knowledge-tags.test.ts +9 -9
  199. package/src/__tests__/teams-meetings-service.test.ts +65 -0
  200. package/src/__tests__/teamsAcsMediaRegistry.test.ts +82 -0
  201. package/src/__tests__/twilio-telephony-service.test.ts +23 -0
  202. package/src/__tests__/twilioMediaRegistry.test.ts +103 -0
  203. package/src/__tests__/vonageMediaRegistry.test.ts +180 -0
  204. package/src/__tests__/widget.test.ts +204 -0
  205. package/src/__tests__/widgetGuestElevation.test.ts +57 -0
  206. package/src/__tests__/widgetHostIdentity.test.ts +117 -0
  207. package/src/agentSessions/ReturningVisitorRecap.ts +242 -0
  208. package/src/agentSessions/SessionJanitor.ts +66 -6
  209. package/src/agentSessions/SessionManager.ts +38 -0
  210. package/src/auth/magicLink/MagicLinkRouter.ts +17 -0
  211. package/src/auth/magicLink/MagicLinkService.ts +13 -3
  212. package/src/auth/magicLink/index.ts +1 -0
  213. package/src/auth/magicLink/magicLinkCore.ts +48 -20
  214. package/src/auth/magicLink/types.ts +26 -0
  215. package/src/config.ts +172 -38
  216. package/src/context.ts +50 -3
  217. package/src/generated/generated.ts +1991 -1
  218. package/src/generic/ResolverBase.ts +28 -0
  219. package/src/generic/RunViewResolver.ts +4 -0
  220. package/src/index.ts +109 -3
  221. package/src/integration/CustomColumnPromoter.ts +6 -0
  222. package/src/realtimeWidget/WidgetRouter.ts +204 -0
  223. package/src/realtimeWidget/WidgetSessionService.ts +714 -0
  224. package/src/realtimeWidget/host-identity.ts +84 -0
  225. package/src/realtimeWidget/index.ts +15 -0
  226. package/src/realtimeWidget/visitorIdentity.ts +258 -0
  227. package/src/realtimeWidget/widgetCore.ts +231 -0
  228. package/src/realtimeWidget/widgetGuestElevation.ts +115 -0
  229. package/src/resolvers/ComponentRegistryResolver.ts +36 -10
  230. package/src/resolvers/EntityPermissionResolver.ts +1 -2
  231. package/src/resolvers/QuerySystemUserResolver.ts +14 -10
  232. package/src/resolvers/RealtimeClientSessionResolver.ts +59 -2
  233. package/src/resolvers/RingCentralTelephonyResolver.ts +64 -0
  234. package/src/resolvers/RunAIAgentResolver.ts +32 -8
  235. package/src/resolvers/SearchKnowledgeResolver.ts +2 -0
  236. package/src/resolvers/TeamsMeetingsResolver.ts +68 -0
  237. package/src/resolvers/TelephonyResolver.ts +63 -0
  238. package/src/resolvers/TestQuerySQLResolver.ts +2 -3
  239. package/src/resolvers/VonageTelephonyResolver.ts +63 -0
  240. package/src/rest/MediaStreamHandler.ts +4 -1
  241. package/src/telephony/RingCentralTelephonyService.ts +342 -0
  242. package/src/telephony/TeamsMeetingsRouter.ts +124 -0
  243. package/src/telephony/TeamsMeetingsService.ts +268 -0
  244. package/src/telephony/TwilioTelephonyRouter.ts +184 -0
  245. package/src/telephony/TwilioTelephonyService.ts +261 -0
  246. package/src/telephony/VonageTelephonyRouter.ts +239 -0
  247. package/src/telephony/VonageTelephonyService.ts +259 -0
  248. package/src/telephony/calendar-scheduler.ts +176 -0
  249. package/src/telephony/index.ts +43 -0
  250. package/src/telephony/media-upgrade-router.ts +62 -0
  251. package/src/telephony/ringcentral-runtime.ts +22 -0
  252. package/src/telephony/teams-meetings-runtime.ts +24 -0
  253. package/src/telephony/teamsAcsMediaRegistry.ts +152 -0
  254. package/src/telephony/telephony-runtime.ts +22 -0
  255. package/src/telephony/twilioMediaRegistry.ts +137 -0
  256. package/src/telephony/vonage-runtime.ts +22 -0
  257. package/src/telephony/vonageMediaRegistry.ts +200 -0
  258. package/dist/agents/skip-agent.d.ts +0 -111
  259. package/dist/agents/skip-agent.d.ts.map +0 -1
  260. package/dist/agents/skip-agent.js +0 -1487
  261. package/dist/agents/skip-agent.js.map +0 -1
  262. package/dist/agents/skip-sdk.d.ts +0 -261
  263. package/dist/agents/skip-sdk.d.ts.map +0 -1
  264. package/dist/agents/skip-sdk.js +0 -909
  265. package/dist/agents/skip-sdk.js.map +0 -1
  266. package/src/agents/skip-agent.ts +0 -1594
  267. package/src/agents/skip-sdk.ts +0 -1210
@@ -18,7 +18,7 @@ import { mj_core_schema } from '../config.js';
18
18
 
19
19
 
20
20
 
21
- import { MJAccessControlRuleEntity, MJActionAuthorizationEntity, MJActionCategoryEntity, MJActionContextTypeEntity, MJActionContextEntity, MJActionExecutionLogEntity, MJActionFilterEntity, MJActionLibraryEntity, MJActionParamEntity, MJActionResultCodeEntity, MJActionEntity, MJAIActionEntity, MJAIAgentActionEntity, MJAIAgentArtifactTypeEntity, MJAIAgentCategoryEntity, MJAIAgentChannelEntity, MJAIAgentClientToolEntity, MJAIAgentCoAgentEntity, MJAIAgentConfigurationEntity, MJAIAgentDataSourceEntity, MJAIAgentExampleEntity, MJAIAgentLearningCycleEntity, MJAIAgentModalityEntity, MJAIAgentModelEntity, MJAIAgentNoteTypeEntity, MJAIAgentNoteEntity, MJAIAgentPermissionEntity, MJAIAgentPromptEntity, MJAIAgentRelationshipEntity, MJAIAgentRequestTypeEntity, MJAIAgentRequestEntity, MJAIAgentRunMediaEntity, MJAIAgentRunStepEntity, MJAIAgentRunEntity, MJAIAgentSearchScopeEntity, MJAIAgentSessionBridgeParticipantEntity, MJAIAgentSessionBridgeEntity, MJAIAgentSessionChannelEntity, MJAIAgentSessionEntity, MJAIAgentSkillEntity, MJAIAgentStepPathEntity, MJAIAgentStepEntity, MJAIAgentTypeEntity, MJAIAgentEntity, MJAIArchitectureEntity, MJAIBridgeAgentIdentityEntity, MJAIBridgeProviderChannelEntity, MJAIBridgeProviderEntity, MJAIClientToolDefinitionEntity, MJAIConfigurationParamEntity, MJAIConfigurationEntity, MJAICredentialBindingEntity, MJAIModalityEntity, MJAIModelActionEntity, MJAIModelArchitectureEntity, MJAIModelCostEntity, MJAIModelModalityEntity, MJAIModelPriceTypeEntity, MJAIModelPriceUnitTypeEntity, MJAIModelTypeEntity, MJAIModelVendorEntity, MJAIModelEntity, MJAIPromptCategoryEntity, MJAIPromptModelEntity, MJAIPromptRunMediaEntity, MJAIPromptRunEntity, MJAIPromptTypeEntity, MJAIPromptEntity, MJAIRemoteBrowserProviderEntity, MJAIResultCacheEntity, MJAISkillActionEntity, MJAISkillPermissionEntity, MJAISkillSubAgentEntity, MJAISkillEntity, MJAIVendorTypeDefinitionEntity, MJAIVendorTypeEntity, MJAIVendorEntity, MJAPIApplicationScopeEntity, MJAPIApplicationEntity, MJAPIKeyApplicationEntity, MJAPIKeyScopeEntity, MJAPIKeyUsageLogEntity, MJAPIKeyEntity, MJAPIScopeEntity, MJApplicationEntityEntity, MJApplicationRoleEntity, MJApplicationSettingEntity, MJApplicationEntity, MJArchiveConfigurationEntityEntity, MJArchiveConfigurationEntity, MJArchiveRunDetailEntity, MJArchiveRunEntity, MJArtifactPermissionEntity, MJArtifactTypeEntity, MJArtifactUseEntity, MJArtifactVersionAttributeEntity, MJArtifactVersionEntity, MJArtifactEntity, MJAuditLogTypeEntity, MJAuditLogEntity, MJAuthorizationRoleEntity, MJAuthorizationEntity, MJClusterAnalysisEntity, MJClusterAnalysisClusterEntity, MJCollectionArtifactEntity, MJCollectionPermissionEntity, MJCollectionEntity, MJCommunicationBaseMessageTypeEntity, MJCommunicationLogEntity, MJCommunicationProviderMessageTypeEntity, MJCommunicationProviderEntity, MJCommunicationRunEntity, MJCompanyEntity, MJCompanyIntegrationEntityMapEntity, MJCompanyIntegrationFieldMapEntity, MJCompanyIntegrationRecordMapEntity, MJCompanyIntegrationRunAPILogEntity, MJCompanyIntegrationRunDetailEntity, MJCompanyIntegrationRunEntity, MJCompanyIntegrationSyncWatermarkEntity, MJCompanyIntegrationEntity, MJComponentDependencyEntity, MJComponentLibraryEntity, MJComponentLibraryLinkEntity, MJComponentRegistryEntity, MJComponentEntity, MJContentFileTypeEntity, MJContentItemAttributeEntity, MJContentItemDuplicateEntity, MJContentItemTagEntity, MJContentItemEntity, MJContentProcessRunDetailEntity, MJContentProcessRunPromptRunEntity, MJContentProcessRunEntity, MJContentSourceParamEntity, MJContentSourceTypeParamEntity, MJContentSourceTypeEntity, MJContentSourceEntity, MJContentTypeAttributeEntity, MJContentTypeEntity, MJConversationArtifactPermissionEntity, MJConversationArtifactVersionEntity, MJConversationArtifactEntity, MJConversationDetailArtifactEntity, MJConversationDetailAttachmentEntity, MJConversationDetailRatingEntity, MJConversationDetailEntity, MJConversationEntity, MJCountryEntity, MJCredentialCategoryEntity, MJCredentialTypeEntity, MJCredentialEntity, MJDashboardCategoryEntity, MJDashboardCategoryLinkEntity, MJDashboardCategoryPermissionEntity, MJDashboardPartTypeEntity, MJDashboardPermissionEntity, MJDashboardUserPreferenceEntity, MJDashboardUserStateEntity, MJDashboardEntity, MJDataContextItemEntity, MJDataContextEntity, MJDatasetItemEntity, MJDatasetEntity, MJDuplicateRunDetailMatchEntity, MJDuplicateRunDetailEntity, MJDuplicateRunEntity, MJEmployeeCompanyIntegrationEntity, MJEmployeeRoleEntity, MJEmployeeSkillEntity, MJEmployeeEntity, MJEncryptionAlgorithmEntity, MJEncryptionKeySourceEntity, MJEncryptionKeyEntity, MJEntityEntity, MJEntityActionFilterEntity, MJEntityActionInvocationTypeEntity, MJEntityActionInvocationEntity, MJEntityActionParamEntity, MJEntityActionEntity, MJEntityAIActionEntity, MJEntityCommunicationFieldEntity, MJEntityCommunicationMessageTypeEntity, MJEntityDocumentRunEntity, MJEntityDocumentSettingEntity, MJEntityDocumentTypeEntity, MJEntityDocumentEntity, MJEntityFieldValueEntity, MJEntityFieldEntity, MJEntityFormOverrideEntity, MJEntityOrganicKeyRelatedEntityEntity, MJEntityOrganicKeyEntity, MJEntityPermissionEntity, MJEntityRecordDocumentEntity, MJEntityRelationshipDisplayComponentEntity, MJEntityRelationshipEntity, MJEntitySettingEntity, MJEnvironmentEntity, MJErrorLogEntity, MJExperimentSessionIterationEntity, MJExperimentSessionEntity, MJExperimentEntity, MJExplorerNavigationItemEntity, MJFileCategoryEntity, MJFileEntityRecordLinkEntity, MJFileStorageAccountPermissionEntity, MJFileStorageAccountEntity, MJFileStorageProviderEntity, MJFileEntity, MJGeneratedCodeCategoryEntity, MJGeneratedCodeEntity, MJInstanceConfigurationEntity, MJIntegrationObjectFieldEntity, MJIntegrationObjectEntity, MJIntegrationSourceTypeEntity, MJIntegrationURLFormatEntity, MJIntegrationEntity, MJKnowledgeHubSavedSearchEntity, MJLibraryEntity, MJLibraryItemEntity, MJListCategoryEntity, MJListDetailEntity, MJListInvitationEntity, MJListShareEntity, MJListEntity, MJMagicLinkInviteAllowedDomainEntity, MJMagicLinkInviteAllowedPathEntity, MJMagicLinkInviteApplicationEntity, MJMagicLinkInviteRoleEntity, MJMagicLinkInviteEntity, MJMagicLinkRedemptionEntity, MJMCPServerConnectionPermissionEntity, MJMCPServerConnectionToolEntity, MJMCPServerConnectionEntity, MJMCPServerToolEntity, MJMCPServerEntity, MJMCPToolExecutionLogEntity, MJMCPToolFavoriteEntity, MJMLAlgorithmUseCaseRankingEntity, MJMLAlgorithmUseCaseEntity, MJMLAlgorithmEntity, MJMLModelScoringBindingEntity, MJMLModelEntity, MJMLTrainingPipelineEntity, MJMLTrainingRunEntity, MJOAuthAuthServerMetadataCacheEntity, MJOAuthAuthorizationStateEntity, MJOAuthClientRegistrationEntity, MJOAuthTokenEntity, MJOpenAppDependencyEntity, MJOpenAppInstallHistoryEntity, MJOpenAppEntity, MJOutputDeliveryTypeEntity, MJOutputFormatTypeEntity, MJOutputTriggerTypeEntity, MJPermissionDomainEntity, MJProcessRunDetailEntity, MJProcessRunEntity, MJProjectEntity, MJPublicLinkEntity, MJQueryEntity, MJQueryCategoryEntity, MJQueryDependencyEntity, MJQueryEntityEntity, MJQueryFieldEntity, MJQueryParameterEntity, MJQueryPermissionEntity, MJQuerySQLEntity, MJQueueTaskEntity, MJQueueTypeEntity, MJQueueEntity, MJRecommendationItemEntity, MJRecommendationProviderEntity, MJRecommendationRunEntity, MJRecommendationEntity, MJRecordChangeReplayRunEntity, MJRecordChangeEntity, MJRecordGeoCodeEntity, MJRecordLinkEntity, MJRecordMergeDeletionLogEntity, MJRecordMergeLogEntity, MJRecordProcessCategoryEntity, MJRecordProcessWatermarkEntity, MJRecordProcessEntity, MJRemoteOperationCategoryEntity, MJRemoteOperationEntity, MJReportCategoryEntity, MJReportSnapshotEntity, MJReportUserStateEntity, MJReportVersionEntity, MJReportEntity, MJResourceLinkEntity, MJResourcePermissionEntity, MJResourceTypeEntity, MJRoleEntity, MJRowLevelSecurityFilterEntity, MJScheduledActionParamEntity, MJScheduledActionEntity, MJScheduledJobRunEntity, MJScheduledJobTypeEntity, MJScheduledJobEntity, MJSchemaInfoEntity, MJScopedPromptPartEntity, MJSearchExecutionLogEntity, MJSearchProviderEntity, MJSearchScopeEntityEntity, MJSearchScopeExternalIndexEntity, MJSearchScopePermissionEntity, MJSearchScopeProviderEntity, MJSearchScopeStorageAccountEntity, MJSearchScopeTestQueryEntity, MJSearchScopeEntity, MJSignatureAccountEntity, MJSignatureProviderEntity, MJSignatureRequestDocumentEntity, MJSignatureRequestLogEntity, MJSignatureRequestRecipientEntity, MJSignatureRequestEntity, MJSkillEntity, MJSQLDialectEntity, MJStateProvinceEntity, MJTagAuditLogEntity, MJTagCoOccurrenceEntity, MJTagScopeEntity, MJTagSuggestionEntity, MJTagSynonymEntity, MJTaggedItemEntity, MJTagEntity, MJTaskDependencyEntity, MJTaskTypeEntity, MJTaskEntity, MJTemplateCategoryEntity, MJTemplateContentTypeEntity, MJTemplateContentEntity, MJTemplateParamEntity, MJTemplateEntity, MJTestRubricEntity, MJTestRunFeedbackEntity, MJTestRunOutputTypeEntity, MJTestRunOutputEntity, MJTestRunEntity, MJTestSuiteRunEntity, MJTestSuiteTestEntity, MJTestSuiteEntity, MJTestTypeEntity, MJTestEntity, MJUserApplicationEntityEntity, MJUserApplicationEntity, MJUserFavoriteEntity, MJUserNotificationPreferenceEntity, MJUserNotificationTypeEntity, MJUserNotificationEntity, MJUserRecordLogEntity, MJUserRoleEntity, MJUserSettingEntity, MJUserViewCategoryEntity, MJUserViewRunDetailEntity, MJUserViewRunEntity, MJUserViewEntity, MJUserEntity, MJVectorDatabaseEntity, MJVectorIndexEntity, MJVersionInstallationEntity, MJVersionLabelItemEntity, MJVersionLabelRestoreEntity, MJVersionLabelEntity, MJViewTypeEntity, MJWorkflowEngineEntity, MJWorkflowRunEntity, MJWorkflowEntity, MJWorkspaceItemEntity, MJWorkspaceEntity } from '@memberjunction/core-entities';
21
+ import { MJAccessControlRuleEntity, MJActionAuthorizationEntity, MJActionCategoryEntity, MJActionContextTypeEntity, MJActionContextEntity, MJActionExecutionLogEntity, MJActionFilterEntity, MJActionLibraryEntity, MJActionParamEntity, MJActionResultCodeEntity, MJActionEntity, MJAIActionEntity, MJAIAgentActionEntity, MJAIAgentArtifactTypeEntity, MJAIAgentCategoryEntity, MJAIAgentChannelEntity, MJAIAgentClientToolEntity, MJAIAgentCoAgentEntity, MJAIAgentConfigurationEntity, MJAIAgentDataSourceEntity, MJAIAgentExampleEntity, MJAIAgentLearningCycleEntity, MJAIAgentModalityEntity, MJAIAgentModelEntity, MJAIAgentNoteTypeEntity, MJAIAgentNoteEntity, MJAIAgentPermissionEntity, MJAIAgentPromptEntity, MJAIAgentRelationshipEntity, MJAIAgentRequestTypeEntity, MJAIAgentRequestEntity, MJAIAgentRunMediaEntity, MJAIAgentRunStepEntity, MJAIAgentRunEntity, MJAIAgentSearchScopeEntity, MJAIAgentSessionBridgeParticipantEntity, MJAIAgentSessionBridgeEntity, MJAIAgentSessionChannelEntity, MJAIAgentSessionEntity, MJAIAgentSkillEntity, MJAIAgentStepPathEntity, MJAIAgentStepEntity, MJAIAgentTypeEntity, MJAIAgentEntity, MJAIArchitectureEntity, MJAIBridgeAgentIdentityEntity, MJAIBridgeProviderChannelEntity, MJAIBridgeProviderEntity, MJAIClientToolDefinitionEntity, MJAIConfigurationParamEntity, MJAIConfigurationEntity, MJAICredentialBindingEntity, MJAIModalityEntity, MJAIModelActionEntity, MJAIModelArchitectureEntity, MJAIModelCostEntity, MJAIModelModalityEntity, MJAIModelPriceTypeEntity, MJAIModelPriceUnitTypeEntity, MJAIModelTypeEntity, MJAIModelVendorEntity, MJAIModelEntity, MJAIPromptCategoryEntity, MJAIPromptModelEntity, MJAIPromptRunMediaEntity, MJAIPromptRunEntity, MJAIPromptTypeEntity, MJAIPromptEntity, MJAIRemoteBrowserProviderEntity, MJAIResultCacheEntity, MJAISkillActionEntity, MJAISkillPermissionEntity, MJAISkillSubAgentEntity, MJAISkillEntity, MJAIVendorTypeDefinitionEntity, MJAIVendorTypeEntity, MJAIVendorEntity, MJAPIApplicationScopeEntity, MJAPIApplicationEntity, MJAPIKeyApplicationEntity, MJAPIKeyScopeEntity, MJAPIKeyUsageLogEntity, MJAPIKeyEntity, MJAPIScopeEntity, MJApplicationEntityEntity, MJApplicationRoleEntity, MJApplicationSettingEntity, MJApplicationEntity, MJArchiveConfigurationEntityEntity, MJArchiveConfigurationEntity, MJArchiveRunDetailEntity, MJArchiveRunEntity, MJArtifactPermissionEntity, MJArtifactTypeEntity, MJArtifactUseEntity, MJArtifactVersionAttributeEntity, MJArtifactVersionEntity, MJArtifactEntity, MJAuditLogTypeEntity, MJAuditLogEntity, MJAuthorizationRoleEntity, MJAuthorizationEntity, MJClusterAnalysisEntity, MJClusterAnalysisClusterEntity, MJCollectionArtifactEntity, MJCollectionPermissionEntity, MJCollectionEntity, MJCommunicationBaseMessageTypeEntity, MJCommunicationLogEntity, MJCommunicationProviderMessageTypeEntity, MJCommunicationProviderEntity, MJCommunicationRunEntity, MJCompanyEntity, MJCompanyIntegrationEntityMapEntity, MJCompanyIntegrationFieldMapEntity, MJCompanyIntegrationRecordMapEntity, MJCompanyIntegrationRunAPILogEntity, MJCompanyIntegrationRunDetailEntity, MJCompanyIntegrationRunEntity, MJCompanyIntegrationSyncWatermarkEntity, MJCompanyIntegrationEntity, MJComponentDependencyEntity, MJComponentLibraryEntity, MJComponentLibraryLinkEntity, MJComponentRegistryEntity, MJComponentEntity, MJContentFileTypeEntity, MJContentItemAttributeEntity, MJContentItemDuplicateEntity, MJContentItemTagEntity, MJContentItemEntity, MJContentProcessRunDetailEntity, MJContentProcessRunPromptRunEntity, MJContentProcessRunEntity, MJContentSourceParamEntity, MJContentSourceTypeParamEntity, MJContentSourceTypeEntity, MJContentSourceEntity, MJContentTypeAttributeEntity, MJContentTypeEntity, MJConversationArtifactPermissionEntity, MJConversationArtifactVersionEntity, MJConversationArtifactEntity, MJConversationDetailArtifactEntity, MJConversationDetailAttachmentEntity, MJConversationDetailRatingEntity, MJConversationDetailEntity, MJConversationWidgetInstanceEntity, MJConversationEntity, MJCountryEntity, MJCredentialCategoryEntity, MJCredentialTypeEntity, MJCredentialEntity, MJDashboardCategoryEntity, MJDashboardCategoryLinkEntity, MJDashboardCategoryPermissionEntity, MJDashboardPartTypeEntity, MJDashboardPermissionEntity, MJDashboardUserPreferenceEntity, MJDashboardUserStateEntity, MJDashboardEntity, MJDataContextItemEntity, MJDataContextEntity, MJDatasetItemEntity, MJDatasetEntity, MJDuplicateRunDetailMatchEntity, MJDuplicateRunDetailEntity, MJDuplicateRunEntity, MJEmployeeCompanyIntegrationEntity, MJEmployeeRoleEntity, MJEmployeeSkillEntity, MJEmployeeEntity, MJEncryptionAlgorithmEntity, MJEncryptionKeySourceEntity, MJEncryptionKeyEntity, MJEntityEntity, MJEntityActionFilterEntity, MJEntityActionInvocationTypeEntity, MJEntityActionInvocationEntity, MJEntityActionParamEntity, MJEntityActionEntity, MJEntityAIActionEntity, MJEntityCommunicationFieldEntity, MJEntityCommunicationMessageTypeEntity, MJEntityDocumentRunEntity, MJEntityDocumentSettingEntity, MJEntityDocumentTypeEntity, MJEntityDocumentEntity, MJEntityFieldValueEntity, MJEntityFieldEntity, MJEntityFormOverrideEntity, MJEntityOrganicKeyRelatedEntityEntity, MJEntityOrganicKeyEntity, MJEntityPermissionEntity, MJEntityRecordDocumentEntity, MJEntityRelationshipDisplayComponentEntity, MJEntityRelationshipEntity, MJEntitySettingEntity, MJEnvironmentEntity, MJErrorLogEntity, MJExperimentSessionIterationEntity, MJExperimentSessionEntity, MJExperimentEntity, MJExplorerNavigationItemEntity, MJExternalDataSourceTypeEntity, MJExternalDataSourceEntity, MJFileCategoryEntity, MJFileEntityRecordLinkEntity, MJFileStorageAccountPermissionEntity, MJFileStorageAccountEntity, MJFileStorageProviderEntity, MJFileEntity, MJGeneratedCodeCategoryEntity, MJGeneratedCodeEntity, MJInstanceConfigurationEntity, MJIntegrationObjectFieldEntity, MJIntegrationObjectEntity, MJIntegrationSourceTypeEntity, MJIntegrationURLFormatEntity, MJIntegrationEntity, MJKnowledgeHubSavedSearchEntity, MJLibraryEntity, MJLibraryItemEntity, MJListCategoryEntity, MJListDetailEntity, MJListInvitationEntity, MJListShareEntity, MJListEntity, MJMagicLinkInviteAllowedDomainEntity, MJMagicLinkInviteAllowedPathEntity, MJMagicLinkInviteApplicationEntity, MJMagicLinkInviteRoleEntity, MJMagicLinkInviteEntity, MJMagicLinkRedemptionEntity, MJMCPServerConnectionPermissionEntity, MJMCPServerConnectionToolEntity, MJMCPServerConnectionEntity, MJMCPServerToolEntity, MJMCPServerEntity, MJMCPToolExecutionLogEntity, MJMCPToolFavoriteEntity, MJMLAlgorithmUseCaseRankingEntity, MJMLAlgorithmUseCaseEntity, MJMLAlgorithmEntity, MJMLModelScoringBindingEntity, MJMLModelEntity, MJMLTrainingPipelineEntity, MJMLTrainingRunEntity, MJOAuthAuthServerMetadataCacheEntity, MJOAuthAuthorizationStateEntity, MJOAuthClientRegistrationEntity, MJOAuthTokenEntity, MJOpenAppDependencyEntity, MJOpenAppInstallHistoryEntity, MJOpenAppEntity, MJOutputDeliveryTypeEntity, MJOutputFormatTypeEntity, MJOutputTriggerTypeEntity, MJPermissionDomainEntity, MJProcessRunDetailEntity, MJProcessRunEntity, MJProjectEntity, MJPublicLinkEntity, MJQueryEntity, MJQueryCategoryEntity, MJQueryDependencyEntity, MJQueryEntityEntity, MJQueryFieldEntity, MJQueryParameterEntity, MJQueryPermissionEntity, MJQuerySQLEntity, MJQueueTaskEntity, MJQueueTypeEntity, MJQueueEntity, MJRecommendationItemEntity, MJRecommendationProviderEntity, MJRecommendationRunEntity, MJRecommendationEntity, MJRecordChangeReplayRunEntity, MJRecordChangeEntity, MJRecordGeoCodeEntity, MJRecordLinkEntity, MJRecordMergeDeletionLogEntity, MJRecordMergeLogEntity, MJRecordProcessCategoryEntity, MJRecordProcessWatermarkEntity, MJRecordProcessEntity, MJRemoteOperationCategoryEntity, MJRemoteOperationEntity, MJReportCategoryEntity, MJReportSnapshotEntity, MJReportUserStateEntity, MJReportVersionEntity, MJReportEntity, MJResourceLinkEntity, MJResourcePermissionEntity, MJResourceTypeEntity, MJRoleEntity, MJRowLevelSecurityFilterEntity, MJScheduledActionParamEntity, MJScheduledActionEntity, MJScheduledJobRunEntity, MJScheduledJobTypeEntity, MJScheduledJobEntity, MJSchemaInfoEntity, MJScopedPromptPartEntity, MJSearchExecutionLogEntity, MJSearchProviderEntity, MJSearchScopeEntityEntity, MJSearchScopeExternalIndexEntity, MJSearchScopePermissionEntity, MJSearchScopeProviderEntity, MJSearchScopeStorageAccountEntity, MJSearchScopeTestQueryEntity, MJSearchScopeEntity, MJSignatureAccountEntity, MJSignatureProviderEntity, MJSignatureRequestDocumentEntity, MJSignatureRequestLogEntity, MJSignatureRequestRecipientEntity, MJSignatureRequestEntity, MJSkillEntity, MJSQLDialectEntity, MJStateProvinceEntity, MJTagAuditLogEntity, MJTagCoOccurrenceEntity, MJTagScopeEntity, MJTagSuggestionEntity, MJTagSynonymEntity, MJTaggedItemEntity, MJTagEntity, MJTaskDependencyEntity, MJTaskTypeEntity, MJTaskEntity, MJTemplateCategoryEntity, MJTemplateContentTypeEntity, MJTemplateContentEntity, MJTemplateParamEntity, MJTemplateEntity, MJTestRubricEntity, MJTestRunFeedbackEntity, MJTestRunOutputTypeEntity, MJTestRunOutputEntity, MJTestRunEntity, MJTestSuiteRunEntity, MJTestSuiteTestEntity, MJTestSuiteEntity, MJTestTypeEntity, MJTestEntity, MJUserApplicationEntityEntity, MJUserApplicationEntity, MJUserFavoriteEntity, MJUserNotificationPreferenceEntity, MJUserNotificationTypeEntity, MJUserNotificationEntity, MJUserRecordLogEntity, MJUserRoleEntity, MJUserRoutineRecipientEntity, MJUserRoutineRunEntity, MJUserRoutineEntity, MJUserSettingEntity, MJUserViewCategoryEntity, MJUserViewRunDetailEntity, MJUserViewRunEntity, MJUserViewEntity, MJUserEntity, MJVectorDatabaseEntity, MJVectorIndexEntity, MJVersionInstallationEntity, MJVersionLabelItemEntity, MJVersionLabelRestoreEntity, MJVersionLabelEntity, MJViewTypeEntity, MJWorkflowEngineEntity, MJWorkflowRunEntity, MJWorkflowEntity, MJWorkspaceItemEntity, MJWorkspaceEntity } from '@memberjunction/core-entities';
22
22
 
23
23
 
24
24
  //****************************************************************************
@@ -1034,6 +1034,9 @@ export class MJActionExecutionLog_ {
1034
1034
  @Field(() => [MJProcessRunDetail_])
1035
1035
  MJProcessRunDetails_ActionExecutionLogIDArray: MJProcessRunDetail_[]; // Link to MJProcessRunDetails
1036
1036
 
1037
+ @Field(() => [MJUserRoutineRun_])
1038
+ MJUserRoutineRuns_ActionExecutionLogIDArray: MJUserRoutineRun_[]; // Link to MJUserRoutineRuns
1039
+
1037
1040
  }
1038
1041
 
1039
1042
  //****************************************************************************
@@ -1179,6 +1182,16 @@ export class MJActionExecutionLogResolver extends ResolverBase {
1179
1182
  return result;
1180
1183
  }
1181
1184
 
1185
+ @FieldResolver(() => [MJUserRoutineRun_])
1186
+ async MJUserRoutineRuns_ActionExecutionLogIDArray(@Root() mjactionexecutionlog_: MJActionExecutionLog_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
1187
+ this.CheckUserReadPermissions('MJ: User Routine Runs', userPayload);
1188
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
1189
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutineRuns')} WHERE ${provider.QuoteIdentifier('ActionExecutionLogID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routine Runs', userPayload, EntityPermissionType.Read, 'AND');
1190
+ const rows = await provider.ExecuteSQL(sSQL, [mjactionexecutionlog_.ID], undefined, this.GetUserFromPayload(userPayload));
1191
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routine Runs', rows, this.GetUserFromPayload(userPayload));
1192
+ return result;
1193
+ }
1194
+
1182
1195
  @Mutation(() => MJActionExecutionLog_)
1183
1196
  async CreateMJActionExecutionLog(
1184
1197
  @Arg('input', () => CreateMJActionExecutionLogInput) input: CreateMJActionExecutionLogInput,
@@ -7676,6 +7689,9 @@ detailed information about what validation rules failed.`})
7676
7689
  @Field({nullable: true, description: `Human-readable notes and comments about this agent run step`})
7677
7690
  Comments?: string;
7678
7691
 
7692
+ @Field({nullable: true, description: `JSON array of skill-invocation records (AgentSkillInvocation[]) associating this step with the skills involved in it, or NULL when no skills are in play. Each record carries SkillID, SkillName, ActivationType (requested = user /skill mention; auto = agent self-activation), Provenance of authority (the gate values that admitted the skill: AcceptsSkills, both ActivationMode dials, and who requested it), and an optional agent-stated Reason when self-activated. Population: Skill steps record the activation(s) they performed; Prompt steps record the full set of skills in effect for that turn; Actions and Sub-Agent steps record the skill(s) through which the executed tool became available (NULL means the tool was a native grant).`})
7693
+ Skills?: string;
7694
+
7679
7695
  @Field({nullable: true})
7680
7696
  @MaxLength(255)
7681
7697
  AgentRun?: string;
@@ -7761,6 +7777,9 @@ export class CreateMJAIAgentRunStepInput {
7761
7777
  @Field({ nullable: true })
7762
7778
  Comments: string | null;
7763
7779
 
7780
+ @Field({ nullable: true })
7781
+ Skills: string | null;
7782
+
7764
7783
  @Field(() => RestoreContextInput, { nullable: true })
7765
7784
  RestoreContext___?: RestoreContextInput;
7766
7785
  }
@@ -7831,6 +7850,9 @@ export class UpdateMJAIAgentRunStepInput {
7831
7850
  @Field({ nullable: true })
7832
7851
  Comments?: string | null;
7833
7852
 
7853
+ @Field({ nullable: true })
7854
+ Skills?: string | null;
7855
+
7834
7856
  @Field(() => [KeyValuePairInput], { nullable: true })
7835
7857
  OldValues___?: KeyValuePairInput[];
7836
7858
 
@@ -8121,6 +8143,9 @@ each time the agent processes a prompt step.`})
8121
8143
  @MaxLength(36)
8122
8144
  AgentSessionID?: string;
8123
8145
 
8146
+ @Field(() => Boolean, {description: `1 when this run executed under plan mode (whether via the per-request planMode flag or the agent's RequirePlanMode setting). Drives plan-mode indicators in the run UX and supports plan-drift auditing (comparing the approved plan against the steps that actually executed).`})
8147
+ PlanMode: boolean;
8148
+
8124
8149
  @Field({nullable: true})
8125
8150
  @MaxLength(255)
8126
8151
  Agent?: string;
@@ -8216,6 +8241,9 @@ each time the agent processes a prompt step.`})
8216
8241
  @Field(() => [MJExperimentSession_])
8217
8242
  MJExperimentSessions_AgentRunIDArray: MJExperimentSession_[]; // Link to MJExperimentSessions
8218
8243
 
8244
+ @Field(() => [MJUserRoutineRun_])
8245
+ MJUserRoutineRuns_AgentRunIDArray: MJUserRoutineRun_[]; // Link to MJUserRoutineRuns
8246
+
8219
8247
  }
8220
8248
 
8221
8249
  //****************************************************************************
@@ -8367,6 +8395,9 @@ export class CreateMJAIAgentRunInput {
8367
8395
  @Field({ nullable: true })
8368
8396
  AgentSessionID: string | null;
8369
8397
 
8398
+ @Field(() => Boolean, { nullable: true })
8399
+ PlanMode?: boolean;
8400
+
8370
8401
  @Field(() => RestoreContextInput, { nullable: true })
8371
8402
  RestoreContext___?: RestoreContextInput;
8372
8403
  }
@@ -8521,6 +8552,9 @@ export class UpdateMJAIAgentRunInput {
8521
8552
  @Field({ nullable: true })
8522
8553
  AgentSessionID?: string | null;
8523
8554
 
8555
+ @Field(() => Boolean, { nullable: true })
8556
+ PlanMode?: boolean;
8557
+
8524
8558
  @Field(() => [KeyValuePairInput], { nullable: true })
8525
8559
  OldValues___?: KeyValuePairInput[];
8526
8560
 
@@ -8715,6 +8749,16 @@ export class MJAIAgentRunResolver extends ResolverBase {
8715
8749
  return result;
8716
8750
  }
8717
8751
 
8752
+ @FieldResolver(() => [MJUserRoutineRun_])
8753
+ async MJUserRoutineRuns_AgentRunIDArray(@Root() mjaiagentrun_: MJAIAgentRun_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
8754
+ this.CheckUserReadPermissions('MJ: User Routine Runs', userPayload);
8755
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
8756
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutineRuns')} WHERE ${provider.QuoteIdentifier('AgentRunID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routine Runs', userPayload, EntityPermissionType.Read, 'AND');
8757
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagentrun_.ID], undefined, this.GetUserFromPayload(userPayload));
8758
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routine Runs', rows, this.GetUserFromPayload(userPayload));
8759
+ return result;
8760
+ }
8761
+
8718
8762
  @Mutation(() => MJAIAgentRun_)
8719
8763
  async CreateMJAIAgentRun(
8720
8764
  @Arg('input', () => CreateMJAIAgentRunInput) input: CreateMJAIAgentRunInput,
@@ -9775,6 +9819,14 @@ export class MJAIAgentSession_ {
9775
9819
  @MaxLength(36)
9776
9820
  RecordingFileID?: string;
9777
9821
 
9822
+ @Field({nullable: true, description: `Polymorphic counterparty-identity entity. Foreign key to Entity — identifies WHICH entity this realtime session's counterparty resolved to (e.g. User, a member/contact record, BizAppsCommon Person). Paired with LinkedRecordID via the CK_AIAgentSession_LinkBinding both-or-neither check, mirroring Conversation's linked pair. NULL while the session's counterparty is anonymous/unresolved.`})
9823
+ @MaxLength(36)
9824
+ LinkedEntityID?: string;
9825
+
9826
+ @Field({nullable: true, description: `Polymorphic counterparty-identity record key. The primary-key value of the record (within LinkedEntityID's entity) this session resolved to, serialized as a string so any entity type can be referenced regardless of PK shape (UUID, int, composite). NVARCHAR(500), intentionally NOT FK-constrained. Used together with LinkedEntityID — see CK_AIAgentSession_LinkBinding. NULL while the session's counterparty is anonymous/unresolved.`})
9827
+ @MaxLength(500)
9828
+ LinkedRecordID?: string;
9829
+
9778
9830
  @Field({nullable: true})
9779
9831
  @MaxLength(255)
9780
9832
  Agent?: string;
@@ -9791,6 +9843,10 @@ export class MJAIAgentSession_ {
9791
9843
  @MaxLength(500)
9792
9844
  RecordingFile?: string;
9793
9845
 
9846
+ @Field({nullable: true})
9847
+ @MaxLength(255)
9848
+ LinkedEntity?: string;
9849
+
9794
9850
  @Field({nullable: true})
9795
9851
  @MaxLength(36)
9796
9852
  RootLastSessionID?: string;
@@ -9859,6 +9915,12 @@ export class CreateMJAIAgentSessionInput {
9859
9915
  @Field({ nullable: true })
9860
9916
  RecordingFileID: string | null;
9861
9917
 
9918
+ @Field({ nullable: true })
9919
+ LinkedEntityID: string | null;
9920
+
9921
+ @Field({ nullable: true })
9922
+ LinkedRecordID: string | null;
9923
+
9862
9924
  @Field(() => RestoreContextInput, { nullable: true })
9863
9925
  RestoreContext___?: RestoreContextInput;
9864
9926
  }
@@ -9911,6 +9973,12 @@ export class UpdateMJAIAgentSessionInput {
9911
9973
  @Field({ nullable: true })
9912
9974
  RecordingFileID?: string | null;
9913
9975
 
9976
+ @Field({ nullable: true })
9977
+ LinkedEntityID?: string | null;
9978
+
9979
+ @Field({ nullable: true })
9980
+ LinkedRecordID?: string | null;
9981
+
9914
9982
  @Field(() => [KeyValuePairInput], { nullable: true })
9915
9983
  OldValues___?: KeyValuePairInput[];
9916
9984
 
@@ -11344,6 +11412,13 @@ if this limit is exceeded.`})
11344
11412
  @MaxLength(20)
11345
11413
  AcceptsSkills: string;
11346
11414
 
11415
+ @Field({description: `Controls whether this agent may ever self-activate skills from its prompt catalog. Auto: the agent sees its allowed skills whose own ActivationMode is Auto (double gate) and may activate them mid-run on its own judgment. RequestedOnly (default): the agent's prompt catalog is empty and skills only enter a run via an explicit user request (/skill mention). Orthogonal to AcceptsSkills, which governs which skills are available at all; this governs who may pull the activation trigger.`})
11416
+ @MaxLength(20)
11417
+ SkillActivationMode: string;
11418
+
11419
+ @Field(() => Boolean, {description: `When 1, every root-level run of this agent executes in plan mode regardless of the per-request planMode flag — the agent must present a plan and receive human approval before any Actions or Sub-Agent steps execute. SupportsPlanMode is irrelevant when this is set. Use for high-consequence agents (e.g. ones with outbound-communication capabilities) where human-in-the-loop review is mandatory.`})
11420
+ RequirePlanMode: boolean;
11421
+
11347
11422
  @Field({nullable: true})
11348
11423
  @MaxLength(255)
11349
11424
  Parent?: string;
@@ -11501,6 +11576,9 @@ if this limit is exceeded.`})
11501
11576
  @Field(() => [MJAIAgentSkill_])
11502
11577
  MJAIAgentSkills_AgentIDArray: MJAIAgentSkill_[]; // Link to MJAIAgentSkills
11503
11578
 
11579
+ @Field(() => [MJConversationWidgetInstance_])
11580
+ MJConversationWidgetInstances_PinnedAgentIDArray: MJConversationWidgetInstance_[]; // Link to MJConversationWidgetInstances
11581
+
11504
11582
  @Field(() => [MJAISkillSubAgent_])
11505
11583
  MJAISkillSubAgents_SubAgentIDArray: MJAISkillSubAgent_[]; // Link to MJAISkillSubAgents
11506
11584
 
@@ -11727,6 +11805,12 @@ export class CreateMJAIAgentInput {
11727
11805
  @Field({ nullable: true })
11728
11806
  AcceptsSkills?: string;
11729
11807
 
11808
+ @Field({ nullable: true })
11809
+ SkillActivationMode?: string;
11810
+
11811
+ @Field(() => Boolean, { nullable: true })
11812
+ RequirePlanMode?: boolean;
11813
+
11730
11814
  @Field(() => RestoreContextInput, { nullable: true })
11731
11815
  RestoreContext___?: RestoreContextInput;
11732
11816
  }
@@ -11953,6 +12037,12 @@ export class UpdateMJAIAgentInput {
11953
12037
  @Field({ nullable: true })
11954
12038
  AcceptsSkills?: string;
11955
12039
 
12040
+ @Field({ nullable: true })
12041
+ SkillActivationMode?: string;
12042
+
12043
+ @Field(() => Boolean, { nullable: true })
12044
+ RequirePlanMode?: boolean;
12045
+
11956
12046
  @Field(() => [KeyValuePairInput], { nullable: true })
11957
12047
  OldValues___?: KeyValuePairInput[];
11958
12048
 
@@ -12367,6 +12457,16 @@ export class MJAIAgentResolver extends ResolverBase {
12367
12457
  return result;
12368
12458
  }
12369
12459
 
12460
+ @FieldResolver(() => [MJConversationWidgetInstance_])
12461
+ async MJConversationWidgetInstances_PinnedAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12462
+ this.CheckUserReadPermissions('MJ: Conversation Widget Instances', userPayload);
12463
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
12464
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversationWidgetInstances')} WHERE ${provider.QuoteIdentifier('PinnedAgentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Widget Instances', userPayload, EntityPermissionType.Read, 'AND');
12465
+ const rows = await provider.ExecuteSQL(sSQL, [mjaiagent_.ID], undefined, this.GetUserFromPayload(userPayload));
12466
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Widget Instances', rows, this.GetUserFromPayload(userPayload));
12467
+ return result;
12468
+ }
12469
+
12370
12470
  @FieldResolver(() => [MJAISkillSubAgent_])
12371
12471
  async MJAISkillSubAgents_SubAgentIDArray(@Root() mjaiagent_: MJAIAgent_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
12372
12472
  this.CheckUserReadPermissions('MJ: AI Skill Sub Agents', userPayload);
@@ -18052,6 +18152,9 @@ export class MJAIPromptRun_ {
18052
18152
  @Field(() => [MJDuplicateRunDetailMatch_])
18053
18153
  MJDuplicateRunDetailMatches_AIPromptRunIDArray: MJDuplicateRunDetailMatch_[]; // Link to MJDuplicateRunDetailMatches
18054
18154
 
18155
+ @Field(() => [MJUserRoutineRun_])
18156
+ MJUserRoutineRuns_PromptRunIDArray: MJUserRoutineRun_[]; // Link to MJUserRoutineRuns
18157
+
18055
18158
  }
18056
18159
 
18057
18160
  //****************************************************************************
@@ -18725,6 +18828,16 @@ export class MJAIPromptRunResolver extends ResolverBase {
18725
18828
  return result;
18726
18829
  }
18727
18830
 
18831
+ @FieldResolver(() => [MJUserRoutineRun_])
18832
+ async MJUserRoutineRuns_PromptRunIDArray(@Root() mjaipromptrun_: MJAIPromptRun_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
18833
+ this.CheckUserReadPermissions('MJ: User Routine Runs', userPayload);
18834
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
18835
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutineRuns')} WHERE ${provider.QuoteIdentifier('PromptRunID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routine Runs', userPayload, EntityPermissionType.Read, 'AND');
18836
+ const rows = await provider.ExecuteSQL(sSQL, [mjaipromptrun_.ID], undefined, this.GetUserFromPayload(userPayload));
18837
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routine Runs', rows, this.GetUserFromPayload(userPayload));
18838
+ return result;
18839
+ }
18840
+
18728
18841
  @Mutation(() => MJAIPromptRun_)
18729
18842
  async CreateMJAIPromptRun(
18730
18843
  @Arg('input', () => CreateMJAIPromptRunInput) input: CreateMJAIPromptRunInput,
@@ -20844,6 +20957,10 @@ export class MJAISkill_ {
20844
20957
  @Field()
20845
20958
  _mj__UpdatedAt: Date;
20846
20959
 
20960
+ @Field({description: `Controls whether this skill may ever be self-activated by an agent. Auto: the skill may appear in accepting agents' prompt catalogs and be activated mid-run on agent judgment — but only for agents whose own SkillActivationMode is also Auto (double gate). RequestedOnly (default): the skill is excluded from prompt catalogs entirely and can only be activated when the user explicitly requests it for the run (a /skill mention flowing through ExecuteAgentParams.requestedSkillIDs). All other activation gates (AcceptsSkills, skill Status, per-agent assignment, user Run permission) apply unchanged in both modes.`})
20961
+ @MaxLength(20)
20962
+ ActivationMode: string;
20963
+
20847
20964
  @Field()
20848
20965
  @MaxLength(100)
20849
20966
  CreatedByUser: string;
@@ -20894,6 +21011,9 @@ export class CreateMJAISkillInput {
20894
21011
  @Field({ nullable: true })
20895
21012
  CreatedByUserID?: string;
20896
21013
 
21014
+ @Field({ nullable: true })
21015
+ ActivationMode?: string;
21016
+
20897
21017
  @Field(() => RestoreContextInput, { nullable: true })
20898
21018
  RestoreContext___?: RestoreContextInput;
20899
21019
  }
@@ -20931,6 +21051,9 @@ export class UpdateMJAISkillInput {
20931
21051
  @Field({ nullable: true })
20932
21052
  CreatedByUserID?: string;
20933
21053
 
21054
+ @Field({ nullable: true })
21055
+ ActivationMode?: string;
21056
+
20934
21057
  @Field(() => [KeyValuePairInput], { nullable: true })
20935
21058
  OldValues___?: KeyValuePairInput[];
20936
21059
 
@@ -23864,6 +23987,9 @@ export class MJApplication_ {
23864
23987
  @Field(() => [MJMagicLinkInvite_])
23865
23988
  MJMagicLinkInvites_ApplicationIDArray: MJMagicLinkInvite_[]; // Link to MJMagicLinkInvites
23866
23989
 
23990
+ @Field(() => [MJConversationWidgetInstance_])
23991
+ MJConversationWidgetInstances_ApplicationIDArray: MJConversationWidgetInstance_[]; // Link to MJConversationWidgetInstances
23992
+
23867
23993
  }
23868
23994
 
23869
23995
  //****************************************************************************
@@ -24147,6 +24273,16 @@ export class MJApplicationResolver extends ResolverBase {
24147
24273
  return result;
24148
24274
  }
24149
24275
 
24276
+ @FieldResolver(() => [MJConversationWidgetInstance_])
24277
+ async MJConversationWidgetInstances_ApplicationIDArray(@Root() mjapplication_: MJApplication_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
24278
+ this.CheckUserReadPermissions('MJ: Conversation Widget Instances', userPayload);
24279
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
24280
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversationWidgetInstances')} WHERE ${provider.QuoteIdentifier('ApplicationID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Widget Instances', userPayload, EntityPermissionType.Read, 'AND');
24281
+ const rows = await provider.ExecuteSQL(sSQL, [mjapplication_.ID], undefined, this.GetUserFromPayload(userPayload));
24282
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Widget Instances', rows, this.GetUserFromPayload(userPayload));
24283
+ return result;
24284
+ }
24285
+
24150
24286
  @Mutation(() => MJApplication_)
24151
24287
  async CreateMJApplication(
24152
24288
  @Arg('input', () => CreateMJApplicationInput) input: CreateMJApplicationInput,
@@ -38301,6 +38437,301 @@ export class MJConversationDetailResolver extends ResolverBase {
38301
38437
 
38302
38438
  }
38303
38439
 
38440
+ //****************************************************************************
38441
+ // ENTITY CLASS for MJ: Conversation Widget Instances
38442
+ //****************************************************************************
38443
+ @ObjectType({ description: `Durable per-deployment configuration for one embeddable public support widget (text and/or voice). One row per site/embed. Resolves a public widget key to its application scope, pinned support agent, restricted guest role, allowed origins, modality, auth strategy, and abuse ceilings. Reuses the magic-link anonymous-embed minting path at session time; this entity holds only the configuration.` })
38444
+ export class MJConversationWidgetInstance_ {
38445
+ @Field()
38446
+ @MaxLength(36)
38447
+ ID: string;
38448
+
38449
+ @Field({description: `Human-readable name for this widget deployment (e.g. "Acme Marketing Site Support").`})
38450
+ @MaxLength(255)
38451
+ Name: string;
38452
+
38453
+ @Field({description: `Public, non-secret embed key (e.g. "pk_live_…") placed in the host page's data-widget-key attribute. Used to resolve this configuration at POST /widget/session. Unique. Not a credential — security comes from the origin allowlist, rate limits, the restricted guest role, and short-lived minted tokens.`})
38454
+ @MaxLength(100)
38455
+ PublicKey: string;
38456
+
38457
+ @Field({description: `Foreign key to Application — the single app a guest session is scoped to. Mirrors the magic-link single-application model.`})
38458
+ @MaxLength(36)
38459
+ ApplicationID: string;
38460
+
38461
+ @Field({description: `Foreign key to AIAgent — the support agent that is PINNED for every turn (passed as explicitAgentId). D5: pinning fixes which agent runs; combined with the restricted guest role it prevents a public visitor from reaching arbitrary agents/data. The pinned agent's own tool/handoff surface should be support-scoped.`})
38462
+ @MaxLength(36)
38463
+ PinnedAgentID: string;
38464
+
38465
+ @Field({description: `Foreign key to Role — the restricted guest role assigned to the synthesized guest principal. This role's entity permissions are the real authorization boundary (read/write only the visitor's own Conversation + Conversation Details). Roles ride per-session JWT claims, not DB rows on the shared Anonymous principal.`})
38466
+ @MaxLength(36)
38467
+ GuestRoleID: string;
38468
+
38469
+ @Field({nullable: true, description: `Allowed embedding origins for this widget, as a JSON array of origin strings (e.g. ["https://www.acme.com","https://acme.com"]). Enforced both at mint (POST /widget/session rejects unlisted Origin) and via CORS. NULL or empty means no origin is allowed (fail-closed).`})
38470
+ AllowedOrigins?: string;
38471
+
38472
+ @Field({description: `Which modalities this widget exposes: Text (chat only), Voice (client-direct realtime only), or Both. Gates whether the realtime-mint path is offered to the guest.`})
38473
+ @MaxLength(10)
38474
+ Modality: string;
38475
+
38476
+ @Field({description: `Pluggable public-auth strategy (D1): Anonymous (guest-first, default), MagicLinkUpgrade (guest may escalate to an email-verified session), or HostIdentity (an authenticated host portal posts a signed identity assertion exchanged for an MJ guest JWT). All three converge on AuthProviderFactory + buildMagicLinkSessionUser.`})
38477
+ @MaxLength(20)
38478
+ AuthStrategy: string;
38479
+
38480
+ @Field({description: `Lifecycle status. Active widgets mint sessions; Disabled widgets reject all mints (used to turn off a deployment without deleting its config).`})
38481
+ @MaxLength(20)
38482
+ Status: string;
38483
+
38484
+ @Field(() => Int, {description: `Time-to-live in minutes for a minted guest session JWT. Short by design (default 15) to limit replay/theft; the widget refreshes before expiry. Capped at 1440 (24h).`})
38485
+ SessionTTLMinutes: number;
38486
+
38487
+ @Field(() => Int, {description: `Maximum number of guest-session mints allowed per minute per source IP/origin for this widget. Reuses the magic-link rate-limit pattern.`})
38488
+ RateLimitPerMinute: number;
38489
+
38490
+ @Field(() => Int, {nullable: true, description: `Optional hard ceiling (minutes) on a single voice session's duration for this widget. NULL means fall back to the server-wide default. Voice is the biggest cost/abuse surface; the SessionJanitor enforces this server-side (W4).`})
38491
+ VoiceMaxSessionMinutes?: number;
38492
+
38493
+ @Field({nullable: true, description: `Which MJ interactive channels this widget may attach when a voice session is active, as a JSON array of channel names (e.g. ["Whiteboard"]). Resolved client-side through MJGlobal.ClassFactory the same way the realtime client driver is resolved; each named channel is scoped by the existing Widget Guest RLS on AI Agent Session Channels. NULL or empty array = no channels (the backwards-compatible default). Remote Browser, given its control surface, should only be listed when a deployment explicitly opts in.`})
38494
+ EnabledChannels?: string;
38495
+
38496
+ @Field({nullable: true, description: `PEM-encoded RS256 public key for the host-identity auth strategy (D1). When AuthStrategy is HostIdentity, the host signs a short-lived identity assertion with its private key; the HostIdentityProvider verifies it against this per-instance key. Supersedes the interim config map (mj.config.cjs hostPublicKeys keyed by PublicKey). NULL when the widget does not use host identity; a HostIdentity widget with no key fails closed at mint.`})
38497
+ HostPublicKey?: string;
38498
+
38499
+ @Field(() => Boolean, {description: `Returning-visitor memory opt-in (R6). When 0 (default) this widget sets no durable visitor cookie and writes no cross-session recap — fully off. When 1, the widget mints a durable VisitorKey cookie, links each new Conversation to the visitor's prior one, and writes a recap memory note on close so a returning visitor's agent opens with prior context.`})
38500
+ RememberReturningVisitors: boolean;
38501
+
38502
+ @Field(() => Int, {nullable: true, description: `Retention window (days) for returning-visitor recap memory notes generated by this widget. NULL means use the system default. Past this window the visitor's auto-generated recap notes decay/archive via the Memory Manager. Ignored when RememberReturningVisitors = 0.`})
38503
+ VisitorMemoryRetentionDays?: number;
38504
+
38505
+ @Field()
38506
+ _mj__CreatedAt: Date;
38507
+
38508
+ @Field()
38509
+ _mj__UpdatedAt: Date;
38510
+
38511
+ @Field()
38512
+ @MaxLength(100)
38513
+ Application: string;
38514
+
38515
+ @Field({nullable: true})
38516
+ @MaxLength(255)
38517
+ PinnedAgent?: string;
38518
+
38519
+ @Field()
38520
+ @MaxLength(50)
38521
+ GuestRole: string;
38522
+
38523
+ }
38524
+
38525
+ //****************************************************************************
38526
+ // INPUT TYPE for MJ: Conversation Widget Instances
38527
+ //****************************************************************************
38528
+ @InputType()
38529
+ export class CreateMJConversationWidgetInstanceInput {
38530
+ @Field({ nullable: true })
38531
+ ID?: string;
38532
+
38533
+ @Field({ nullable: true })
38534
+ Name?: string;
38535
+
38536
+ @Field({ nullable: true })
38537
+ PublicKey?: string;
38538
+
38539
+ @Field({ nullable: true })
38540
+ ApplicationID?: string;
38541
+
38542
+ @Field({ nullable: true })
38543
+ PinnedAgentID?: string;
38544
+
38545
+ @Field({ nullable: true })
38546
+ GuestRoleID?: string;
38547
+
38548
+ @Field({ nullable: true })
38549
+ AllowedOrigins: string | null;
38550
+
38551
+ @Field({ nullable: true })
38552
+ Modality?: string;
38553
+
38554
+ @Field({ nullable: true })
38555
+ AuthStrategy?: string;
38556
+
38557
+ @Field({ nullable: true })
38558
+ Status?: string;
38559
+
38560
+ @Field(() => Int, { nullable: true })
38561
+ SessionTTLMinutes?: number;
38562
+
38563
+ @Field(() => Int, { nullable: true })
38564
+ RateLimitPerMinute?: number;
38565
+
38566
+ @Field(() => Int, { nullable: true })
38567
+ VoiceMaxSessionMinutes: number | null;
38568
+
38569
+ @Field({ nullable: true })
38570
+ EnabledChannels: string | null;
38571
+
38572
+ @Field({ nullable: true })
38573
+ HostPublicKey: string | null;
38574
+
38575
+ @Field(() => Boolean, { nullable: true })
38576
+ RememberReturningVisitors?: boolean;
38577
+
38578
+ @Field(() => Int, { nullable: true })
38579
+ VisitorMemoryRetentionDays: number | null;
38580
+
38581
+ @Field(() => RestoreContextInput, { nullable: true })
38582
+ RestoreContext___?: RestoreContextInput;
38583
+ }
38584
+
38585
+
38586
+ //****************************************************************************
38587
+ // INPUT TYPE for MJ: Conversation Widget Instances
38588
+ //****************************************************************************
38589
+ @InputType()
38590
+ export class UpdateMJConversationWidgetInstanceInput {
38591
+ @Field()
38592
+ ID: string;
38593
+
38594
+ @Field({ nullable: true })
38595
+ Name?: string;
38596
+
38597
+ @Field({ nullable: true })
38598
+ PublicKey?: string;
38599
+
38600
+ @Field({ nullable: true })
38601
+ ApplicationID?: string;
38602
+
38603
+ @Field({ nullable: true })
38604
+ PinnedAgentID?: string;
38605
+
38606
+ @Field({ nullable: true })
38607
+ GuestRoleID?: string;
38608
+
38609
+ @Field({ nullable: true })
38610
+ AllowedOrigins?: string | null;
38611
+
38612
+ @Field({ nullable: true })
38613
+ Modality?: string;
38614
+
38615
+ @Field({ nullable: true })
38616
+ AuthStrategy?: string;
38617
+
38618
+ @Field({ nullable: true })
38619
+ Status?: string;
38620
+
38621
+ @Field(() => Int, { nullable: true })
38622
+ SessionTTLMinutes?: number;
38623
+
38624
+ @Field(() => Int, { nullable: true })
38625
+ RateLimitPerMinute?: number;
38626
+
38627
+ @Field(() => Int, { nullable: true })
38628
+ VoiceMaxSessionMinutes?: number | null;
38629
+
38630
+ @Field({ nullable: true })
38631
+ EnabledChannels?: string | null;
38632
+
38633
+ @Field({ nullable: true })
38634
+ HostPublicKey?: string | null;
38635
+
38636
+ @Field(() => Boolean, { nullable: true })
38637
+ RememberReturningVisitors?: boolean;
38638
+
38639
+ @Field(() => Int, { nullable: true })
38640
+ VisitorMemoryRetentionDays?: number | null;
38641
+
38642
+ @Field(() => [KeyValuePairInput], { nullable: true })
38643
+ OldValues___?: KeyValuePairInput[];
38644
+
38645
+ @Field(() => RestoreContextInput, { nullable: true })
38646
+ RestoreContext___?: RestoreContextInput;
38647
+ }
38648
+
38649
+ //****************************************************************************
38650
+ // RESOLVER for MJ: Conversation Widget Instances
38651
+ //****************************************************************************
38652
+ @ObjectType()
38653
+ export class RunMJConversationWidgetInstanceViewResult {
38654
+ @Field(() => [MJConversationWidgetInstance_])
38655
+ Results: MJConversationWidgetInstance_[];
38656
+
38657
+ @Field(() => String, {nullable: true})
38658
+ UserViewRunID?: string;
38659
+
38660
+ @Field(() => Int, {nullable: true})
38661
+ RowCount: number;
38662
+
38663
+ @Field(() => Int, {nullable: true})
38664
+ TotalRowCount: number;
38665
+
38666
+ @Field(() => Int, {nullable: true})
38667
+ ExecutionTime: number;
38668
+
38669
+ @Field({nullable: true})
38670
+ ErrorMessage?: string;
38671
+
38672
+ @Field(() => Boolean, {nullable: false})
38673
+ Success: boolean;
38674
+ }
38675
+
38676
+ @Resolver(MJConversationWidgetInstance_)
38677
+ export class MJConversationWidgetInstanceResolver extends ResolverBase {
38678
+ @Query(() => RunMJConversationWidgetInstanceViewResult)
38679
+ async RunMJConversationWidgetInstanceViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
38680
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
38681
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
38682
+ }
38683
+
38684
+ @Query(() => RunMJConversationWidgetInstanceViewResult)
38685
+ async RunMJConversationWidgetInstanceViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
38686
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
38687
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
38688
+ }
38689
+
38690
+ @Query(() => RunMJConversationWidgetInstanceViewResult)
38691
+ async RunMJConversationWidgetInstanceDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
38692
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
38693
+ input.EntityName = 'MJ: Conversation Widget Instances';
38694
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
38695
+ }
38696
+ @Query(() => MJConversationWidgetInstance_, { nullable: true })
38697
+ async MJConversationWidgetInstance(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJConversationWidgetInstance_ | null> {
38698
+ this.CheckUserReadPermissions('MJ: Conversation Widget Instances', userPayload);
38699
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
38700
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversationWidgetInstances')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Widget Instances', userPayload, EntityPermissionType.Read, 'AND');
38701
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
38702
+ const result = await this.MapFieldNamesToCodeNames('MJ: Conversation Widget Instances', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
38703
+ return result;
38704
+ }
38705
+
38706
+ @Mutation(() => MJConversationWidgetInstance_)
38707
+ async CreateMJConversationWidgetInstance(
38708
+ @Arg('input', () => CreateMJConversationWidgetInstanceInput) input: CreateMJConversationWidgetInstanceInput,
38709
+ @Ctx() { providers, userPayload }: AppContext,
38710
+ @PubSub() pubSub: PubSubEngine
38711
+ ) {
38712
+ const provider = GetReadWriteProvider(providers);
38713
+ return this.CreateRecord('MJ: Conversation Widget Instances', input, provider, userPayload, pubSub)
38714
+ }
38715
+
38716
+ @Mutation(() => MJConversationWidgetInstance_)
38717
+ async UpdateMJConversationWidgetInstance(
38718
+ @Arg('input', () => UpdateMJConversationWidgetInstanceInput) input: UpdateMJConversationWidgetInstanceInput,
38719
+ @Ctx() { providers, userPayload }: AppContext,
38720
+ @PubSub() pubSub: PubSubEngine
38721
+ ) {
38722
+ const provider = GetReadWriteProvider(providers);
38723
+ return this.UpdateRecord('MJ: Conversation Widget Instances', input, provider, userPayload, pubSub);
38724
+ }
38725
+
38726
+ @Mutation(() => MJConversationWidgetInstance_)
38727
+ async DeleteMJConversationWidgetInstance(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
38728
+ const provider = GetReadWriteProvider(providers);
38729
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
38730
+ return this.DeleteRecord('MJ: Conversation Widget Instances', key, options, provider, userPayload, pubSub);
38731
+ }
38732
+
38733
+ }
38734
+
38304
38735
  //****************************************************************************
38305
38736
  // ENTITY CLASS for MJ: Conversations
38306
38737
  //****************************************************************************
@@ -38392,6 +38823,14 @@ export class MJConversation_ {
38392
38823
  @MaxLength(255)
38393
38824
  EgressID?: string;
38394
38825
 
38826
+ @Field({nullable: true, description: `Durable, opaque returning-visitor anchor (R3). Holds the value of a long-lived first-party cookie minted by the widget on first visit, used to find this visitor's prior conversations while they are still anonymous. Distinct from ExternalID (which stays per-session for RLS isolation). NULL for conversations that are not widget returning-visitor sessions.`})
38827
+ @MaxLength(255)
38828
+ VisitorKey?: string;
38829
+
38830
+ @Field({nullable: true, description: `Conversation-altitude returning-visitor chain (R2). Self-foreign-key to the visitor's immediately prior Conversation (found by VisitorKey or the resolved LinkedEntityID/LinkedRecordID pair at mint time). History and memory are conversation-scoped, so the chain lives here — NOT on AIAgentSession.LastSessionID, which owns reconnect/resume semantics and is walked by the replay viewer. Named to mirror AIAgentSession.LastSessionID. NULL for a brand-new visitor's first conversation.`})
38831
+ @MaxLength(36)
38832
+ LastConversationID?: string;
38833
+
38395
38834
  @Field()
38396
38835
  @MaxLength(100)
38397
38836
  User: string;
@@ -38428,6 +38867,14 @@ export class MJConversation_ {
38428
38867
  @MaxLength(500)
38429
38868
  RecordingFile?: string;
38430
38869
 
38870
+ @Field({nullable: true})
38871
+ @MaxLength(255)
38872
+ LastConversation?: string;
38873
+
38874
+ @Field({nullable: true})
38875
+ @MaxLength(36)
38876
+ RootLastConversationID?: string;
38877
+
38431
38878
  @Field(() => [MJConversationDetail_])
38432
38879
  MJConversationDetails_ConversationIDArray: MJConversationDetail_[]; // Link to MJConversationDetails
38433
38880
 
@@ -38449,6 +38896,12 @@ export class MJConversation_ {
38449
38896
  @Field(() => [MJAIAgentSession_])
38450
38897
  MJAIAgentSessions_ConversationIDArray: MJAIAgentSession_[]; // Link to MJAIAgentSessions
38451
38898
 
38899
+ @Field(() => [MJConversation_])
38900
+ MJConversations_LastConversationIDArray: MJConversation_[]; // Link to MJConversations
38901
+
38902
+ @Field(() => [MJUserRoutine_])
38903
+ MJUserRoutines_ConversationIDArray: MJUserRoutine_[]; // Link to MJUserRoutines
38904
+
38452
38905
  }
38453
38906
 
38454
38907
  //****************************************************************************
@@ -38519,6 +38972,12 @@ export class CreateMJConversationInput {
38519
38972
  @Field({ nullable: true })
38520
38973
  EgressID: string | null;
38521
38974
 
38975
+ @Field({ nullable: true })
38976
+ VisitorKey: string | null;
38977
+
38978
+ @Field({ nullable: true })
38979
+ LastConversationID: string | null;
38980
+
38522
38981
  @Field(() => RestoreContextInput, { nullable: true })
38523
38982
  RestoreContext___?: RestoreContextInput;
38524
38983
  }
@@ -38592,6 +39051,12 @@ export class UpdateMJConversationInput {
38592
39051
  @Field({ nullable: true })
38593
39052
  EgressID?: string | null;
38594
39053
 
39054
+ @Field({ nullable: true })
39055
+ VisitorKey?: string | null;
39056
+
39057
+ @Field({ nullable: true })
39058
+ LastConversationID?: string | null;
39059
+
38595
39060
  @Field(() => [KeyValuePairInput], { nullable: true })
38596
39061
  OldValues___?: KeyValuePairInput[];
38597
39062
 
@@ -38726,6 +39191,26 @@ export class MJConversationResolver extends ResolverBase {
38726
39191
  return result;
38727
39192
  }
38728
39193
 
39194
+ @FieldResolver(() => [MJConversation_])
39195
+ async MJConversations_LastConversationIDArray(@Root() mjconversation_: MJConversation_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
39196
+ this.CheckUserReadPermissions('MJ: Conversations', userPayload);
39197
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39198
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversations')} WHERE ${provider.QuoteIdentifier('LastConversationID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversations', userPayload, EntityPermissionType.Read, 'AND');
39199
+ const rows = await provider.ExecuteSQL(sSQL, [mjconversation_.ID], undefined, this.GetUserFromPayload(userPayload));
39200
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversations', rows, this.GetUserFromPayload(userPayload));
39201
+ return result;
39202
+ }
39203
+
39204
+ @FieldResolver(() => [MJUserRoutine_])
39205
+ async MJUserRoutines_ConversationIDArray(@Root() mjconversation_: MJConversation_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
39206
+ this.CheckUserReadPermissions('MJ: User Routines', userPayload);
39207
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39208
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutines')} WHERE ${provider.QuoteIdentifier('ConversationID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routines', userPayload, EntityPermissionType.Read, 'AND');
39209
+ const rows = await provider.ExecuteSQL(sSQL, [mjconversation_.ID], undefined, this.GetUserFromPayload(userPayload));
39210
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routines', rows, this.GetUserFromPayload(userPayload));
39211
+ return result;
39212
+ }
39213
+
38729
39214
  @Mutation(() => MJConversation_)
38730
39215
  async CreateMJConversation(
38731
39216
  @Arg('input', () => CreateMJConversationInput) input: CreateMJConversationInput,
@@ -39237,6 +39722,9 @@ export class MJCredentialType_ {
39237
39722
  @Field(() => [MJIntegration_])
39238
39723
  MJIntegrations_CredentialTypeIDArray: MJIntegration_[]; // Link to MJIntegrations
39239
39724
 
39725
+ @Field(() => [MJExternalDataSourceType_])
39726
+ MJExternalDataSourceTypes_RequiredCredentialTypeIDArray: MJExternalDataSourceType_[]; // Link to MJExternalDataSourceTypes
39727
+
39240
39728
  @Field(() => [MJAIVendor_])
39241
39729
  MJAIVendors_CredentialTypeIDArray: MJAIVendor_[]; // Link to MJAIVendors
39242
39730
 
@@ -39393,6 +39881,16 @@ export class MJCredentialTypeResolver extends ResolverBase {
39393
39881
  return result;
39394
39882
  }
39395
39883
 
39884
+ @FieldResolver(() => [MJExternalDataSourceType_])
39885
+ async MJExternalDataSourceTypes_RequiredCredentialTypeIDArray(@Root() mjcredentialtype_: MJCredentialType_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
39886
+ this.CheckUserReadPermissions('MJ: External Data Source Types', userPayload);
39887
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
39888
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwExternalDataSourceTypes')} WHERE ${provider.QuoteIdentifier('RequiredCredentialTypeID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: External Data Source Types', userPayload, EntityPermissionType.Read, 'AND');
39889
+ const rows = await provider.ExecuteSQL(sSQL, [mjcredentialtype_.ID], undefined, this.GetUserFromPayload(userPayload));
39890
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: External Data Source Types', rows, this.GetUserFromPayload(userPayload));
39891
+ return result;
39892
+ }
39893
+
39396
39894
  @FieldResolver(() => [MJAIVendor_])
39397
39895
  async MJAIVendors_CredentialTypeIDArray(@Root() mjcredentialtype_: MJCredentialType_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
39398
39896
  this.CheckUserReadPermissions('MJ: AI Vendors', userPayload);
@@ -39516,6 +40014,9 @@ export class MJCredential_ {
39516
40014
  @Field(() => [MJSignatureAccount_])
39517
40015
  MJSignatureAccounts_CredentialIDArray: MJSignatureAccount_[]; // Link to MJSignatureAccounts
39518
40016
 
40017
+ @Field(() => [MJExternalDataSource_])
40018
+ MJExternalDataSources_CredentialIDArray: MJExternalDataSource_[]; // Link to MJExternalDataSources
40019
+
39519
40020
  }
39520
40021
 
39521
40022
  //****************************************************************************
@@ -39749,6 +40250,16 @@ export class MJCredentialResolver extends ResolverBase {
39749
40250
  return result;
39750
40251
  }
39751
40252
 
40253
+ @FieldResolver(() => [MJExternalDataSource_])
40254
+ async MJExternalDataSources_CredentialIDArray(@Root() mjcredential_: MJCredential_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
40255
+ this.CheckUserReadPermissions('MJ: External Data Sources', userPayload);
40256
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
40257
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwExternalDataSources')} WHERE ${provider.QuoteIdentifier('CredentialID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: External Data Sources', userPayload, EntityPermissionType.Read, 'AND');
40258
+ const rows = await provider.ExecuteSQL(sSQL, [mjcredential_.ID], undefined, this.GetUserFromPayload(userPayload));
40259
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: External Data Sources', rows, this.GetUserFromPayload(userPayload));
40260
+ return result;
40261
+ }
40262
+
39752
40263
  @Mutation(() => MJCredential_)
39753
40264
  async CreateMJCredential(
39754
40265
  @Arg('input', () => CreateMJCredentialInput) input: CreateMJCredentialInput,
@@ -44919,6 +45430,14 @@ export class MJEntity_ {
44919
45430
  @Field(() => Boolean, {description: `When set to 1 AND TrackRecordChanges is also 1, the external change detection system will scan this entity for changes made outside the MJ framework (direct SQL, third-party tools, etc.) and replay them through Save() to create proper RecordChange audit entries. Default is 0 (opt-out) because most entities, especially __mj schema metadata tables, are managed by migrations/CodeGen and should not be scanned.`})
44920
45431
  DetectExternalChanges: boolean;
44921
45432
 
45433
+ @Field({nullable: true})
45434
+ @MaxLength(36)
45435
+ ExternalDataSourceID?: string;
45436
+
45437
+ @Field({nullable: true, description: `Remote object name (table / view / collection) on the external system that backs this entity. Resolved against the data source DefaultSchema/DefaultDatabase when unqualified. Only meaningful when ExternalDataSourceID is set.`})
45438
+ @MaxLength(255)
45439
+ ExternalObjectName?: string;
45440
+
44922
45441
  @Field({nullable: true, description: `Schema-based programmatic code name derived from the entity Name. Uses GetClassNameSchemaPrefix(SchemaName) as the prefix, then strips EntityNamePrefix from the Name and removes spaces. For "__mj" schema with entity "MJ: AI Models", this produces "MJAIModels". For entities in other schemas, the sanitized schema name is prepended. Used in GraphQL type generation and internal code references.`})
44923
45442
  CodeName?: string;
44924
45443
 
@@ -45148,6 +45667,9 @@ export class MJEntity_ {
45148
45667
  @Field(() => [MJMLModelScoringBinding_])
45149
45668
  MJMLModelScoringBindings_TargetEntityIDArray: MJMLModelScoringBinding_[]; // Link to MJMLModelScoringBindings
45150
45669
 
45670
+ @Field(() => [MJAIAgentSession_])
45671
+ MJAIAgentSessions_LinkedEntityIDArray: MJAIAgentSession_[]; // Link to MJAIAgentSessions
45672
+
45151
45673
  @Field(() => [MJScopedPromptPart_])
45152
45674
  MJScopedPromptParts_PrimaryScopeEntityIDArray: MJScopedPromptPart_[]; // Link to MJScopedPromptParts
45153
45675
 
@@ -45341,6 +45863,12 @@ export class CreateMJEntityInput {
45341
45863
  @Field(() => Boolean, { nullable: true })
45342
45864
  DetectExternalChanges?: boolean;
45343
45865
 
45866
+ @Field({ nullable: true })
45867
+ ExternalDataSourceID: string | null;
45868
+
45869
+ @Field({ nullable: true })
45870
+ ExternalObjectName: string | null;
45871
+
45344
45872
  @Field(() => RestoreContextInput, { nullable: true })
45345
45873
  RestoreContext___?: RestoreContextInput;
45346
45874
  }
@@ -45534,6 +46062,12 @@ export class UpdateMJEntityInput {
45534
46062
  @Field(() => Boolean, { nullable: true })
45535
46063
  DetectExternalChanges?: boolean;
45536
46064
 
46065
+ @Field({ nullable: true })
46066
+ ExternalDataSourceID?: string | null;
46067
+
46068
+ @Field({ nullable: true })
46069
+ ExternalObjectName?: string | null;
46070
+
45537
46071
  @Field(() => [KeyValuePairInput], { nullable: true })
45538
46072
  OldValues___?: KeyValuePairInput[];
45539
46073
 
@@ -46288,6 +46822,16 @@ export class MJEntityResolverBase extends ResolverBase {
46288
46822
  return result;
46289
46823
  }
46290
46824
 
46825
+ @FieldResolver(() => [MJAIAgentSession_])
46826
+ async MJAIAgentSessions_LinkedEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
46827
+ this.CheckUserReadPermissions('MJ: AI Agent Sessions', userPayload);
46828
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
46829
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwAIAgentSessions')} WHERE ${provider.QuoteIdentifier('LinkedEntityID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Sessions', userPayload, EntityPermissionType.Read, 'AND');
46830
+ const rows = await provider.ExecuteSQL(sSQL, [mjentity_.ID], undefined, this.GetUserFromPayload(userPayload));
46831
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Sessions', rows, this.GetUserFromPayload(userPayload));
46832
+ return result;
46833
+ }
46834
+
46291
46835
  @FieldResolver(() => [MJScopedPromptPart_])
46292
46836
  async MJScopedPromptParts_PrimaryScopeEntityIDArray(@Root() mjentity_: MJEntity_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
46293
46837
  this.CheckUserReadPermissions('MJ: Scoped Prompt Parts', userPayload);
@@ -51686,6 +52230,9 @@ export class MJEnvironment_ {
51686
52230
  @Field(() => [MJConversation_])
51687
52231
  MJConversations_EnvironmentIDArray: MJConversation_[]; // Link to MJConversations
51688
52232
 
52233
+ @Field(() => [MJUserRoutine_])
52234
+ MJUserRoutines_EnvironmentIDArray: MJUserRoutine_[]; // Link to MJUserRoutines
52235
+
51689
52236
  }
51690
52237
 
51691
52238
  //****************************************************************************
@@ -51867,6 +52414,16 @@ export class MJEnvironmentResolver extends ResolverBase {
51867
52414
  return result;
51868
52415
  }
51869
52416
 
52417
+ @FieldResolver(() => [MJUserRoutine_])
52418
+ async MJUserRoutines_EnvironmentIDArray(@Root() mjenvironment_: MJEnvironment_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
52419
+ this.CheckUserReadPermissions('MJ: User Routines', userPayload);
52420
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
52421
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutines')} WHERE ${provider.QuoteIdentifier('EnvironmentID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routines', userPayload, EntityPermissionType.Read, 'AND');
52422
+ const rows = await provider.ExecuteSQL(sSQL, [mjenvironment_.ID], undefined, this.GetUserFromPayload(userPayload));
52423
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routines', rows, this.GetUserFromPayload(userPayload));
52424
+ return result;
52425
+ }
52426
+
51870
52427
  @Mutation(() => MJEnvironment_)
51871
52428
  async CreateMJEnvironment(
51872
52429
  @Arg('input', () => CreateMJEnvironmentInput) input: CreateMJEnvironmentInput,
@@ -53004,6 +53561,530 @@ export class MJExplorerNavigationItemResolver extends ResolverBase {
53004
53561
 
53005
53562
  }
53006
53563
 
53564
+ //****************************************************************************
53565
+ // ENTITY CLASS for MJ: External Data Source Types
53566
+ //****************************************************************************
53567
+ @ObjectType()
53568
+ export class MJExternalDataSourceType_ {
53569
+ @Field()
53570
+ @MaxLength(36)
53571
+ ID: string;
53572
+
53573
+ @Field({description: `Display name of the external data source driver type (e.g. Snowflake, Oracle, MongoDB, PostgreSQL).`})
53574
+ @MaxLength(100)
53575
+ Name: string;
53576
+
53577
+ @Field({nullable: true, description: `Human-readable description of the driver type and what remote systems it targets.`})
53578
+ Description?: string;
53579
+
53580
+ @Field({description: `Driver class resolved at runtime via MJGlobal.ClassFactory.CreateInstance(BaseExternalDataSourceDriver, DriverClass). MUST match the @RegisterClass key on the concrete driver (e.g. 'SnowflakeExternalDriver').`})
53581
+ @MaxLength(255)
53582
+ DriverClass: string;
53583
+
53584
+ @Field({nullable: true})
53585
+ @MaxLength(36)
53586
+ RequiredCredentialTypeID?: string;
53587
+
53588
+ @Field({description: `How the metadata-introspection command hydrates Entity/EntityField rows from this driver family: InformationSchema (ANSI INFORMATION_SCHEMA), NativeCatalog (vendor catalog views), SampledDocuments (infer shape from sampled documents, e.g. MongoDB), or Manual (no automated introspection).`})
53589
+ @MaxLength(17)
53590
+ MetadataIntrospectionStrategy: string;
53591
+
53592
+ @Field({description: `Dialect the driver expects for RunView filter pass-through: tsql, ansi, pgsql, mysql, oracle, or mongo-ast (MongoDB filter AST translated within the driver).`})
53593
+ @MaxLength(9)
53594
+ FilterDialect: string;
53595
+
53596
+ @Field({description: `Pagination mechanism the driver uses: OffsetFetch (SQL Server OFFSET/FETCH), LimitOffset (Postgres/MySQL LIMIT/OFFSET), TopSkip, or Cursor.`})
53597
+ @MaxLength(11)
53598
+ PagingStrategy: string;
53599
+
53600
+ @Field(() => Boolean, {description: `Whether the driver can introspect remote schema metadata to assist Entity/EntityField generation.`})
53601
+ SupportsSchemaIntrospection: boolean;
53602
+
53603
+ @Field(() => Boolean, {description: `Whether the driver supports native-dialect query execution for MJ Queries that set ExternalDataSourceID.`})
53604
+ SupportsNativeQueries: boolean;
53605
+
53606
+ @Field(() => Boolean, {description: `Reserved for a future write-capable phase. Always 0 in the current read-only design; external entities are read-only.`})
53607
+ SupportsReadWrite: boolean;
53608
+
53609
+ @Field({description: `Lifecycle status of the driver-type catalog entry: Active or Deprecated.`})
53610
+ @MaxLength(10)
53611
+ Status: string;
53612
+
53613
+ @Field()
53614
+ _mj__CreatedAt: Date;
53615
+
53616
+ @Field()
53617
+ _mj__UpdatedAt: Date;
53618
+
53619
+ @Field({nullable: true})
53620
+ @MaxLength(100)
53621
+ RequiredCredentialType?: string;
53622
+
53623
+ @Field(() => [MJExternalDataSource_])
53624
+ MJExternalDataSources_TypeIDArray: MJExternalDataSource_[]; // Link to MJExternalDataSources
53625
+
53626
+ }
53627
+
53628
+ //****************************************************************************
53629
+ // INPUT TYPE for MJ: External Data Source Types
53630
+ //****************************************************************************
53631
+ @InputType()
53632
+ export class CreateMJExternalDataSourceTypeInput {
53633
+ @Field({ nullable: true })
53634
+ ID?: string;
53635
+
53636
+ @Field({ nullable: true })
53637
+ Name?: string;
53638
+
53639
+ @Field({ nullable: true })
53640
+ Description: string | null;
53641
+
53642
+ @Field({ nullable: true })
53643
+ DriverClass?: string;
53644
+
53645
+ @Field({ nullable: true })
53646
+ RequiredCredentialTypeID: string | null;
53647
+
53648
+ @Field({ nullable: true })
53649
+ MetadataIntrospectionStrategy?: string;
53650
+
53651
+ @Field({ nullable: true })
53652
+ FilterDialect?: string;
53653
+
53654
+ @Field({ nullable: true })
53655
+ PagingStrategy?: string;
53656
+
53657
+ @Field(() => Boolean, { nullable: true })
53658
+ SupportsSchemaIntrospection?: boolean;
53659
+
53660
+ @Field(() => Boolean, { nullable: true })
53661
+ SupportsNativeQueries?: boolean;
53662
+
53663
+ @Field(() => Boolean, { nullable: true })
53664
+ SupportsReadWrite?: boolean;
53665
+
53666
+ @Field({ nullable: true })
53667
+ Status?: string;
53668
+
53669
+ @Field(() => RestoreContextInput, { nullable: true })
53670
+ RestoreContext___?: RestoreContextInput;
53671
+ }
53672
+
53673
+
53674
+ //****************************************************************************
53675
+ // INPUT TYPE for MJ: External Data Source Types
53676
+ //****************************************************************************
53677
+ @InputType()
53678
+ export class UpdateMJExternalDataSourceTypeInput {
53679
+ @Field()
53680
+ ID: string;
53681
+
53682
+ @Field({ nullable: true })
53683
+ Name?: string;
53684
+
53685
+ @Field({ nullable: true })
53686
+ Description?: string | null;
53687
+
53688
+ @Field({ nullable: true })
53689
+ DriverClass?: string;
53690
+
53691
+ @Field({ nullable: true })
53692
+ RequiredCredentialTypeID?: string | null;
53693
+
53694
+ @Field({ nullable: true })
53695
+ MetadataIntrospectionStrategy?: string;
53696
+
53697
+ @Field({ nullable: true })
53698
+ FilterDialect?: string;
53699
+
53700
+ @Field({ nullable: true })
53701
+ PagingStrategy?: string;
53702
+
53703
+ @Field(() => Boolean, { nullable: true })
53704
+ SupportsSchemaIntrospection?: boolean;
53705
+
53706
+ @Field(() => Boolean, { nullable: true })
53707
+ SupportsNativeQueries?: boolean;
53708
+
53709
+ @Field(() => Boolean, { nullable: true })
53710
+ SupportsReadWrite?: boolean;
53711
+
53712
+ @Field({ nullable: true })
53713
+ Status?: string;
53714
+
53715
+ @Field(() => [KeyValuePairInput], { nullable: true })
53716
+ OldValues___?: KeyValuePairInput[];
53717
+
53718
+ @Field(() => RestoreContextInput, { nullable: true })
53719
+ RestoreContext___?: RestoreContextInput;
53720
+ }
53721
+
53722
+ //****************************************************************************
53723
+ // RESOLVER for MJ: External Data Source Types
53724
+ //****************************************************************************
53725
+ @ObjectType()
53726
+ export class RunMJExternalDataSourceTypeViewResult {
53727
+ @Field(() => [MJExternalDataSourceType_])
53728
+ Results: MJExternalDataSourceType_[];
53729
+
53730
+ @Field(() => String, {nullable: true})
53731
+ UserViewRunID?: string;
53732
+
53733
+ @Field(() => Int, {nullable: true})
53734
+ RowCount: number;
53735
+
53736
+ @Field(() => Int, {nullable: true})
53737
+ TotalRowCount: number;
53738
+
53739
+ @Field(() => Int, {nullable: true})
53740
+ ExecutionTime: number;
53741
+
53742
+ @Field({nullable: true})
53743
+ ErrorMessage?: string;
53744
+
53745
+ @Field(() => Boolean, {nullable: false})
53746
+ Success: boolean;
53747
+ }
53748
+
53749
+ @Resolver(MJExternalDataSourceType_)
53750
+ export class MJExternalDataSourceTypeResolver extends ResolverBase {
53751
+ @Query(() => RunMJExternalDataSourceTypeViewResult)
53752
+ async RunMJExternalDataSourceTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
53753
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
53754
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
53755
+ }
53756
+
53757
+ @Query(() => RunMJExternalDataSourceTypeViewResult)
53758
+ async RunMJExternalDataSourceTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
53759
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
53760
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
53761
+ }
53762
+
53763
+ @Query(() => RunMJExternalDataSourceTypeViewResult)
53764
+ async RunMJExternalDataSourceTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
53765
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
53766
+ input.EntityName = 'MJ: External Data Source Types';
53767
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
53768
+ }
53769
+ @Query(() => MJExternalDataSourceType_, { nullable: true })
53770
+ async MJExternalDataSourceType(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJExternalDataSourceType_ | null> {
53771
+ this.CheckUserReadPermissions('MJ: External Data Source Types', userPayload);
53772
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
53773
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwExternalDataSourceTypes')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: External Data Source Types', userPayload, EntityPermissionType.Read, 'AND');
53774
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
53775
+ const result = await this.MapFieldNamesToCodeNames('MJ: External Data Source Types', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
53776
+ return result;
53777
+ }
53778
+
53779
+ @FieldResolver(() => [MJExternalDataSource_])
53780
+ async MJExternalDataSources_TypeIDArray(@Root() mjexternaldatasourcetype_: MJExternalDataSourceType_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
53781
+ this.CheckUserReadPermissions('MJ: External Data Sources', userPayload);
53782
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
53783
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwExternalDataSources')} WHERE ${provider.QuoteIdentifier('TypeID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: External Data Sources', userPayload, EntityPermissionType.Read, 'AND');
53784
+ const rows = await provider.ExecuteSQL(sSQL, [mjexternaldatasourcetype_.ID], undefined, this.GetUserFromPayload(userPayload));
53785
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: External Data Sources', rows, this.GetUserFromPayload(userPayload));
53786
+ return result;
53787
+ }
53788
+
53789
+ @Mutation(() => MJExternalDataSourceType_)
53790
+ async CreateMJExternalDataSourceType(
53791
+ @Arg('input', () => CreateMJExternalDataSourceTypeInput) input: CreateMJExternalDataSourceTypeInput,
53792
+ @Ctx() { providers, userPayload }: AppContext,
53793
+ @PubSub() pubSub: PubSubEngine
53794
+ ) {
53795
+ const provider = GetReadWriteProvider(providers);
53796
+ return this.CreateRecord('MJ: External Data Source Types', input, provider, userPayload, pubSub)
53797
+ }
53798
+
53799
+ @Mutation(() => MJExternalDataSourceType_)
53800
+ async UpdateMJExternalDataSourceType(
53801
+ @Arg('input', () => UpdateMJExternalDataSourceTypeInput) input: UpdateMJExternalDataSourceTypeInput,
53802
+ @Ctx() { providers, userPayload }: AppContext,
53803
+ @PubSub() pubSub: PubSubEngine
53804
+ ) {
53805
+ const provider = GetReadWriteProvider(providers);
53806
+ return this.UpdateRecord('MJ: External Data Source Types', input, provider, userPayload, pubSub);
53807
+ }
53808
+
53809
+ @Mutation(() => MJExternalDataSourceType_)
53810
+ async DeleteMJExternalDataSourceType(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
53811
+ const provider = GetReadWriteProvider(providers);
53812
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
53813
+ return this.DeleteRecord('MJ: External Data Source Types', key, options, provider, userPayload, pubSub);
53814
+ }
53815
+
53816
+ }
53817
+
53818
+ //****************************************************************************
53819
+ // ENTITY CLASS for MJ: External Data Sources
53820
+ //****************************************************************************
53821
+ @ObjectType()
53822
+ export class MJExternalDataSource_ {
53823
+ @Field()
53824
+ @MaxLength(36)
53825
+ ID: string;
53826
+
53827
+ @Field({description: `Display name of this configured external data source instance.`})
53828
+ @MaxLength(100)
53829
+ Name: string;
53830
+
53831
+ @Field({nullable: true, description: `Human-readable description of what this data source connects to and what it is used for.`})
53832
+ Description?: string;
53833
+
53834
+ @Field()
53835
+ @MaxLength(36)
53836
+ TypeID: string;
53837
+
53838
+ @Field({nullable: true})
53839
+ @MaxLength(36)
53840
+ CredentialID?: string;
53841
+
53842
+ @Field({nullable: true, description: `Default schema/namespace to resolve unqualified ExternalObjectName values against on the remote system (e.g. a SQL schema, Snowflake schema).`})
53843
+ @MaxLength(255)
53844
+ DefaultSchema?: string;
53845
+
53846
+ @Field({nullable: true, description: `Default database/catalog on the remote system (e.g. Snowflake database, MongoDB dbName). Nullable when the driver derives it from connection config.`})
53847
+ @MaxLength(255)
53848
+ DefaultDatabase?: string;
53849
+
53850
+ @Field({nullable: true, description: `JSON blob of NON-SECRET driver configuration (host, port, region, warehouse, replica-set name, pool sizing). All secrets flow through CredentialID -> Credential -> CredentialEngine; never store secrets here.`})
53851
+ ConnectionConfig?: string;
53852
+
53853
+ @Field(() => Int, {description: `Default server-side cache TTL (seconds) for reads against this source. External reads use time-based TTL because no event-driven invalidation is possible on remote systems. Default 300.`})
53854
+ DefaultCacheTTLSeconds: number;
53855
+
53856
+ @Field({description: `Operational status of this data source: Active (usable), Disabled (RunView fails fast), or TestFailed (last connection test failed).`})
53857
+ @MaxLength(10)
53858
+ Status: string;
53859
+
53860
+ @Field({nullable: true, description: `Timestamp of the most recent connection test against this source.`})
53861
+ LastConnectionTestAt?: Date;
53862
+
53863
+ @Field({nullable: true, description: `Result message from the most recent connection test (success detail or error text).`})
53864
+ LastConnectionTestResult?: string;
53865
+
53866
+ @Field()
53867
+ _mj__CreatedAt: Date;
53868
+
53869
+ @Field()
53870
+ _mj__UpdatedAt: Date;
53871
+
53872
+ @Field()
53873
+ @MaxLength(100)
53874
+ Type: string;
53875
+
53876
+ @Field({nullable: true})
53877
+ @MaxLength(200)
53878
+ Credential?: string;
53879
+
53880
+ @Field(() => [MJQuery_])
53881
+ MJQueries_ExternalDataSourceIDArray: MJQuery_[]; // Link to MJQueries
53882
+
53883
+ @Field(() => [MJEntity_])
53884
+ MJEntities_ExternalDataSourceIDArray: MJEntity_[]; // Link to MJEntities
53885
+
53886
+ }
53887
+
53888
+ //****************************************************************************
53889
+ // INPUT TYPE for MJ: External Data Sources
53890
+ //****************************************************************************
53891
+ @InputType()
53892
+ export class CreateMJExternalDataSourceInput {
53893
+ @Field({ nullable: true })
53894
+ ID?: string;
53895
+
53896
+ @Field({ nullable: true })
53897
+ Name?: string;
53898
+
53899
+ @Field({ nullable: true })
53900
+ Description: string | null;
53901
+
53902
+ @Field({ nullable: true })
53903
+ TypeID?: string;
53904
+
53905
+ @Field({ nullable: true })
53906
+ CredentialID: string | null;
53907
+
53908
+ @Field({ nullable: true })
53909
+ DefaultSchema: string | null;
53910
+
53911
+ @Field({ nullable: true })
53912
+ DefaultDatabase: string | null;
53913
+
53914
+ @Field({ nullable: true })
53915
+ ConnectionConfig: string | null;
53916
+
53917
+ @Field(() => Int, { nullable: true })
53918
+ DefaultCacheTTLSeconds?: number;
53919
+
53920
+ @Field({ nullable: true })
53921
+ Status?: string;
53922
+
53923
+ @Field({ nullable: true })
53924
+ LastConnectionTestAt: Date | null;
53925
+
53926
+ @Field({ nullable: true })
53927
+ LastConnectionTestResult: string | null;
53928
+
53929
+ @Field(() => RestoreContextInput, { nullable: true })
53930
+ RestoreContext___?: RestoreContextInput;
53931
+ }
53932
+
53933
+
53934
+ //****************************************************************************
53935
+ // INPUT TYPE for MJ: External Data Sources
53936
+ //****************************************************************************
53937
+ @InputType()
53938
+ export class UpdateMJExternalDataSourceInput {
53939
+ @Field()
53940
+ ID: string;
53941
+
53942
+ @Field({ nullable: true })
53943
+ Name?: string;
53944
+
53945
+ @Field({ nullable: true })
53946
+ Description?: string | null;
53947
+
53948
+ @Field({ nullable: true })
53949
+ TypeID?: string;
53950
+
53951
+ @Field({ nullable: true })
53952
+ CredentialID?: string | null;
53953
+
53954
+ @Field({ nullable: true })
53955
+ DefaultSchema?: string | null;
53956
+
53957
+ @Field({ nullable: true })
53958
+ DefaultDatabase?: string | null;
53959
+
53960
+ @Field({ nullable: true })
53961
+ ConnectionConfig?: string | null;
53962
+
53963
+ @Field(() => Int, { nullable: true })
53964
+ DefaultCacheTTLSeconds?: number;
53965
+
53966
+ @Field({ nullable: true })
53967
+ Status?: string;
53968
+
53969
+ @Field({ nullable: true })
53970
+ LastConnectionTestAt?: Date | null;
53971
+
53972
+ @Field({ nullable: true })
53973
+ LastConnectionTestResult?: string | null;
53974
+
53975
+ @Field(() => [KeyValuePairInput], { nullable: true })
53976
+ OldValues___?: KeyValuePairInput[];
53977
+
53978
+ @Field(() => RestoreContextInput, { nullable: true })
53979
+ RestoreContext___?: RestoreContextInput;
53980
+ }
53981
+
53982
+ //****************************************************************************
53983
+ // RESOLVER for MJ: External Data Sources
53984
+ //****************************************************************************
53985
+ @ObjectType()
53986
+ export class RunMJExternalDataSourceViewResult {
53987
+ @Field(() => [MJExternalDataSource_])
53988
+ Results: MJExternalDataSource_[];
53989
+
53990
+ @Field(() => String, {nullable: true})
53991
+ UserViewRunID?: string;
53992
+
53993
+ @Field(() => Int, {nullable: true})
53994
+ RowCount: number;
53995
+
53996
+ @Field(() => Int, {nullable: true})
53997
+ TotalRowCount: number;
53998
+
53999
+ @Field(() => Int, {nullable: true})
54000
+ ExecutionTime: number;
54001
+
54002
+ @Field({nullable: true})
54003
+ ErrorMessage?: string;
54004
+
54005
+ @Field(() => Boolean, {nullable: false})
54006
+ Success: boolean;
54007
+ }
54008
+
54009
+ @Resolver(MJExternalDataSource_)
54010
+ export class MJExternalDataSourceResolver extends ResolverBase {
54011
+ @Query(() => RunMJExternalDataSourceViewResult)
54012
+ async RunMJExternalDataSourceViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
54013
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54014
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
54015
+ }
54016
+
54017
+ @Query(() => RunMJExternalDataSourceViewResult)
54018
+ async RunMJExternalDataSourceViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
54019
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54020
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
54021
+ }
54022
+
54023
+ @Query(() => RunMJExternalDataSourceViewResult)
54024
+ async RunMJExternalDataSourceDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
54025
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54026
+ input.EntityName = 'MJ: External Data Sources';
54027
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
54028
+ }
54029
+ @Query(() => MJExternalDataSource_, { nullable: true })
54030
+ async MJExternalDataSource(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJExternalDataSource_ | null> {
54031
+ this.CheckUserReadPermissions('MJ: External Data Sources', userPayload);
54032
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54033
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwExternalDataSources')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: External Data Sources', userPayload, EntityPermissionType.Read, 'AND');
54034
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
54035
+ const result = await this.MapFieldNamesToCodeNames('MJ: External Data Sources', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
54036
+ return result;
54037
+ }
54038
+
54039
+ @FieldResolver(() => [MJQuery_])
54040
+ async MJQueries_ExternalDataSourceIDArray(@Root() mjexternaldatasource_: MJExternalDataSource_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
54041
+ this.CheckUserReadPermissions('MJ: Queries', userPayload);
54042
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54043
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwQueries')} WHERE ${provider.QuoteIdentifier('ExternalDataSourceID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Queries', userPayload, EntityPermissionType.Read, 'AND');
54044
+ const rows = await provider.ExecuteSQL(sSQL, [mjexternaldatasource_.ID], undefined, this.GetUserFromPayload(userPayload));
54045
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Queries', rows, this.GetUserFromPayload(userPayload));
54046
+ return result;
54047
+ }
54048
+
54049
+ @FieldResolver(() => [MJEntity_])
54050
+ async MJEntities_ExternalDataSourceIDArray(@Root() mjexternaldatasource_: MJExternalDataSource_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
54051
+ this.CheckUserReadPermissions('MJ: Entities', userPayload);
54052
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54053
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwEntities')} WHERE ${provider.QuoteIdentifier('ExternalDataSourceID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Entities', userPayload, EntityPermissionType.Read, 'AND');
54054
+ const rows = await provider.ExecuteSQL(sSQL, [mjexternaldatasource_.ID], undefined, this.GetUserFromPayload(userPayload));
54055
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Entities', rows, this.GetUserFromPayload(userPayload));
54056
+ return result;
54057
+ }
54058
+
54059
+ @Mutation(() => MJExternalDataSource_)
54060
+ async CreateMJExternalDataSource(
54061
+ @Arg('input', () => CreateMJExternalDataSourceInput) input: CreateMJExternalDataSourceInput,
54062
+ @Ctx() { providers, userPayload }: AppContext,
54063
+ @PubSub() pubSub: PubSubEngine
54064
+ ) {
54065
+ const provider = GetReadWriteProvider(providers);
54066
+ return this.CreateRecord('MJ: External Data Sources', input, provider, userPayload, pubSub)
54067
+ }
54068
+
54069
+ @Mutation(() => MJExternalDataSource_)
54070
+ async UpdateMJExternalDataSource(
54071
+ @Arg('input', () => UpdateMJExternalDataSourceInput) input: UpdateMJExternalDataSourceInput,
54072
+ @Ctx() { providers, userPayload }: AppContext,
54073
+ @PubSub() pubSub: PubSubEngine
54074
+ ) {
54075
+ const provider = GetReadWriteProvider(providers);
54076
+ return this.UpdateRecord('MJ: External Data Sources', input, provider, userPayload, pubSub);
54077
+ }
54078
+
54079
+ @Mutation(() => MJExternalDataSource_)
54080
+ async DeleteMJExternalDataSource(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
54081
+ const provider = GetReadWriteProvider(providers);
54082
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
54083
+ return this.DeleteRecord('MJ: External Data Sources', key, options, provider, userPayload, pubSub);
54084
+ }
54085
+
54086
+ }
54087
+
53007
54088
  //****************************************************************************
53008
54089
  // ENTITY CLASS for MJ: File Categories
53009
54090
  //****************************************************************************
@@ -66855,6 +67936,10 @@ export class MJQuery_ {
66855
67936
  @Field(() => Boolean, {description: `When true, this query can be referenced by other queries using composition syntax. Only queries that are both Reusable and Approved can be composed into other queries.`})
66856
67937
  Reusable: boolean;
66857
67938
 
67939
+ @Field({nullable: true})
67940
+ @MaxLength(36)
67941
+ ExternalDataSourceID?: string;
67942
+
66858
67943
  @Field({nullable: true})
66859
67944
  @MaxLength(50)
66860
67945
  Category?: string;
@@ -66867,6 +67952,10 @@ export class MJQuery_ {
66867
67952
  @MaxLength(100)
66868
67953
  SQLDialect: string;
66869
67954
 
67955
+ @Field({nullable: true})
67956
+ @MaxLength(100)
67957
+ ExternalDataSource?: string;
67958
+
66870
67959
  @Field(() => [MJDataContextItem_])
66871
67960
  MJDataContextItems_QueryIDArray: MJDataContextItem_[]; // Link to MJDataContextItems
66872
67961
 
@@ -66964,6 +68053,9 @@ export class CreateMJQueryInput {
66964
68053
  @Field(() => Boolean, { nullable: true })
66965
68054
  Reusable?: boolean;
66966
68055
 
68056
+ @Field({ nullable: true })
68057
+ ExternalDataSourceID: string | null;
68058
+
66967
68059
  @Field(() => RestoreContextInput, { nullable: true })
66968
68060
  RestoreContext___?: RestoreContextInput;
66969
68061
  }
@@ -67040,6 +68132,9 @@ export class UpdateMJQueryInput {
67040
68132
  @Field(() => Boolean, { nullable: true })
67041
68133
  Reusable?: boolean;
67042
68134
 
68135
+ @Field({ nullable: true })
68136
+ ExternalDataSourceID?: string | null;
68137
+
67043
68138
  @Field(() => [KeyValuePairInput], { nullable: true })
67044
68139
  OldValues___?: KeyValuePairInput[];
67045
68140
 
@@ -74850,6 +75945,9 @@ export class MJRole_ {
74850
75945
  @Field(() => [MJAISkillPermission_])
74851
75946
  MJAISkillPermissions_RoleIDArray: MJAISkillPermission_[]; // Link to MJAISkillPermissions
74852
75947
 
75948
+ @Field(() => [MJConversationWidgetInstance_])
75949
+ MJConversationWidgetInstances_GuestRoleIDArray: MJConversationWidgetInstance_[]; // Link to MJConversationWidgetInstances
75950
+
74853
75951
  }
74854
75952
 
74855
75953
  //****************************************************************************
@@ -75121,6 +76219,16 @@ export class MJRoleResolver extends ResolverBase {
75121
76219
  return result;
75122
76220
  }
75123
76221
 
76222
+ @FieldResolver(() => [MJConversationWidgetInstance_])
76223
+ async MJConversationWidgetInstances_GuestRoleIDArray(@Root() mjrole_: MJRole_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
76224
+ this.CheckUserReadPermissions('MJ: Conversation Widget Instances', userPayload);
76225
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
76226
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwConversationWidgetInstances')} WHERE ${provider.QuoteIdentifier('GuestRoleID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: Conversation Widget Instances', userPayload, EntityPermissionType.Read, 'AND');
76227
+ const rows = await provider.ExecuteSQL(sSQL, [mjrole_.ID], undefined, this.GetUserFromPayload(userPayload));
76228
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Conversation Widget Instances', rows, this.GetUserFromPayload(userPayload));
76229
+ return result;
76230
+ }
76231
+
75124
76232
  @Mutation(() => MJRole_)
75125
76233
  async CreateMJRole(
75126
76234
  @Arg('input', () => CreateMJRoleInput) input: CreateMJRoleInput,
@@ -84400,6 +85508,9 @@ export class MJTemplate_ {
84400
85508
  @Field(() => [MJEntityDocument_])
84401
85509
  MJEntityDocuments_TemplateIDArray: MJEntityDocument_[]; // Link to MJEntityDocuments
84402
85510
 
85511
+ @Field(() => [MJUserRoutine_])
85512
+ MJUserRoutines_NotificationTemplateIDArray: MJUserRoutine_[]; // Link to MJUserRoutines
85513
+
84403
85514
  }
84404
85515
 
84405
85516
  //****************************************************************************
@@ -84615,6 +85726,16 @@ export class MJTemplateResolver extends ResolverBase {
84615
85726
  return result;
84616
85727
  }
84617
85728
 
85729
+ @FieldResolver(() => [MJUserRoutine_])
85730
+ async MJUserRoutines_NotificationTemplateIDArray(@Root() mjtemplate_: MJTemplate_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
85731
+ this.CheckUserReadPermissions('MJ: User Routines', userPayload);
85732
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
85733
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutines')} WHERE ${provider.QuoteIdentifier('NotificationTemplateID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routines', userPayload, EntityPermissionType.Read, 'AND');
85734
+ const rows = await provider.ExecuteSQL(sSQL, [mjtemplate_.ID], undefined, this.GetUserFromPayload(userPayload));
85735
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routines', rows, this.GetUserFromPayload(userPayload));
85736
+ return result;
85737
+ }
85738
+
84618
85739
  @Mutation(() => MJTemplate_)
84619
85740
  async CreateMJTemplate(
84620
85741
  @Arg('input', () => CreateMJTemplateInput) input: CreateMJTemplateInput,
@@ -88921,6 +90042,849 @@ export class MJUserRoleResolver extends ResolverBase {
88921
90042
 
88922
90043
  }
88923
90044
 
90045
+ //****************************************************************************
90046
+ // ENTITY CLASS for MJ: User Routine Recipients
90047
+ //****************************************************************************
90048
+ @ObjectType()
90049
+ export class MJUserRoutineRecipient_ {
90050
+ @Field()
90051
+ @MaxLength(36)
90052
+ ID: string;
90053
+
90054
+ @Field({description: `Routine this recipient belongs to.`})
90055
+ @MaxLength(36)
90056
+ RoutineID: string;
90057
+
90058
+ @Field({nullable: true, description: `Internal MJ user recipient (when notifying an existing user). Either UserID or Email is set.`})
90059
+ @MaxLength(36)
90060
+ UserID?: string;
90061
+
90062
+ @Field({nullable: true, description: `External email recipient (when notifying a non-user). Either UserID or Email is set.`})
90063
+ @MaxLength(255)
90064
+ Email?: string;
90065
+
90066
+ @Field({description: `Delivery channel for this recipient: InApp or Email.`})
90067
+ @MaxLength(20)
90068
+ Channel: string;
90069
+
90070
+ @Field(() => Int, {description: `Explicit display/notification ordering of recipients within a routine (ascending).`})
90071
+ Sequence: number;
90072
+
90073
+ @Field()
90074
+ _mj__CreatedAt: Date;
90075
+
90076
+ @Field()
90077
+ _mj__UpdatedAt: Date;
90078
+
90079
+ @Field()
90080
+ @MaxLength(255)
90081
+ Routine: string;
90082
+
90083
+ @Field({nullable: true})
90084
+ @MaxLength(100)
90085
+ User?: string;
90086
+
90087
+ }
90088
+
90089
+ //****************************************************************************
90090
+ // INPUT TYPE for MJ: User Routine Recipients
90091
+ //****************************************************************************
90092
+ @InputType()
90093
+ export class CreateMJUserRoutineRecipientInput {
90094
+ @Field({ nullable: true })
90095
+ ID?: string;
90096
+
90097
+ @Field({ nullable: true })
90098
+ RoutineID?: string;
90099
+
90100
+ @Field({ nullable: true })
90101
+ UserID: string | null;
90102
+
90103
+ @Field({ nullable: true })
90104
+ Email: string | null;
90105
+
90106
+ @Field({ nullable: true })
90107
+ Channel?: string;
90108
+
90109
+ @Field(() => Int, { nullable: true })
90110
+ Sequence?: number;
90111
+
90112
+ @Field(() => RestoreContextInput, { nullable: true })
90113
+ RestoreContext___?: RestoreContextInput;
90114
+ }
90115
+
90116
+
90117
+ //****************************************************************************
90118
+ // INPUT TYPE for MJ: User Routine Recipients
90119
+ //****************************************************************************
90120
+ @InputType()
90121
+ export class UpdateMJUserRoutineRecipientInput {
90122
+ @Field()
90123
+ ID: string;
90124
+
90125
+ @Field({ nullable: true })
90126
+ RoutineID?: string;
90127
+
90128
+ @Field({ nullable: true })
90129
+ UserID?: string | null;
90130
+
90131
+ @Field({ nullable: true })
90132
+ Email?: string | null;
90133
+
90134
+ @Field({ nullable: true })
90135
+ Channel?: string;
90136
+
90137
+ @Field(() => Int, { nullable: true })
90138
+ Sequence?: number;
90139
+
90140
+ @Field(() => [KeyValuePairInput], { nullable: true })
90141
+ OldValues___?: KeyValuePairInput[];
90142
+
90143
+ @Field(() => RestoreContextInput, { nullable: true })
90144
+ RestoreContext___?: RestoreContextInput;
90145
+ }
90146
+
90147
+ //****************************************************************************
90148
+ // RESOLVER for MJ: User Routine Recipients
90149
+ //****************************************************************************
90150
+ @ObjectType()
90151
+ export class RunMJUserRoutineRecipientViewResult {
90152
+ @Field(() => [MJUserRoutineRecipient_])
90153
+ Results: MJUserRoutineRecipient_[];
90154
+
90155
+ @Field(() => String, {nullable: true})
90156
+ UserViewRunID?: string;
90157
+
90158
+ @Field(() => Int, {nullable: true})
90159
+ RowCount: number;
90160
+
90161
+ @Field(() => Int, {nullable: true})
90162
+ TotalRowCount: number;
90163
+
90164
+ @Field(() => Int, {nullable: true})
90165
+ ExecutionTime: number;
90166
+
90167
+ @Field({nullable: true})
90168
+ ErrorMessage?: string;
90169
+
90170
+ @Field(() => Boolean, {nullable: false})
90171
+ Success: boolean;
90172
+ }
90173
+
90174
+ @Resolver(MJUserRoutineRecipient_)
90175
+ export class MJUserRoutineRecipientResolver extends ResolverBase {
90176
+ @Query(() => RunMJUserRoutineRecipientViewResult)
90177
+ async RunMJUserRoutineRecipientViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90178
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90179
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
90180
+ }
90181
+
90182
+ @Query(() => RunMJUserRoutineRecipientViewResult)
90183
+ async RunMJUserRoutineRecipientViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90184
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90185
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
90186
+ }
90187
+
90188
+ @Query(() => RunMJUserRoutineRecipientViewResult)
90189
+ async RunMJUserRoutineRecipientDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90190
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90191
+ input.EntityName = 'MJ: User Routine Recipients';
90192
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
90193
+ }
90194
+ @Query(() => MJUserRoutineRecipient_, { nullable: true })
90195
+ async MJUserRoutineRecipient(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJUserRoutineRecipient_ | null> {
90196
+ this.CheckUserReadPermissions('MJ: User Routine Recipients', userPayload);
90197
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90198
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutineRecipients')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routine Recipients', userPayload, EntityPermissionType.Read, 'AND');
90199
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
90200
+ const result = await this.MapFieldNamesToCodeNames('MJ: User Routine Recipients', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
90201
+ return result;
90202
+ }
90203
+
90204
+ @Mutation(() => MJUserRoutineRecipient_)
90205
+ async CreateMJUserRoutineRecipient(
90206
+ @Arg('input', () => CreateMJUserRoutineRecipientInput) input: CreateMJUserRoutineRecipientInput,
90207
+ @Ctx() { providers, userPayload }: AppContext,
90208
+ @PubSub() pubSub: PubSubEngine
90209
+ ) {
90210
+ const provider = GetReadWriteProvider(providers);
90211
+ return this.CreateRecord('MJ: User Routine Recipients', input, provider, userPayload, pubSub)
90212
+ }
90213
+
90214
+ @Mutation(() => MJUserRoutineRecipient_)
90215
+ async UpdateMJUserRoutineRecipient(
90216
+ @Arg('input', () => UpdateMJUserRoutineRecipientInput) input: UpdateMJUserRoutineRecipientInput,
90217
+ @Ctx() { providers, userPayload }: AppContext,
90218
+ @PubSub() pubSub: PubSubEngine
90219
+ ) {
90220
+ const provider = GetReadWriteProvider(providers);
90221
+ return this.UpdateRecord('MJ: User Routine Recipients', input, provider, userPayload, pubSub);
90222
+ }
90223
+
90224
+ @Mutation(() => MJUserRoutineRecipient_)
90225
+ async DeleteMJUserRoutineRecipient(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90226
+ const provider = GetReadWriteProvider(providers);
90227
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
90228
+ return this.DeleteRecord('MJ: User Routine Recipients', key, options, provider, userPayload, pubSub);
90229
+ }
90230
+
90231
+ }
90232
+
90233
+ //****************************************************************************
90234
+ // ENTITY CLASS for MJ: User Routine Runs
90235
+ //****************************************************************************
90236
+ @ObjectType()
90237
+ export class MJUserRoutineRun_ {
90238
+ @Field()
90239
+ @MaxLength(36)
90240
+ ID: string;
90241
+
90242
+ @Field({description: `Routine this run belongs to.`})
90243
+ @MaxLength(36)
90244
+ RoutineID: string;
90245
+
90246
+ @Field({description: `When the run started.`})
90247
+ StartedAt: Date;
90248
+
90249
+ @Field({nullable: true, description: `When the run completed (null while running).`})
90250
+ CompletedAt?: Date;
90251
+
90252
+ @Field({description: `Run outcome.`})
90253
+ @MaxLength(20)
90254
+ Status: string;
90255
+
90256
+ @Field({nullable: true, description: `Linked AI Agent Run when the routine target is an agent.`})
90257
+ @MaxLength(36)
90258
+ AgentRunID?: string;
90259
+
90260
+ @Field({nullable: true, description: `For Prompt targets, links to the MJ: AI Prompt Runs record for this execution — tokens, cost, and full telemetry live there (never duplicated here).`})
90261
+ @MaxLength(36)
90262
+ PromptRunID?: string;
90263
+
90264
+ @Field({nullable: true, description: `For Action targets, links to the MJ: Action Execution Logs record for this execution — params, results, and telemetry live there (never duplicated here).`})
90265
+ @MaxLength(36)
90266
+ ActionExecutionLogID?: string;
90267
+
90268
+ @Field({nullable: true, description: `Human-readable summary of the run result.`})
90269
+ ResultSummary?: string;
90270
+
90271
+ @Field({nullable: true, description: `Hash of the result, compared against the routine LastResultHash for OnChange detection.`})
90272
+ @MaxLength(100)
90273
+ ResultHash?: string;
90274
+
90275
+ @Field(() => Boolean, {description: `Whether a notification was dispatched for this run.`})
90276
+ NotificationSent: boolean;
90277
+
90278
+ @Field({nullable: true, description: `Error detail when Status is Failed.`})
90279
+ ErrorMessage?: string;
90280
+
90281
+ @Field()
90282
+ _mj__CreatedAt: Date;
90283
+
90284
+ @Field()
90285
+ _mj__UpdatedAt: Date;
90286
+
90287
+ @Field()
90288
+ @MaxLength(255)
90289
+ Routine: string;
90290
+
90291
+ @Field({nullable: true})
90292
+ @MaxLength(255)
90293
+ AgentRun?: string;
90294
+
90295
+ @Field({nullable: true})
90296
+ @MaxLength(255)
90297
+ PromptRun?: string;
90298
+
90299
+ @Field({nullable: true})
90300
+ @MaxLength(425)
90301
+ ActionExecutionLog?: string;
90302
+
90303
+ }
90304
+
90305
+ //****************************************************************************
90306
+ // INPUT TYPE for MJ: User Routine Runs
90307
+ //****************************************************************************
90308
+ @InputType()
90309
+ export class CreateMJUserRoutineRunInput {
90310
+ @Field({ nullable: true })
90311
+ ID?: string;
90312
+
90313
+ @Field({ nullable: true })
90314
+ RoutineID?: string;
90315
+
90316
+ @Field({ nullable: true })
90317
+ StartedAt?: Date;
90318
+
90319
+ @Field({ nullable: true })
90320
+ CompletedAt: Date | null;
90321
+
90322
+ @Field({ nullable: true })
90323
+ Status?: string;
90324
+
90325
+ @Field({ nullable: true })
90326
+ AgentRunID: string | null;
90327
+
90328
+ @Field({ nullable: true })
90329
+ PromptRunID: string | null;
90330
+
90331
+ @Field({ nullable: true })
90332
+ ActionExecutionLogID: string | null;
90333
+
90334
+ @Field({ nullable: true })
90335
+ ResultSummary: string | null;
90336
+
90337
+ @Field({ nullable: true })
90338
+ ResultHash: string | null;
90339
+
90340
+ @Field(() => Boolean, { nullable: true })
90341
+ NotificationSent?: boolean;
90342
+
90343
+ @Field({ nullable: true })
90344
+ ErrorMessage: string | null;
90345
+
90346
+ @Field(() => RestoreContextInput, { nullable: true })
90347
+ RestoreContext___?: RestoreContextInput;
90348
+ }
90349
+
90350
+
90351
+ //****************************************************************************
90352
+ // INPUT TYPE for MJ: User Routine Runs
90353
+ //****************************************************************************
90354
+ @InputType()
90355
+ export class UpdateMJUserRoutineRunInput {
90356
+ @Field()
90357
+ ID: string;
90358
+
90359
+ @Field({ nullable: true })
90360
+ RoutineID?: string;
90361
+
90362
+ @Field({ nullable: true })
90363
+ StartedAt?: Date;
90364
+
90365
+ @Field({ nullable: true })
90366
+ CompletedAt?: Date | null;
90367
+
90368
+ @Field({ nullable: true })
90369
+ Status?: string;
90370
+
90371
+ @Field({ nullable: true })
90372
+ AgentRunID?: string | null;
90373
+
90374
+ @Field({ nullable: true })
90375
+ PromptRunID?: string | null;
90376
+
90377
+ @Field({ nullable: true })
90378
+ ActionExecutionLogID?: string | null;
90379
+
90380
+ @Field({ nullable: true })
90381
+ ResultSummary?: string | null;
90382
+
90383
+ @Field({ nullable: true })
90384
+ ResultHash?: string | null;
90385
+
90386
+ @Field(() => Boolean, { nullable: true })
90387
+ NotificationSent?: boolean;
90388
+
90389
+ @Field({ nullable: true })
90390
+ ErrorMessage?: string | null;
90391
+
90392
+ @Field(() => [KeyValuePairInput], { nullable: true })
90393
+ OldValues___?: KeyValuePairInput[];
90394
+
90395
+ @Field(() => RestoreContextInput, { nullable: true })
90396
+ RestoreContext___?: RestoreContextInput;
90397
+ }
90398
+
90399
+ //****************************************************************************
90400
+ // RESOLVER for MJ: User Routine Runs
90401
+ //****************************************************************************
90402
+ @ObjectType()
90403
+ export class RunMJUserRoutineRunViewResult {
90404
+ @Field(() => [MJUserRoutineRun_])
90405
+ Results: MJUserRoutineRun_[];
90406
+
90407
+ @Field(() => String, {nullable: true})
90408
+ UserViewRunID?: string;
90409
+
90410
+ @Field(() => Int, {nullable: true})
90411
+ RowCount: number;
90412
+
90413
+ @Field(() => Int, {nullable: true})
90414
+ TotalRowCount: number;
90415
+
90416
+ @Field(() => Int, {nullable: true})
90417
+ ExecutionTime: number;
90418
+
90419
+ @Field({nullable: true})
90420
+ ErrorMessage?: string;
90421
+
90422
+ @Field(() => Boolean, {nullable: false})
90423
+ Success: boolean;
90424
+ }
90425
+
90426
+ @Resolver(MJUserRoutineRun_)
90427
+ export class MJUserRoutineRunResolver extends ResolverBase {
90428
+ @Query(() => RunMJUserRoutineRunViewResult)
90429
+ async RunMJUserRoutineRunViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90430
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90431
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
90432
+ }
90433
+
90434
+ @Query(() => RunMJUserRoutineRunViewResult)
90435
+ async RunMJUserRoutineRunViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90436
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90437
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
90438
+ }
90439
+
90440
+ @Query(() => RunMJUserRoutineRunViewResult)
90441
+ async RunMJUserRoutineRunDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90442
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90443
+ input.EntityName = 'MJ: User Routine Runs';
90444
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
90445
+ }
90446
+ @Query(() => MJUserRoutineRun_, { nullable: true })
90447
+ async MJUserRoutineRun(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJUserRoutineRun_ | null> {
90448
+ this.CheckUserReadPermissions('MJ: User Routine Runs', userPayload);
90449
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90450
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutineRuns')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routine Runs', userPayload, EntityPermissionType.Read, 'AND');
90451
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
90452
+ const result = await this.MapFieldNamesToCodeNames('MJ: User Routine Runs', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
90453
+ return result;
90454
+ }
90455
+
90456
+ @Mutation(() => MJUserRoutineRun_)
90457
+ async CreateMJUserRoutineRun(
90458
+ @Arg('input', () => CreateMJUserRoutineRunInput) input: CreateMJUserRoutineRunInput,
90459
+ @Ctx() { providers, userPayload }: AppContext,
90460
+ @PubSub() pubSub: PubSubEngine
90461
+ ) {
90462
+ const provider = GetReadWriteProvider(providers);
90463
+ return this.CreateRecord('MJ: User Routine Runs', input, provider, userPayload, pubSub)
90464
+ }
90465
+
90466
+ @Mutation(() => MJUserRoutineRun_)
90467
+ async UpdateMJUserRoutineRun(
90468
+ @Arg('input', () => UpdateMJUserRoutineRunInput) input: UpdateMJUserRoutineRunInput,
90469
+ @Ctx() { providers, userPayload }: AppContext,
90470
+ @PubSub() pubSub: PubSubEngine
90471
+ ) {
90472
+ const provider = GetReadWriteProvider(providers);
90473
+ return this.UpdateRecord('MJ: User Routine Runs', input, provider, userPayload, pubSub);
90474
+ }
90475
+
90476
+ @Mutation(() => MJUserRoutineRun_)
90477
+ async DeleteMJUserRoutineRun(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90478
+ const provider = GetReadWriteProvider(providers);
90479
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
90480
+ return this.DeleteRecord('MJ: User Routine Runs', key, options, provider, userPayload, pubSub);
90481
+ }
90482
+
90483
+ }
90484
+
90485
+ //****************************************************************************
90486
+ // ENTITY CLASS for MJ: User Routines
90487
+ //****************************************************************************
90488
+ @ObjectType()
90489
+ export class MJUserRoutine_ {
90490
+ @Field()
90491
+ @MaxLength(36)
90492
+ ID: string;
90493
+
90494
+ @Field({description: `Owner of the routine. Routines are private to their owner (row-level access).`})
90495
+ @MaxLength(36)
90496
+ UserID: string;
90497
+
90498
+ @Field({nullable: true, description: `Optional environment scope for the routine.`})
90499
+ @MaxLength(36)
90500
+ EnvironmentID?: string;
90501
+
90502
+ @Field({description: `User-facing routine name.`})
90503
+ @MaxLength(255)
90504
+ Name: string;
90505
+
90506
+ @Field({nullable: true, description: `Optional description of what the routine does.`})
90507
+ Description?: string;
90508
+
90509
+ @Field({description: `Lifecycle status: Active (eligible to run), Paused (temporarily off), Disabled (off).`})
90510
+ @MaxLength(20)
90511
+ Status: string;
90512
+
90513
+ @Field({description: `Scheduled (always notify per NotifyCondition) or Monitoring (intended for OnChange detection via result hashing).`})
90514
+ @MaxLength(20)
90515
+ RoutineType: string;
90516
+
90517
+ @Field({description: `What kind of target this routine runs: Agent, Action, or Prompt. Determines how TargetID is interpreted.`})
90518
+ @MaxLength(20)
90519
+ TargetType: string;
90520
+
90521
+ @Field({description: `Polymorphic reference resolved by TargetType (AIAgent.ID, Action.ID, or AIPrompt.ID). No FK because the target table varies.`})
90522
+ @MaxLength(36)
90523
+ TargetID: string;
90524
+
90525
+ @Field({nullable: true, description: `For Agent targets, the user message sent to the agent on each run.`})
90526
+ InitialMessage?: string;
90527
+
90528
+ @Field({nullable: true, description: `Optional JSON starting payload passed to the target on each run.`})
90529
+ StartingPayload?: string;
90530
+
90531
+ @Field({nullable: true, description: `Optional JSON array of MJ: AI Skills IDs to pre-activate when the routine target is an Agent — threaded as ExecuteAgentParams.requestedSkillIDs so the agent starts each scheduled run with the requested skills' instructions and tools in effect (subject to all availability gates; ActivationMode does not gate this explicit-request path). Ignored for Action/Prompt targets.`})
90532
+ RequestedSkillIDs?: string;
90533
+
90534
+ @Field({description: `Standard cron expression evaluated by the dispatcher to determine when the routine is due.`})
90535
+ @MaxLength(100)
90536
+ CronExpression: string;
90537
+
90538
+ @Field({nullable: true, description: `Optional activation window start. An Active routine does not run before this time; once current time passes StartAt the dispatcher begins scheduling it. NULL = eligible immediately.`})
90539
+ StartAt?: Date;
90540
+
90541
+ @Field({nullable: true, description: `Optional activation window end. An Active routine stops running once current time passes EndAt — automatic sunset without changing Status. NULL = no end.`})
90542
+ EndAt?: Date;
90543
+
90544
+ @Field({nullable: true, description: `Optional MJ Template used to render routine notifications from the runs output data (result summary, status, target info) via the standard MJ templating architecture. When NULL, the system default routine-notification template (seeded via metadata, resolvable per instance — not hardcoded) is used.`})
90545
+ @MaxLength(36)
90546
+ NotificationTemplateID?: string;
90547
+
90548
+ @Field({description: `IANA timezone used when evaluating CronExpression (e.g. America/Chicago).`})
90549
+ @MaxLength(100)
90550
+ Timezone: string;
90551
+
90552
+ @Field({nullable: true, description: `Next scheduled run time, computed after each run.`})
90553
+ NextRunAt?: Date;
90554
+
90555
+ @Field({nullable: true, description: `Timestamp of the most recent run.`})
90556
+ LastRunAt?: Date;
90557
+
90558
+ @Field({nullable: true, description: `Outcome of the most recent run.`})
90559
+ @MaxLength(20)
90560
+ LastRunStatus?: string;
90561
+
90562
+ @Field({nullable: true, description: `Hash of the most recent result, used by Monitoring routines to detect change for OnChange notifications.`})
90563
+ @MaxLength(100)
90564
+ LastResultHash?: string;
90565
+
90566
+ @Field({description: `When to notify: Always, OnSuccess, OnFailure, or OnChange (result differs from prior run).`})
90567
+ @MaxLength(20)
90568
+ NotifyCondition: string;
90569
+
90570
+ @Field(() => Boolean, {description: `Deliver notifications via in-app notification.`})
90571
+ NotifyViaInApp: boolean;
90572
+
90573
+ @Field(() => Boolean, {description: `Deliver notifications via email.`})
90574
+ NotifyViaEmail: boolean;
90575
+
90576
+ @Field()
90577
+ _mj__CreatedAt: Date;
90578
+
90579
+ @Field()
90580
+ _mj__UpdatedAt: Date;
90581
+
90582
+ @Field({nullable: true, description: `The dedicated conversation this routine's Agent runs append to (created on first conversation-mode run, Application-scoped so it stays out of the default chat list). NULL when the routine has never run in conversation mode.`})
90583
+ @MaxLength(36)
90584
+ ConversationID?: string;
90585
+
90586
+ @Field()
90587
+ @MaxLength(100)
90588
+ User: string;
90589
+
90590
+ @Field({nullable: true})
90591
+ @MaxLength(255)
90592
+ Environment?: string;
90593
+
90594
+ @Field({nullable: true})
90595
+ @MaxLength(255)
90596
+ NotificationTemplate?: string;
90597
+
90598
+ @Field({nullable: true})
90599
+ @MaxLength(255)
90600
+ Conversation?: string;
90601
+
90602
+ @Field(() => [MJUserRoutineRun_])
90603
+ MJUserRoutineRuns_RoutineIDArray: MJUserRoutineRun_[]; // Link to MJUserRoutineRuns
90604
+
90605
+ @Field(() => [MJUserRoutineRecipient_])
90606
+ MJUserRoutineRecipients_RoutineIDArray: MJUserRoutineRecipient_[]; // Link to MJUserRoutineRecipients
90607
+
90608
+ }
90609
+
90610
+ //****************************************************************************
90611
+ // INPUT TYPE for MJ: User Routines
90612
+ //****************************************************************************
90613
+ @InputType()
90614
+ export class CreateMJUserRoutineInput {
90615
+ @Field({ nullable: true })
90616
+ ID?: string;
90617
+
90618
+ @Field({ nullable: true })
90619
+ UserID?: string;
90620
+
90621
+ @Field({ nullable: true })
90622
+ EnvironmentID: string | null;
90623
+
90624
+ @Field({ nullable: true })
90625
+ Name?: string;
90626
+
90627
+ @Field({ nullable: true })
90628
+ Description: string | null;
90629
+
90630
+ @Field({ nullable: true })
90631
+ Status?: string;
90632
+
90633
+ @Field({ nullable: true })
90634
+ RoutineType?: string;
90635
+
90636
+ @Field({ nullable: true })
90637
+ TargetType?: string;
90638
+
90639
+ @Field({ nullable: true })
90640
+ TargetID?: string;
90641
+
90642
+ @Field({ nullable: true })
90643
+ InitialMessage: string | null;
90644
+
90645
+ @Field({ nullable: true })
90646
+ StartingPayload: string | null;
90647
+
90648
+ @Field({ nullable: true })
90649
+ RequestedSkillIDs: string | null;
90650
+
90651
+ @Field({ nullable: true })
90652
+ CronExpression?: string;
90653
+
90654
+ @Field({ nullable: true })
90655
+ StartAt: Date | null;
90656
+
90657
+ @Field({ nullable: true })
90658
+ EndAt: Date | null;
90659
+
90660
+ @Field({ nullable: true })
90661
+ NotificationTemplateID: string | null;
90662
+
90663
+ @Field({ nullable: true })
90664
+ Timezone?: string;
90665
+
90666
+ @Field({ nullable: true })
90667
+ NextRunAt: Date | null;
90668
+
90669
+ @Field({ nullable: true })
90670
+ LastRunAt: Date | null;
90671
+
90672
+ @Field({ nullable: true })
90673
+ LastRunStatus: string | null;
90674
+
90675
+ @Field({ nullable: true })
90676
+ LastResultHash: string | null;
90677
+
90678
+ @Field({ nullable: true })
90679
+ NotifyCondition?: string;
90680
+
90681
+ @Field(() => Boolean, { nullable: true })
90682
+ NotifyViaInApp?: boolean;
90683
+
90684
+ @Field(() => Boolean, { nullable: true })
90685
+ NotifyViaEmail?: boolean;
90686
+
90687
+ @Field({ nullable: true })
90688
+ ConversationID: string | null;
90689
+
90690
+ @Field(() => RestoreContextInput, { nullable: true })
90691
+ RestoreContext___?: RestoreContextInput;
90692
+ }
90693
+
90694
+
90695
+ //****************************************************************************
90696
+ // INPUT TYPE for MJ: User Routines
90697
+ //****************************************************************************
90698
+ @InputType()
90699
+ export class UpdateMJUserRoutineInput {
90700
+ @Field()
90701
+ ID: string;
90702
+
90703
+ @Field({ nullable: true })
90704
+ UserID?: string;
90705
+
90706
+ @Field({ nullable: true })
90707
+ EnvironmentID?: string | null;
90708
+
90709
+ @Field({ nullable: true })
90710
+ Name?: string;
90711
+
90712
+ @Field({ nullable: true })
90713
+ Description?: string | null;
90714
+
90715
+ @Field({ nullable: true })
90716
+ Status?: string;
90717
+
90718
+ @Field({ nullable: true })
90719
+ RoutineType?: string;
90720
+
90721
+ @Field({ nullable: true })
90722
+ TargetType?: string;
90723
+
90724
+ @Field({ nullable: true })
90725
+ TargetID?: string;
90726
+
90727
+ @Field({ nullable: true })
90728
+ InitialMessage?: string | null;
90729
+
90730
+ @Field({ nullable: true })
90731
+ StartingPayload?: string | null;
90732
+
90733
+ @Field({ nullable: true })
90734
+ RequestedSkillIDs?: string | null;
90735
+
90736
+ @Field({ nullable: true })
90737
+ CronExpression?: string;
90738
+
90739
+ @Field({ nullable: true })
90740
+ StartAt?: Date | null;
90741
+
90742
+ @Field({ nullable: true })
90743
+ EndAt?: Date | null;
90744
+
90745
+ @Field({ nullable: true })
90746
+ NotificationTemplateID?: string | null;
90747
+
90748
+ @Field({ nullable: true })
90749
+ Timezone?: string;
90750
+
90751
+ @Field({ nullable: true })
90752
+ NextRunAt?: Date | null;
90753
+
90754
+ @Field({ nullable: true })
90755
+ LastRunAt?: Date | null;
90756
+
90757
+ @Field({ nullable: true })
90758
+ LastRunStatus?: string | null;
90759
+
90760
+ @Field({ nullable: true })
90761
+ LastResultHash?: string | null;
90762
+
90763
+ @Field({ nullable: true })
90764
+ NotifyCondition?: string;
90765
+
90766
+ @Field(() => Boolean, { nullable: true })
90767
+ NotifyViaInApp?: boolean;
90768
+
90769
+ @Field(() => Boolean, { nullable: true })
90770
+ NotifyViaEmail?: boolean;
90771
+
90772
+ @Field({ nullable: true })
90773
+ ConversationID?: string | null;
90774
+
90775
+ @Field(() => [KeyValuePairInput], { nullable: true })
90776
+ OldValues___?: KeyValuePairInput[];
90777
+
90778
+ @Field(() => RestoreContextInput, { nullable: true })
90779
+ RestoreContext___?: RestoreContextInput;
90780
+ }
90781
+
90782
+ //****************************************************************************
90783
+ // RESOLVER for MJ: User Routines
90784
+ //****************************************************************************
90785
+ @ObjectType()
90786
+ export class RunMJUserRoutineViewResult {
90787
+ @Field(() => [MJUserRoutine_])
90788
+ Results: MJUserRoutine_[];
90789
+
90790
+ @Field(() => String, {nullable: true})
90791
+ UserViewRunID?: string;
90792
+
90793
+ @Field(() => Int, {nullable: true})
90794
+ RowCount: number;
90795
+
90796
+ @Field(() => Int, {nullable: true})
90797
+ TotalRowCount: number;
90798
+
90799
+ @Field(() => Int, {nullable: true})
90800
+ ExecutionTime: number;
90801
+
90802
+ @Field({nullable: true})
90803
+ ErrorMessage?: string;
90804
+
90805
+ @Field(() => Boolean, {nullable: false})
90806
+ Success: boolean;
90807
+ }
90808
+
90809
+ @Resolver(MJUserRoutine_)
90810
+ export class MJUserRoutineResolver extends ResolverBase {
90811
+ @Query(() => RunMJUserRoutineViewResult)
90812
+ async RunMJUserRoutineViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90813
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90814
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
90815
+ }
90816
+
90817
+ @Query(() => RunMJUserRoutineViewResult)
90818
+ async RunMJUserRoutineViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90819
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90820
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
90821
+ }
90822
+
90823
+ @Query(() => RunMJUserRoutineViewResult)
90824
+ async RunMJUserRoutineDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90825
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90826
+ input.EntityName = 'MJ: User Routines';
90827
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
90828
+ }
90829
+ @Query(() => MJUserRoutine_, { nullable: true })
90830
+ async MJUserRoutine(@Arg('ID', () => String) ID: string, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<MJUserRoutine_ | null> {
90831
+ this.CheckUserReadPermissions('MJ: User Routines', userPayload);
90832
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90833
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutines')} WHERE ${provider.QuoteIdentifier('ID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routines', userPayload, EntityPermissionType.Read, 'AND');
90834
+ const rows = await provider.ExecuteSQL(sSQL, [ID], undefined, this.GetUserFromPayload(userPayload));
90835
+ const result = await this.MapFieldNamesToCodeNames('MJ: User Routines', rows && rows.length > 0 ? rows[0] : null, this.GetUserFromPayload(userPayload));
90836
+ return result;
90837
+ }
90838
+
90839
+ @FieldResolver(() => [MJUserRoutineRun_])
90840
+ async MJUserRoutineRuns_RoutineIDArray(@Root() mjuserroutine_: MJUserRoutine_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
90841
+ this.CheckUserReadPermissions('MJ: User Routine Runs', userPayload);
90842
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90843
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutineRuns')} WHERE ${provider.QuoteIdentifier('RoutineID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routine Runs', userPayload, EntityPermissionType.Read, 'AND');
90844
+ const rows = await provider.ExecuteSQL(sSQL, [mjuserroutine_.ID], undefined, this.GetUserFromPayload(userPayload));
90845
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routine Runs', rows, this.GetUserFromPayload(userPayload));
90846
+ return result;
90847
+ }
90848
+
90849
+ @FieldResolver(() => [MJUserRoutineRecipient_])
90850
+ async MJUserRoutineRecipients_RoutineIDArray(@Root() mjuserroutine_: MJUserRoutine_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
90851
+ this.CheckUserReadPermissions('MJ: User Routine Recipients', userPayload);
90852
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
90853
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutineRecipients')} WHERE ${provider.QuoteIdentifier('RoutineID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routine Recipients', userPayload, EntityPermissionType.Read, 'AND');
90854
+ const rows = await provider.ExecuteSQL(sSQL, [mjuserroutine_.ID], undefined, this.GetUserFromPayload(userPayload));
90855
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routine Recipients', rows, this.GetUserFromPayload(userPayload));
90856
+ return result;
90857
+ }
90858
+
90859
+ @Mutation(() => MJUserRoutine_)
90860
+ async CreateMJUserRoutine(
90861
+ @Arg('input', () => CreateMJUserRoutineInput) input: CreateMJUserRoutineInput,
90862
+ @Ctx() { providers, userPayload }: AppContext,
90863
+ @PubSub() pubSub: PubSubEngine
90864
+ ) {
90865
+ const provider = GetReadWriteProvider(providers);
90866
+ return this.CreateRecord('MJ: User Routines', input, provider, userPayload, pubSub)
90867
+ }
90868
+
90869
+ @Mutation(() => MJUserRoutine_)
90870
+ async UpdateMJUserRoutine(
90871
+ @Arg('input', () => UpdateMJUserRoutineInput) input: UpdateMJUserRoutineInput,
90872
+ @Ctx() { providers, userPayload }: AppContext,
90873
+ @PubSub() pubSub: PubSubEngine
90874
+ ) {
90875
+ const provider = GetReadWriteProvider(providers);
90876
+ return this.UpdateRecord('MJ: User Routines', input, provider, userPayload, pubSub);
90877
+ }
90878
+
90879
+ @Mutation(() => MJUserRoutine_)
90880
+ async DeleteMJUserRoutine(@Arg('ID', () => String) ID: string, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { providers, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
90881
+ const provider = GetReadWriteProvider(providers);
90882
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
90883
+ return this.DeleteRecord('MJ: User Routines', key, options, provider, userPayload, pubSub);
90884
+ }
90885
+
90886
+ }
90887
+
88924
90888
  //****************************************************************************
88925
90889
  // ENTITY CLASS for MJ: User Settings
88926
90890
  //****************************************************************************
@@ -90481,6 +92445,12 @@ export class MJUser_ {
90481
92445
  @Field(() => [MJAISkill_])
90482
92446
  MJAISkills_CreatedByUserIDArray: MJAISkill_[]; // Link to MJAISkills
90483
92447
 
92448
+ @Field(() => [MJUserRoutine_])
92449
+ MJUserRoutines_UserIDArray: MJUserRoutine_[]; // Link to MJUserRoutines
92450
+
92451
+ @Field(() => [MJUserRoutineRecipient_])
92452
+ MJUserRoutineRecipients_UserIDArray: MJUserRoutineRecipient_[]; // Link to MJUserRoutineRecipients
92453
+
90484
92454
  }
90485
92455
 
90486
92456
  //****************************************************************************
@@ -91726,6 +93696,26 @@ export class MJUserResolverBase extends ResolverBase {
91726
93696
  return result;
91727
93697
  }
91728
93698
 
93699
+ @FieldResolver(() => [MJUserRoutine_])
93700
+ async MJUserRoutines_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
93701
+ this.CheckUserReadPermissions('MJ: User Routines', userPayload);
93702
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
93703
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutines')} WHERE ${provider.QuoteIdentifier('UserID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routines', userPayload, EntityPermissionType.Read, 'AND');
93704
+ const rows = await provider.ExecuteSQL(sSQL, [mjuser_.ID], undefined, this.GetUserFromPayload(userPayload));
93705
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routines', rows, this.GetUserFromPayload(userPayload));
93706
+ return result;
93707
+ }
93708
+
93709
+ @FieldResolver(() => [MJUserRoutineRecipient_])
93710
+ async MJUserRoutineRecipients_UserIDArray(@Root() mjuser_: MJUser_, @Ctx() { userPayload, providers }: AppContext, @PubSub() pubSub: PubSubEngine) {
93711
+ this.CheckUserReadPermissions('MJ: User Routine Recipients', userPayload);
93712
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
93713
+ const sSQL = `SELECT * FROM ${provider.QuoteSchemaAndView(Metadata.Provider.ConfigData.MJCoreSchemaName, 'vwUserRoutineRecipients')} WHERE ${provider.QuoteIdentifier('UserID')}=${provider.BuildParameterPlaceholder(0)} ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Routine Recipients', userPayload, EntityPermissionType.Read, 'AND');
93714
+ const rows = await provider.ExecuteSQL(sSQL, [mjuser_.ID], undefined, this.GetUserFromPayload(userPayload));
93715
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Routine Recipients', rows, this.GetUserFromPayload(userPayload));
93716
+ return result;
93717
+ }
93718
+
91729
93719
  @Mutation(() => MJUser_)
91730
93720
  async CreateMJUser(
91731
93721
  @Arg('input', () => CreateMJUserInput) input: CreateMJUserInput,