@devicerail/live-visualizer 0.1.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 +201 -0
- package/README.md +30 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/limits.d.ts +4 -0
- package/dist/limits.js +52 -0
- package/dist/live-timeline.d.ts +26 -0
- package/dist/live-timeline.js +440 -0
- package/dist/presentation.d.ts +3 -0
- package/dist/presentation.js +341 -0
- package/dist/sanitize.d.ts +8 -0
- package/dist/sanitize.js +261 -0
- package/dist/types.d.ts +167 -0
- package/dist/types.js +1 -0
- package/package.json +52 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { SessionOutcome, VerdictStatus } from "@devicerail/protocol";
|
|
2
|
+
export type TimelineFilter = "all" | "observations" | "actions" | "errors" | "verdicts";
|
|
3
|
+
export type LiveTimelineStatus = "active" | "sessionEnded" | "viewerCapacityExceeded" | "failed" | "stopped";
|
|
4
|
+
export interface LiveTimelineLimits {
|
|
5
|
+
readonly maxEvents: number;
|
|
6
|
+
readonly maxTotalBytes: number;
|
|
7
|
+
readonly maxEventBytes: number;
|
|
8
|
+
readonly maxInputEventBytes: number;
|
|
9
|
+
readonly maxTextBytes: number;
|
|
10
|
+
readonly maxJsonBytes: number;
|
|
11
|
+
readonly maxJsonDepth: number;
|
|
12
|
+
readonly maxEvidencePerEvent: number;
|
|
13
|
+
}
|
|
14
|
+
export interface BoundedText {
|
|
15
|
+
readonly text: string;
|
|
16
|
+
readonly truncated: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface BoundedJson {
|
|
19
|
+
readonly json: string;
|
|
20
|
+
readonly truncated: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ReferenceOnlyEvidence {
|
|
23
|
+
readonly availability: "referenceOnly";
|
|
24
|
+
readonly id: BoundedText;
|
|
25
|
+
readonly mediaType: BoundedText;
|
|
26
|
+
readonly sha256?: BoundedText;
|
|
27
|
+
}
|
|
28
|
+
export interface ObservationPresentation {
|
|
29
|
+
readonly capturedAtMs: number;
|
|
30
|
+
readonly deviceId: BoundedText;
|
|
31
|
+
readonly id: BoundedText;
|
|
32
|
+
readonly screenshot?: ReferenceOnlyEvidence;
|
|
33
|
+
readonly screenshotOmission?: "policy" | "protectedAction";
|
|
34
|
+
readonly viewport: {
|
|
35
|
+
readonly height: number;
|
|
36
|
+
readonly scaleFactor: number;
|
|
37
|
+
readonly width: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface ErrorPresentation {
|
|
41
|
+
readonly code: BoundedText;
|
|
42
|
+
readonly details?: BoundedJson;
|
|
43
|
+
readonly message: BoundedText;
|
|
44
|
+
readonly retryable: boolean;
|
|
45
|
+
}
|
|
46
|
+
export type ActionCompletionPresentation = {
|
|
47
|
+
readonly outcome: "succeeded";
|
|
48
|
+
readonly after?: ObservationPresentation;
|
|
49
|
+
readonly before?: ObservationPresentation;
|
|
50
|
+
readonly evidence: readonly ReferenceOnlyEvidence[];
|
|
51
|
+
readonly evidenceOmitted: number;
|
|
52
|
+
readonly finishedAtMs: number;
|
|
53
|
+
readonly output: BoundedJson;
|
|
54
|
+
readonly startedAtMs: number;
|
|
55
|
+
} | {
|
|
56
|
+
readonly outcome: "failed" | "cancelled";
|
|
57
|
+
readonly error: ErrorPresentation;
|
|
58
|
+
} | {
|
|
59
|
+
readonly outcome: "timedOut";
|
|
60
|
+
readonly error: ErrorPresentation;
|
|
61
|
+
readonly timeoutMs: number;
|
|
62
|
+
};
|
|
63
|
+
export type TimelinePresentation = {
|
|
64
|
+
readonly type: "sessionStarted";
|
|
65
|
+
} | {
|
|
66
|
+
readonly type: "sessionEnded";
|
|
67
|
+
readonly outcome: SessionOutcome;
|
|
68
|
+
readonly reason?: BoundedText;
|
|
69
|
+
} | {
|
|
70
|
+
readonly type: "observationCaptured";
|
|
71
|
+
readonly observation: ObservationPresentation;
|
|
72
|
+
} | {
|
|
73
|
+
readonly type: "actionStarted";
|
|
74
|
+
readonly arguments: BoundedJson | {
|
|
75
|
+
readonly omitted: "protected";
|
|
76
|
+
};
|
|
77
|
+
readonly callId: BoundedText;
|
|
78
|
+
readonly name: BoundedText;
|
|
79
|
+
} | {
|
|
80
|
+
readonly type: "actionCompleted";
|
|
81
|
+
readonly callId: BoundedText;
|
|
82
|
+
readonly completion: ActionCompletionPresentation;
|
|
83
|
+
} | {
|
|
84
|
+
readonly type: "mediaStreamStarted";
|
|
85
|
+
readonly streamId: BoundedText;
|
|
86
|
+
readonly kind: "screenshot" | "video";
|
|
87
|
+
readonly mediaType: BoundedText;
|
|
88
|
+
readonly viewport?: {
|
|
89
|
+
readonly height: number;
|
|
90
|
+
readonly scaleFactor: number;
|
|
91
|
+
readonly width: number;
|
|
92
|
+
};
|
|
93
|
+
} | {
|
|
94
|
+
readonly type: "mediaFrameCaptured";
|
|
95
|
+
readonly streamId: BoundedText;
|
|
96
|
+
readonly frameIndex: number;
|
|
97
|
+
readonly keyFrame: boolean;
|
|
98
|
+
readonly durationMs?: number;
|
|
99
|
+
readonly evidence: ReferenceOnlyEvidence;
|
|
100
|
+
} | {
|
|
101
|
+
readonly type: "mediaStreamEnded";
|
|
102
|
+
readonly streamId: BoundedText;
|
|
103
|
+
readonly frameCount: number;
|
|
104
|
+
} | {
|
|
105
|
+
readonly type: "error";
|
|
106
|
+
readonly error: ErrorPresentation;
|
|
107
|
+
} | {
|
|
108
|
+
readonly type: "verdictRecorded";
|
|
109
|
+
readonly status: VerdictStatus;
|
|
110
|
+
readonly summary: BoundedText;
|
|
111
|
+
readonly evidence: readonly ReferenceOnlyEvidence[];
|
|
112
|
+
readonly evidenceOmitted: number;
|
|
113
|
+
};
|
|
114
|
+
export interface TimelineEntry {
|
|
115
|
+
readonly atMs: number;
|
|
116
|
+
readonly category: "session" | "observation" | "action" | "media" | "error" | "verdict";
|
|
117
|
+
readonly deviceId?: BoundedText;
|
|
118
|
+
readonly eventId: BoundedText;
|
|
119
|
+
readonly presentation: TimelinePresentation;
|
|
120
|
+
readonly sequence: number;
|
|
121
|
+
readonly sessionId: string;
|
|
122
|
+
readonly status?: string;
|
|
123
|
+
readonly title: string;
|
|
124
|
+
}
|
|
125
|
+
export interface PreparedTimelineEvent {
|
|
126
|
+
readonly byteSize: number;
|
|
127
|
+
readonly fingerprint: string;
|
|
128
|
+
readonly presentation: TimelineEntry;
|
|
129
|
+
readonly sequence: number;
|
|
130
|
+
}
|
|
131
|
+
export interface TimelineCommit {
|
|
132
|
+
readonly fingerprint: string;
|
|
133
|
+
readonly kind: "committed" | "pendingReplay";
|
|
134
|
+
readonly sequence: number;
|
|
135
|
+
}
|
|
136
|
+
export interface TimelineConfirmation {
|
|
137
|
+
readonly revision: number;
|
|
138
|
+
readonly sequence: number;
|
|
139
|
+
readonly status: LiveTimelineStatus;
|
|
140
|
+
}
|
|
141
|
+
export interface LiveTimelineState {
|
|
142
|
+
readonly confirmedSequence?: number;
|
|
143
|
+
readonly eventCount: number;
|
|
144
|
+
readonly pending?: {
|
|
145
|
+
readonly fingerprint: string;
|
|
146
|
+
readonly sequence: number;
|
|
147
|
+
};
|
|
148
|
+
readonly revision: number;
|
|
149
|
+
readonly sessionId: string;
|
|
150
|
+
readonly status: LiveTimelineStatus;
|
|
151
|
+
readonly totalBytes: number;
|
|
152
|
+
}
|
|
153
|
+
export interface TimelinePageRequest {
|
|
154
|
+
readonly filter?: TimelineFilter;
|
|
155
|
+
readonly page?: number;
|
|
156
|
+
readonly pageSize?: number;
|
|
157
|
+
}
|
|
158
|
+
export interface TimelinePage {
|
|
159
|
+
readonly filter: TimelineFilter;
|
|
160
|
+
readonly items: readonly TimelineEntry[];
|
|
161
|
+
readonly page: number;
|
|
162
|
+
readonly pageSize: number;
|
|
163
|
+
readonly revision: number;
|
|
164
|
+
readonly status: LiveTimelineStatus;
|
|
165
|
+
readonly totalItems: number;
|
|
166
|
+
readonly totalPages: number;
|
|
167
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@devicerail/live-visualizer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Bounded live session timeline model for DeviceRail test events",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"device-automation",
|
|
8
|
+
"test-reporting",
|
|
9
|
+
"test-evidence",
|
|
10
|
+
"visualization"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"registry": "https://registry.npmjs.org/"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@devicerail/protocol": "0.1.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "26.1.1",
|
|
36
|
+
"typescript": "7.0.2"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/wangweiwei/device-rail.git",
|
|
41
|
+
"directory": "packages/live-visualizer"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/wangweiwei/device-rail#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/wangweiwei/device-rail/issues"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
49
|
+
"build": "node scripts/clean.mjs dist && tsc -p tsconfig.build.json && tsc -p tsconfig.package-exports.json && node scripts/check-package-exports.mjs",
|
|
50
|
+
"test": "node scripts/clean.mjs .test-dist && tsc -p tsconfig.test.json && node scripts/run-tests.mjs"
|
|
51
|
+
}
|
|
52
|
+
}
|