@mentra/cloud-protocol 3.3.0-dev.786 → 3.3.0-dev.789
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/index.ts +1 -0
- package/src/report-automation.ts +17 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Identity of the single device incident request saved by an automated run.
|
|
2
|
+
* This binds report creation, independently of transport or collection completion.
|
|
3
|
+
*/
|
|
4
|
+
export interface ReportAutomationCorrelation {
|
|
5
|
+
alertId: string;
|
|
6
|
+
testRunId: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Preserve exact request IDs; never normalize or truncate correlation. */
|
|
10
|
+
export function reportAutomationCorrelation(value: unknown): ReportAutomationCorrelation | null {
|
|
11
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
|
|
12
|
+
const row = value as Record<string, unknown>;
|
|
13
|
+
if (Object.keys(row).length !== 2 || typeof row.alertId !== 'string'
|
|
14
|
+
|| !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/.test(row.alertId)
|
|
15
|
+
|| typeof row.testRunId !== 'string' || !row.testRunId.trim() || row.testRunId.length > 160) return null;
|
|
16
|
+
return {alertId: row.alertId, testRunId: row.testRunId};
|
|
17
|
+
}
|