@absolutejs/voice 0.0.22-beta.434 → 0.0.22-beta.435

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.
@@ -2,6 +2,8 @@ import { Elysia } from 'elysia';
2
2
  import type { VoiceFailureReplayReport, VoiceOperationsRecord } from './operationsRecord';
3
3
  import type { VoiceOperationalStatusReport } from './operationalStatus';
4
4
  import type { VoiceOpsRecoveryReport } from './opsRecovery';
5
+ import type { VoiceAuditEventStore } from './audit';
6
+ import type { VoiceTraceEventStore } from './trace';
5
7
  import type { VoiceMonitorIssue } from './voiceMonitoring';
6
8
  export type VoiceIncidentTimelineStatus = 'fail' | 'pass' | 'warn';
7
9
  export type VoiceIncidentTimelineSeverity = 'critical' | 'info' | 'warn';
@@ -22,6 +24,8 @@ export type VoiceIncidentRecoveryAction = {
22
24
  };
23
25
  export type VoiceIncidentRecoveryActionResult = {
24
26
  actionId: string;
27
+ afterStatus?: VoiceIncidentTimelineStatus;
28
+ beforeStatus?: VoiceIncidentTimelineStatus;
25
29
  detail?: string;
26
30
  href?: string;
27
31
  ok: boolean;
@@ -91,6 +95,7 @@ export type VoiceIncidentTimelineOptions = {
91
95
  export type VoiceIncidentTimelineRoutesOptions = VoiceIncidentTimelineOptions & {
92
96
  actionHandlers?: Record<string, VoiceIncidentRecoveryActionHandler>;
93
97
  actionPath?: false | string;
98
+ audit?: VoiceAuditEventStore;
94
99
  headers?: HeadersInit;
95
100
  htmlPath?: false | string;
96
101
  markdownPath?: false | string;
@@ -98,6 +103,7 @@ export type VoiceIncidentTimelineRoutesOptions = VoiceIncidentTimelineOptions &
98
103
  path?: string;
99
104
  render?: (report: VoiceIncidentTimelineReport) => string | Promise<string>;
100
105
  title?: string;
106
+ trace?: VoiceTraceEventStore;
101
107
  };
102
108
  export declare const buildVoiceIncidentTimelineReport: (options: VoiceIncidentTimelineOptions) => Promise<VoiceIncidentTimelineReport>;
103
109
  export declare const renderVoiceIncidentTimelineMarkdown: (report: VoiceIncidentTimelineReport, options?: {
package/dist/index.js CHANGED
@@ -30519,12 +30519,36 @@ var createVoiceIncidentTimelineRoutes = (options) => {
30519
30519
  report,
30520
30520
  request
30521
30521
  });
30522
- return new Response(JSON.stringify(result), {
30522
+ const status = result.ok ? 200 : 500;
30523
+ const afterReport = await buildVoiceIncidentTimelineReport(options);
30524
+ const resultWithStatus = {
30525
+ ...result,
30526
+ afterStatus: result.afterStatus ?? afterReport.status,
30527
+ beforeStatus: result.beforeStatus ?? report.status
30528
+ };
30529
+ await recordVoiceOpsActionAudit({
30530
+ actionId: `incident.${actionId}`,
30531
+ body: {
30532
+ action,
30533
+ afterStatus: resultWithStatus.afterStatus,
30534
+ beforeStatus: resultWithStatus.beforeStatus,
30535
+ eventIds: report.events.map((event) => event.id),
30536
+ result
30537
+ },
30538
+ error: result.ok ? undefined : result.detail ?? result.status,
30539
+ ok: result.ok,
30540
+ ranAt: Date.now(),
30541
+ status
30542
+ }, {
30543
+ audit: options.audit,
30544
+ trace: options.trace
30545
+ });
30546
+ return new Response(JSON.stringify(resultWithStatus), {
30523
30547
  headers: {
30524
30548
  "Content-Type": "application/json; charset=utf-8",
30525
30549
  ...options.headers
30526
30550
  },
30527
- status: result.ok ? 200 : 500
30551
+ status
30528
30552
  });
30529
30553
  });
30530
30554
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.434",
3
+ "version": "0.0.22-beta.435",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",