@company-semantics/contracts 0.67.0 → 0.67.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/impersonation-events.ts +54 -0
- package/src/index.ts +10 -0
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Impersonation SSE Event Types
|
|
3
|
+
*
|
|
4
|
+
* Real-time push events for impersonation session state changes.
|
|
5
|
+
* Replaces 30-second polling mechanism.
|
|
6
|
+
* Follows the same BaseEvent envelope pattern as chat SSE events.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { BaseEvent } from './chat/types'
|
|
10
|
+
import type { ImpersonationSession } from './impersonation'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Sent as the first frame on SSE connection.
|
|
14
|
+
* Carries the current active session (or null if none).
|
|
15
|
+
* Eliminates need for a separate GET /session request.
|
|
16
|
+
*/
|
|
17
|
+
export interface ImpersonationSessionSnapshotEvent extends BaseEvent {
|
|
18
|
+
type: 'impersonation.session.snapshot'
|
|
19
|
+
data: {
|
|
20
|
+
session: ImpersonationSession | null
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Emitted when a new impersonation session starts (enables multi-tab sync). */
|
|
25
|
+
export interface ImpersonationSessionStartedEvent extends BaseEvent {
|
|
26
|
+
type: 'impersonation.session.started'
|
|
27
|
+
data: {
|
|
28
|
+
session: ImpersonationSession
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Emitted when an admin manually ends an impersonation session. */
|
|
33
|
+
export interface ImpersonationSessionEndedEvent extends BaseEvent {
|
|
34
|
+
type: 'impersonation.session.ended'
|
|
35
|
+
data: {
|
|
36
|
+
sessionId: string
|
|
37
|
+
endedAt: string
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Emitted when enforceExpiry() auto-expires a session. */
|
|
42
|
+
export interface ImpersonationSessionExpiredEvent extends BaseEvent {
|
|
43
|
+
type: 'impersonation.session.expired'
|
|
44
|
+
data: {
|
|
45
|
+
sessionId: string
|
|
46
|
+
expiredAt: string
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type ImpersonationSseEvent =
|
|
51
|
+
| ImpersonationSessionSnapshotEvent
|
|
52
|
+
| ImpersonationSessionStartedEvent
|
|
53
|
+
| ImpersonationSessionEndedEvent
|
|
54
|
+
| ImpersonationSessionExpiredEvent
|
package/src/index.ts
CHANGED
|
@@ -437,6 +437,16 @@ export type {
|
|
|
437
437
|
|
|
438
438
|
export { RESTRICTED_IMPERSONATION_ACTIONS } from './impersonation'
|
|
439
439
|
|
|
440
|
+
// Impersonation SSE event types (real-time push)
|
|
441
|
+
// @see PRD-00176 for design rationale
|
|
442
|
+
export type {
|
|
443
|
+
ImpersonationSessionSnapshotEvent,
|
|
444
|
+
ImpersonationSessionStartedEvent,
|
|
445
|
+
ImpersonationSessionEndedEvent,
|
|
446
|
+
ImpersonationSessionExpiredEvent,
|
|
447
|
+
ImpersonationSseEvent,
|
|
448
|
+
} from './impersonation-events'
|
|
449
|
+
|
|
440
450
|
// Usage tracking types (internal admin)
|
|
441
451
|
// @see PRD-00166 for design rationale
|
|
442
452
|
export type {
|