@memberjunction/server 5.51.0 → 6.1.0-edge.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/dist/agentSessions/SessionManager.d.ts +22 -1
- package/dist/agentSessions/SessionManager.d.ts.map +1 -1
- package/dist/agentSessions/SessionManager.js +13 -3
- package/dist/agentSessions/SessionManager.js.map +1 -1
- package/dist/auth/actingContextResolver.d.ts +44 -0
- package/dist/auth/actingContextResolver.d.ts.map +1 -0
- package/dist/auth/actingContextResolver.js +18 -0
- package/dist/auth/actingContextResolver.js.map +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/sessionUserClone.d.ts +32 -0
- package/dist/auth/sessionUserClone.d.ts.map +1 -0
- package/dist/auth/sessionUserClone.js +50 -0
- package/dist/auth/sessionUserClone.js.map +1 -0
- package/dist/context.d.ts +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +43 -6
- package/dist/context.js.map +1 -1
- package/dist/generated/generated.d.ts +71 -0
- package/dist/generated/generated.d.ts.map +1 -1
- package/dist/generated/generated.js +383 -3
- package/dist/generated/generated.js.map +1 -1
- package/dist/generic/FireAndForgetHeartbeat.d.ts +5 -0
- package/dist/generic/FireAndForgetHeartbeat.d.ts.map +1 -1
- package/dist/generic/FireAndForgetHeartbeat.js +5 -4
- package/dist/generic/FireAndForgetHeartbeat.js.map +1 -1
- package/dist/generic/PushStatusResolver.d.ts +58 -0
- package/dist/generic/PushStatusResolver.d.ts.map +1 -1
- package/dist/generic/PushStatusResolver.js +42 -3
- package/dist/generic/PushStatusResolver.js.map +1 -1
- package/dist/generic/ResolverBase.d.ts +9 -0
- package/dist/generic/ResolverBase.d.ts.map +1 -1
- package/dist/generic/ResolverBase.js +31 -13
- package/dist/generic/ResolverBase.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/multiTenancy/index.d.ts +19 -0
- package/dist/multiTenancy/index.d.ts.map +1 -1
- package/dist/multiTenancy/index.js +82 -5
- package/dist/multiTenancy/index.js.map +1 -1
- package/dist/resolvers/ActionResolver.d.ts.map +1 -1
- package/dist/resolvers/ActionResolver.js +12 -5
- package/dist/resolvers/ActionResolver.js.map +1 -1
- package/dist/resolvers/MCPResolver.d.ts.map +1 -1
- package/dist/resolvers/MCPResolver.js +13 -16
- package/dist/resolvers/MCPResolver.js.map +1 -1
- package/dist/resolvers/RealtimeClientSessionResolver.d.ts +1 -1
- package/dist/resolvers/RealtimeClientSessionResolver.d.ts.map +1 -1
- package/dist/resolvers/RealtimeClientSessionResolver.js +15 -14
- package/dist/resolvers/RealtimeClientSessionResolver.js.map +1 -1
- package/dist/resolvers/RemoteBrowserActionResolver.d.ts.map +1 -1
- package/dist/resolvers/RemoteBrowserActionResolver.js +19 -26
- package/dist/resolvers/RemoteBrowserActionResolver.js.map +1 -1
- package/dist/resolvers/ReportResolver.d.ts.map +1 -1
- package/dist/resolvers/ReportResolver.js +11 -3
- package/dist/resolvers/ReportResolver.js.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.js +30 -40
- package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
- package/dist/resolvers/RunTestResolver.d.ts.map +1 -1
- package/dist/resolvers/RunTestResolver.js +90 -112
- package/dist/resolvers/RunTestResolver.js.map +1 -1
- package/dist/resolvers/SearchKnowledgeResolver.js +3 -3
- package/dist/resolvers/SearchKnowledgeResolver.js.map +1 -1
- package/dist/resolvers/SearchKnowledgeStreamResolver.js +2 -2
- package/dist/resolvers/SearchKnowledgeStreamResolver.js.map +1 -1
- package/dist/resolvers/VersionHistoryResolver.d.ts.map +1 -1
- package/dist/resolvers/VersionHistoryResolver.js +8 -12
- package/dist/resolvers/VersionHistoryResolver.js.map +1 -1
- package/dist/services/TaskOrchestrator.d.ts.map +1 -1
- package/dist/services/TaskOrchestrator.js +17 -15
- package/dist/services/TaskOrchestrator.js.map +1 -1
- package/package.json +100 -100
- package/src/__tests__/RealtimeBridgeResolver.test.ts +6 -0
- package/src/__tests__/SessionManager.test.ts +44 -0
- package/src/__tests__/multiTenancy.security.test.ts +254 -22
- package/src/__tests__/multiTenancy.test.ts +22 -0
- package/src/__tests__/pushStatusResolver.filter.test.ts +56 -0
- package/src/__tests__/resolverBase.rls.test.ts +4 -0
- package/src/__tests__/search-knowledge-tags.test.ts +74 -6
- package/src/__tests__/sessionUserClone.test.ts +161 -0
- package/src/agentSessions/SessionManager.ts +26 -2
- package/src/auth/actingContextResolver.ts +56 -0
- package/src/auth/index.ts +1 -0
- package/src/auth/sessionUserClone.ts +50 -0
- package/src/context.ts +48 -6
- package/src/generated/generated.ts +276 -3
- package/src/generic/FireAndForgetHeartbeat.ts +10 -4
- package/src/generic/PushStatusResolver.ts +79 -4
- package/src/generic/ResolverBase.ts +33 -13
- package/src/index.ts +4 -2
- package/src/multiTenancy/index.ts +92 -5
- package/src/resolvers/ActionResolver.ts +15 -7
- package/src/resolvers/MCPResolver.ts +13 -15
- package/src/resolvers/RealtimeClientSessionResolver.ts +15 -13
- package/src/resolvers/RemoteBrowserActionResolver.ts +19 -25
- package/src/resolvers/ReportResolver.ts +11 -3
- package/src/resolvers/RunAIAgentResolver.ts +30 -40
- package/src/resolvers/RunTestResolver.ts +90 -112
- package/src/resolvers/SearchKnowledgeResolver.ts +3 -3
- package/src/resolvers/SearchKnowledgeStreamResolver.ts +2 -2
- package/src/resolvers/VersionHistoryResolver.ts +10 -13
- package/src/resolvers/__tests__/ReportResolver.test.ts +279 -0
- package/src/services/TaskOrchestrator.ts +17 -17
|
@@ -3,7 +3,6 @@ import { Arg, Ctx, Field, Int, Mutation, ObjectType, Query, Resolver } from 'typ
|
|
|
3
3
|
import { AppContext } from '../types.js';
|
|
4
4
|
import { MJConversationDetailEntity, MJReportEntity } from '@memberjunction/core-entities';
|
|
5
5
|
import { DataContext } from '@memberjunction/data-context';
|
|
6
|
-
import { UserCache } from '@memberjunction/sqlserver-dataprovider';
|
|
7
6
|
import { z } from 'zod';
|
|
8
7
|
import mssql from 'mssql';
|
|
9
8
|
import { GetReadOnlyProvider, GetReadWriteProvider } from '../util.js';
|
|
@@ -80,7 +79,15 @@ export class ReportResolverExtended extends ResolverBase {
|
|
|
80
79
|
try {
|
|
81
80
|
const md = GetReadWriteProvider(providers);
|
|
82
81
|
|
|
83
|
-
|
|
82
|
+
// Resolve via the stamped payload user (GetUserFromPayload), NOT a fresh UserCache
|
|
83
|
+
// lookup by email. UserCache.Users returns the shared, unstamped instance — re-fetching
|
|
84
|
+
// by email here would silently drop any per-request API-key row-filter binding
|
|
85
|
+
// (APIKeyRowFilters / APIKeyActingContext) already stamped onto userPayload.userRecord,
|
|
86
|
+
// so a filtered key's report-creation work would run unfiltered. GetUserFromPayload
|
|
87
|
+
// prefers userPayload.userRecord and only falls back to a UserCache email lookup when
|
|
88
|
+
// no payload user is present (e.g. non-request-scoped callers), matching every other
|
|
89
|
+
// resolver's contextUser resolution.
|
|
90
|
+
const u = this.GetUserFromPayload(userPayload);
|
|
84
91
|
if (!u) throw new Error('Unable to find user');
|
|
85
92
|
|
|
86
93
|
const cde = md.Entities.find((e) => e.Name === 'MJ: Conversation Details');
|
|
@@ -98,9 +105,10 @@ export class ReportResolverExtended extends ResolverBase {
|
|
|
98
105
|
ON
|
|
99
106
|
cd.ConversationID = c.ID
|
|
100
107
|
WHERE
|
|
101
|
-
cd.ID
|
|
108
|
+
cd.ID=@ConversationDetailID`;
|
|
102
109
|
|
|
103
110
|
const request = new mssql.Request(dataSource);
|
|
111
|
+
request.input('ConversationDetailID', mssql.UniqueIdentifier, ConversationDetailID);
|
|
104
112
|
const result = await request.query(sql);
|
|
105
113
|
if (!result || !result.recordset || result.recordset.length === 0) throw new Error('Unable to retrieve converation details');
|
|
106
114
|
const skipData: { title?: string; reportTitle?: string; userExplanation?: string; messages?: unknown[] } = JSON.parse(result.recordset[0].Message);
|
|
@@ -8,7 +8,6 @@ import { MJAIAgentEntityExtended, MJAIAgentRunEntityExtended, ExecuteAgentResult
|
|
|
8
8
|
import { AIEngine } from '@memberjunction/aiengine';
|
|
9
9
|
import { ChatMessage, ChatMessageContent } from '@memberjunction/ai';
|
|
10
10
|
import { ResolverBase } from '../generic/ResolverBase.js';
|
|
11
|
-
import { PUSH_STATUS_UPDATES_TOPIC } from '../generic/PushStatusResolver.js';
|
|
12
11
|
import { startLivenessPulse } from '../generic/FireAndForgetHeartbeat.js';
|
|
13
12
|
import { RequireSystemUser } from '../directives/RequireSystemUser.js';
|
|
14
13
|
import { GetReadWriteProvider } from '../util.js';
|
|
@@ -306,28 +305,22 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
306
305
|
}
|
|
307
306
|
|
|
308
307
|
private PublishProgressUpdate(pubSub: PubSubEngine, data: any, userPayload: UserPayload) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}),
|
|
316
|
-
sessionId: userPayload.sessionId,
|
|
317
|
-
});
|
|
308
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
309
|
+
resolver: 'RunAIAgentResolver',
|
|
310
|
+
type: 'ExecutionProgress',
|
|
311
|
+
status: 'ok',
|
|
312
|
+
data,
|
|
313
|
+
}), userPayload);
|
|
318
314
|
}
|
|
319
315
|
|
|
320
316
|
|
|
321
317
|
private PublishStreamingUpdate(pubSub: PubSubEngine, data: any, userPayload: UserPayload) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}),
|
|
329
|
-
sessionId: userPayload.sessionId,
|
|
330
|
-
});
|
|
318
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
319
|
+
resolver: 'RunAIAgentResolver',
|
|
320
|
+
type: 'StreamingContent',
|
|
321
|
+
status: 'ok',
|
|
322
|
+
data,
|
|
323
|
+
}), userPayload);
|
|
331
324
|
}
|
|
332
325
|
|
|
333
326
|
/**
|
|
@@ -814,17 +807,15 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
814
807
|
LogStatus(`📬 Notification sent via ${channelList} (ID: ${result.inAppNotificationId})`);
|
|
815
808
|
|
|
816
809
|
// Publish real-time notification event so client updates immediately
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
})
|
|
827
|
-
});
|
|
810
|
+
// NOTE (B49): normalized from a malformed no-sessionId payload
|
|
811
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
812
|
+
type: 'notification',
|
|
813
|
+
notificationId: result.inAppNotificationId,
|
|
814
|
+
action: 'create',
|
|
815
|
+
title: `${agentName} completed your request`,
|
|
816
|
+
message: message,
|
|
817
|
+
conversationId: conversationId
|
|
818
|
+
}), userPayload);
|
|
828
819
|
|
|
829
820
|
LogStatus(`📡 Published notification event to client`);
|
|
830
821
|
} else if (!result.success) {
|
|
@@ -926,16 +917,14 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
926
917
|
LogStatus(`📬 Feedback request notification sent (ID: ${notifResult.inAppNotificationId})`);
|
|
927
918
|
|
|
928
919
|
// Publish real-time notification event
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
})
|
|
938
|
-
});
|
|
920
|
+
// NOTE (B49): normalized from a malformed no-sessionId payload
|
|
921
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
922
|
+
type: 'notification',
|
|
923
|
+
notificationId: notifResult.inAppNotificationId,
|
|
924
|
+
action: 'create',
|
|
925
|
+
title: `${agentName} needs your input`,
|
|
926
|
+
message: truncatedMessage
|
|
927
|
+
}), userPayload);
|
|
939
928
|
} else if (!notifResult.success) {
|
|
940
929
|
LogError(`Feedback request notification failed: ${notifResult.errors?.join(', ')}`);
|
|
941
930
|
}
|
|
@@ -1294,6 +1283,7 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
1294
1283
|
const pulse = startLivenessPulse({
|
|
1295
1284
|
pubSub,
|
|
1296
1285
|
sessionId,
|
|
1286
|
+
ownerUserId: userPayload.userRecord.ID,
|
|
1297
1287
|
resolver: 'RunAIAgentResolver',
|
|
1298
1288
|
readStatus: () => runRef.current
|
|
1299
1289
|
? { runId: runRef.current.ID, status: runRef.current.Status }
|
|
@@ -15,7 +15,6 @@ import { AppContext, UserPayload } from '../types.js';
|
|
|
15
15
|
import { LogError, LogStatus, UserInfo } from '@memberjunction/core';
|
|
16
16
|
import { TestEngine } from '@memberjunction/testing-engine';
|
|
17
17
|
import { ResolverBase } from '../generic/ResolverBase.js';
|
|
18
|
-
import { PUSH_STATUS_UPDATES_TOPIC } from '../generic/PushStatusResolver.js';
|
|
19
18
|
import { startLivenessPulse } from '../generic/FireAndForgetHeartbeat.js';
|
|
20
19
|
import { TestRunVariables, TestLogMessage, TestRunResult as EngineTestRunResult } from '@memberjunction/testing-engine-base';
|
|
21
20
|
|
|
@@ -257,7 +256,7 @@ export class RunTestResolver extends ResolverBase {
|
|
|
257
256
|
): void {
|
|
258
257
|
// Keep-alive pulse so a long-running test never trips the client idle timeout.
|
|
259
258
|
// The client captures the testRunId from progress events for reconciliation.
|
|
260
|
-
const pulse = startLivenessPulse({ pubSub, sessionId: userPayload.sessionId, resolver: 'RunTestResolver' });
|
|
259
|
+
const pulse = startLivenessPulse({ pubSub, sessionId: userPayload.sessionId, ownerUserId: userPayload.userRecord.ID, resolver: 'RunTestResolver' });
|
|
261
260
|
|
|
262
261
|
this.executeTest(testId, verbose, environment, tags, variables, pubSub, userPayload, user)
|
|
263
262
|
.catch((error: unknown) => {
|
|
@@ -353,7 +352,7 @@ export class RunTestResolver extends ResolverBase {
|
|
|
353
352
|
// (Suite reconciliation isn't wired: suite progress carries the per-test run id, not the
|
|
354
353
|
// Test Suite Run id, so the client has no handle to reconcile against — the pulse is the
|
|
355
354
|
// protection here.)
|
|
356
|
-
const pulse = startLivenessPulse({ pubSub, sessionId: userPayload.sessionId, resolver: 'RunTestResolver' });
|
|
355
|
+
const pulse = startLivenessPulse({ pubSub, sessionId: userPayload.sessionId, ownerUserId: userPayload.userRecord.ID, resolver: 'RunTestResolver' });
|
|
357
356
|
|
|
358
357
|
this.executeSuite(
|
|
359
358
|
suiteId, verbose, environment, parallel, tags, variables,
|
|
@@ -494,51 +493,42 @@ export class RunTestResolver extends ResolverBase {
|
|
|
494
493
|
// ===== PubSub Publishing =====
|
|
495
494
|
|
|
496
495
|
private publishProgress(pubSub: PubSubEngine, data: TestExecutionStreamMessage, userPayload: UserPayload) {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}),
|
|
504
|
-
sessionId: userPayload.sessionId,
|
|
505
|
-
});
|
|
496
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
497
|
+
resolver: 'RunTestResolver',
|
|
498
|
+
type: 'TestExecutionProgress',
|
|
499
|
+
status: 'ok',
|
|
500
|
+
data,
|
|
501
|
+
}), userPayload);
|
|
506
502
|
}
|
|
507
503
|
|
|
508
504
|
private publishComplete(pubSub: PubSubEngine, userPayload: UserPayload, result: EngineTestRunResult) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}),
|
|
522
|
-
sessionId: userPayload.sessionId,
|
|
523
|
-
});
|
|
505
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
506
|
+
resolver: 'RunTestResolver',
|
|
507
|
+
type: 'TestExecutionComplete',
|
|
508
|
+
status: 'ok',
|
|
509
|
+
data: {
|
|
510
|
+
sessionId: userPayload.sessionId,
|
|
511
|
+
testRunId: result.testRunId,
|
|
512
|
+
type: 'complete',
|
|
513
|
+
result: JSON.stringify(result),
|
|
514
|
+
timestamp: new Date()
|
|
515
|
+
},
|
|
516
|
+
}), userPayload);
|
|
524
517
|
}
|
|
525
518
|
|
|
526
519
|
private publishError(pubSub: PubSubEngine, userPayload: UserPayload, testId: string, errorMsg: string) {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}),
|
|
540
|
-
sessionId: userPayload.sessionId,
|
|
541
|
-
});
|
|
520
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
521
|
+
resolver: 'RunTestResolver',
|
|
522
|
+
type: 'TestExecutionError',
|
|
523
|
+
status: 'error',
|
|
524
|
+
data: {
|
|
525
|
+
sessionId: userPayload.sessionId,
|
|
526
|
+
testRunId: testId,
|
|
527
|
+
type: 'error',
|
|
528
|
+
errorMessage: errorMsg,
|
|
529
|
+
timestamp: new Date()
|
|
530
|
+
},
|
|
531
|
+
}), userPayload);
|
|
542
532
|
}
|
|
543
533
|
|
|
544
534
|
/**
|
|
@@ -551,24 +541,21 @@ export class RunTestResolver extends ResolverBase {
|
|
|
551
541
|
testId: string,
|
|
552
542
|
testRunResult: TestRunResult
|
|
553
543
|
) {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}),
|
|
570
|
-
sessionId: userPayload.sessionId,
|
|
571
|
-
});
|
|
544
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
545
|
+
resolver: 'RunTestResolver',
|
|
546
|
+
type: 'FireAndForgetComplete',
|
|
547
|
+
status: 'ok',
|
|
548
|
+
data: {
|
|
549
|
+
sessionId: userPayload.sessionId,
|
|
550
|
+
testId,
|
|
551
|
+
type: 'complete',
|
|
552
|
+
success: testRunResult.success,
|
|
553
|
+
errorMessage: testRunResult.errorMessage,
|
|
554
|
+
executionTimeMs: testRunResult.executionTimeMs,
|
|
555
|
+
result: testRunResult.result,
|
|
556
|
+
timestamp: new Date()
|
|
557
|
+
},
|
|
558
|
+
}), userPayload);
|
|
572
559
|
}
|
|
573
560
|
|
|
574
561
|
/**
|
|
@@ -580,23 +567,20 @@ export class RunTestResolver extends ResolverBase {
|
|
|
580
567
|
testId: string,
|
|
581
568
|
errorMessage: string
|
|
582
569
|
) {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}),
|
|
598
|
-
sessionId: userPayload.sessionId,
|
|
599
|
-
});
|
|
570
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
571
|
+
resolver: 'RunTestResolver',
|
|
572
|
+
type: 'FireAndForgetComplete',
|
|
573
|
+
status: 'ok',
|
|
574
|
+
data: {
|
|
575
|
+
sessionId: userPayload.sessionId,
|
|
576
|
+
testId,
|
|
577
|
+
type: 'complete',
|
|
578
|
+
success: false,
|
|
579
|
+
errorMessage,
|
|
580
|
+
result: JSON.stringify({ success: false, errorMessage }),
|
|
581
|
+
timestamp: new Date()
|
|
582
|
+
},
|
|
583
|
+
}), userPayload);
|
|
600
584
|
}
|
|
601
585
|
|
|
602
586
|
/**
|
|
@@ -609,24 +593,21 @@ export class RunTestResolver extends ResolverBase {
|
|
|
609
593
|
suiteId: string,
|
|
610
594
|
suiteRunResult: TestSuiteRunResult
|
|
611
595
|
) {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}),
|
|
628
|
-
sessionId: userPayload.sessionId,
|
|
629
|
-
});
|
|
596
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
597
|
+
resolver: 'RunTestResolver',
|
|
598
|
+
type: 'FireAndForgetSuiteComplete',
|
|
599
|
+
status: 'ok',
|
|
600
|
+
data: {
|
|
601
|
+
sessionId: userPayload.sessionId,
|
|
602
|
+
suiteId,
|
|
603
|
+
type: 'complete',
|
|
604
|
+
success: suiteRunResult.success,
|
|
605
|
+
errorMessage: suiteRunResult.errorMessage,
|
|
606
|
+
executionTimeMs: suiteRunResult.executionTimeMs,
|
|
607
|
+
result: suiteRunResult.result,
|
|
608
|
+
timestamp: new Date()
|
|
609
|
+
},
|
|
610
|
+
}), userPayload);
|
|
630
611
|
}
|
|
631
612
|
|
|
632
613
|
/**
|
|
@@ -638,22 +619,19 @@ export class RunTestResolver extends ResolverBase {
|
|
|
638
619
|
suiteId: string,
|
|
639
620
|
errorMessage: string
|
|
640
621
|
) {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
}),
|
|
656
|
-
sessionId: userPayload.sessionId,
|
|
657
|
-
});
|
|
622
|
+
this.PublishStatusUpdate(pubSub, userPayload.sessionId, JSON.stringify({
|
|
623
|
+
resolver: 'RunTestResolver',
|
|
624
|
+
type: 'FireAndForgetSuiteComplete',
|
|
625
|
+
status: 'ok',
|
|
626
|
+
data: {
|
|
627
|
+
sessionId: userPayload.sessionId,
|
|
628
|
+
suiteId,
|
|
629
|
+
type: 'complete',
|
|
630
|
+
success: false,
|
|
631
|
+
errorMessage,
|
|
632
|
+
result: JSON.stringify({ success: false, errorMessage }),
|
|
633
|
+
timestamp: new Date()
|
|
634
|
+
},
|
|
635
|
+
}), userPayload);
|
|
658
636
|
}
|
|
659
637
|
}
|
|
@@ -3,7 +3,7 @@ import { GraphQLJSON } from 'graphql-type-json';
|
|
|
3
3
|
import { AppContext } from '../types.js';
|
|
4
4
|
import { LogError, LogStatus, Metadata, RunView, UserInfo } from '@memberjunction/core';
|
|
5
5
|
import { ResolverBase } from '../generic/ResolverBase.js';
|
|
6
|
-
import { SearchEngine, SearchResult as SearchEngineResult, SearchResultItem as SearchEngineResultItem, SearchProviderInfo, SearchContext,
|
|
6
|
+
import { SearchEngine, SearchResult as SearchEngineResult, SearchResultItem as SearchEngineResultItem, SearchProviderInfo, SearchContext, GetSearchScopePermissionResolver } from '@memberjunction/search-engine';
|
|
7
7
|
import { SearchEngineBase, MJAIAgentEntity } from '@memberjunction/core-entities';
|
|
8
8
|
import { UUIDsEqual } from '@memberjunction/global';
|
|
9
9
|
|
|
@@ -284,7 +284,7 @@ export class SearchKnowledgeResolver extends ResolverBase {
|
|
|
284
284
|
agentID: string | undefined,
|
|
285
285
|
): Promise<string | undefined> {
|
|
286
286
|
const agent = await this.loadAgent(agentID, user);
|
|
287
|
-
const resolver =
|
|
287
|
+
const resolver = GetSearchScopePermissionResolver();
|
|
288
288
|
for (const scopeID of scopeIDs) {
|
|
289
289
|
const verdict = await resolver.ResolveEffectivePermission({
|
|
290
290
|
User: user,
|
|
@@ -351,7 +351,7 @@ export class SearchKnowledgeResolver extends ResolverBase {
|
|
|
351
351
|
|
|
352
352
|
const ownedOrUnowned = scopes.filter(s => !s.OwnerUserID || UUIDsEqual(s.OwnerUserID, userID));
|
|
353
353
|
const agent = await this.loadAgent(agentID, currentUser);
|
|
354
|
-
const resolver =
|
|
354
|
+
const resolver = GetSearchScopePermissionResolver();
|
|
355
355
|
|
|
356
356
|
const visible: SearchScopeInfo[] = [];
|
|
357
357
|
for (const s of ownedOrUnowned) {
|
|
@@ -28,7 +28,7 @@ import { ResolverBase } from '../generic/ResolverBase.js';
|
|
|
28
28
|
import {
|
|
29
29
|
SearchEngine,
|
|
30
30
|
SearchContext,
|
|
31
|
-
|
|
31
|
+
GetSearchScopePermissionResolver,
|
|
32
32
|
SearchStreamEvent,
|
|
33
33
|
} from '@memberjunction/search-engine';
|
|
34
34
|
import { MJAIAgentEntity } from '@memberjunction/core-entities';
|
|
@@ -299,7 +299,7 @@ export class SearchKnowledgeStreamResolver extends ResolverBase {
|
|
|
299
299
|
agentID: string | undefined,
|
|
300
300
|
): Promise<string | undefined> {
|
|
301
301
|
const agent = await this.loadAgent(agentID, user);
|
|
302
|
-
const resolver =
|
|
302
|
+
const resolver = GetSearchScopePermissionResolver();
|
|
303
303
|
for (const scopeID of scopeIDs) {
|
|
304
304
|
const verdict = await resolver.ResolveEffectivePermission({
|
|
305
305
|
User: user,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Resolver, Mutation, Arg, Ctx, ObjectType, Field, Int, InputType, PubSub, PubSubEngine } from 'type-graphql';
|
|
2
|
-
import { AppContext } from '../types.js';
|
|
2
|
+
import { AppContext, UserPayload } from '../types.js';
|
|
3
3
|
import { LogError, LogStatus, CompositeKey, KeyValuePair } from '@memberjunction/core';
|
|
4
4
|
import { ResolverBase } from '../generic/ResolverBase.js';
|
|
5
5
|
import { VersionHistoryEngine } from '@memberjunction/version-history';
|
|
6
6
|
import { CreateLabelParams, CreateLabelProgressUpdate, VersionLabelScope } from '@memberjunction/version-history';
|
|
7
7
|
import { KeyValuePairInput } from '../generic/KeyValuePairInput.js';
|
|
8
|
-
import { PUSH_STATUS_UPDATES_TOPIC } from '../generic/PushStatusResolver.js';
|
|
9
8
|
|
|
10
9
|
// =========================================================================
|
|
11
10
|
// GraphQL types
|
|
@@ -115,7 +114,7 @@ export class VersionHistoryResolver extends ResolverBase {
|
|
|
115
114
|
|
|
116
115
|
// Build progress callback that publishes to PubSub
|
|
117
116
|
const resolvedSessionId = sessionId ?? context.userPayload.sessionId;
|
|
118
|
-
const onProgress = this.buildProgressCallback(pubSub, resolvedSessionId);
|
|
117
|
+
const onProgress = this.buildProgressCallback(pubSub, resolvedSessionId, context.userPayload);
|
|
119
118
|
|
|
120
119
|
const params: CreateLabelParams = {
|
|
121
120
|
Name: input.Name,
|
|
@@ -160,18 +159,16 @@ export class VersionHistoryResolver extends ResolverBase {
|
|
|
160
159
|
*/
|
|
161
160
|
private buildProgressCallback(
|
|
162
161
|
pubSub: PubSubEngine,
|
|
163
|
-
sessionId: string
|
|
162
|
+
sessionId: string,
|
|
163
|
+
userPayload: UserPayload
|
|
164
164
|
): (progress: CreateLabelProgressUpdate) => void {
|
|
165
165
|
return (progress: CreateLabelProgressUpdate) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}),
|
|
173
|
-
sessionId,
|
|
174
|
-
});
|
|
166
|
+
this.PublishStatusUpdate(pubSub, sessionId, JSON.stringify({
|
|
167
|
+
resolver: 'VersionHistoryResolver',
|
|
168
|
+
type: 'CreateLabelProgress',
|
|
169
|
+
status: 'ok',
|
|
170
|
+
data: progress,
|
|
171
|
+
}), userPayload);
|
|
175
172
|
};
|
|
176
173
|
}
|
|
177
174
|
}
|