@mentra/cloud-client 3.3.0-dev.837 → 3.3.0-dev.839
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 +2 -2
- package/src/index.ts +1 -0
- package/src/modules/core/core.ts +3 -0
- package/src/modules/core/reports.ts +33 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/cloud-client",
|
|
3
|
-
"version": "3.3.0-dev.
|
|
3
|
+
"version": "3.3.0-dev.839",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"test": "bun test"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@mentra/cloud-protocol": "3.3.0-dev.
|
|
15
|
+
"@mentra/cloud-protocol": "3.3.0-dev.839",
|
|
16
16
|
"tweetnacl": "^1.0.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
package/src/index.ts
CHANGED
package/src/modules/core/core.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type { HttpClient } from "../../http";
|
|
|
20
20
|
import {
|
|
21
21
|
Reports,
|
|
22
22
|
type AddReportArtifactsResult,
|
|
23
|
+
type AddReportLogsOptions,
|
|
23
24
|
type ReportAttachmentInput,
|
|
24
25
|
type ReportLogEntry,
|
|
25
26
|
type ReportLogCollectionUpdate,
|
|
@@ -37,6 +38,7 @@ import {
|
|
|
37
38
|
|
|
38
39
|
export type {
|
|
39
40
|
AddReportArtifactsResult,
|
|
41
|
+
AddReportLogsOptions,
|
|
40
42
|
ReportAttachmentInput,
|
|
41
43
|
ReportContext,
|
|
42
44
|
ReportDetails,
|
|
@@ -161,6 +163,7 @@ export class Core {
|
|
|
161
163
|
reportId: string,
|
|
162
164
|
source: string,
|
|
163
165
|
entries: ReportLogEntry[],
|
|
166
|
+
options?: AddReportLogsOptions,
|
|
164
167
|
): Promise<AddReportArtifactsResult>;
|
|
165
168
|
addScreenshots(
|
|
166
169
|
reportId: string,
|
|
@@ -62,29 +62,43 @@ export interface ReportContext extends Record<string, unknown> {
|
|
|
62
62
|
settings?: Record<string, unknown>;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
interface IncidentKeyInput {
|
|
66
|
+
/**
|
|
67
|
+
* Identity of one bug or automatic event (`^[A-Za-z0-9._:-]{1,128}$`).
|
|
68
|
+
* Resubmitting the same key returns the caller's existing report. A Cloud
|
|
69
|
+
* that predates the field ignores it and creates a new report.
|
|
70
|
+
*/
|
|
71
|
+
incidentKey?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type SubmitReportInput = (
|
|
75
|
+
| ({
|
|
67
76
|
kind: "bug";
|
|
68
77
|
trigger: ReportTrigger;
|
|
69
78
|
report: ReportDetails;
|
|
70
79
|
context: ReportContext;
|
|
71
|
-
}
|
|
72
|
-
| {
|
|
80
|
+
} & IncidentKeyInput)
|
|
81
|
+
| ({
|
|
73
82
|
kind: "automatic";
|
|
74
83
|
automationCorrelation?: ReportAutomationCorrelation;
|
|
75
84
|
trigger: Extract<ReportTrigger, { type: "automatic" }>;
|
|
76
85
|
report: ReportDetails;
|
|
77
86
|
context: ReportContext;
|
|
78
|
-
}
|
|
87
|
+
} & IncidentKeyInput)
|
|
79
88
|
| {
|
|
80
89
|
kind: "feedback";
|
|
90
|
+
/** Feedback notifies at creation and cannot be safely deduplicated by key. */
|
|
91
|
+
incidentKey?: never;
|
|
81
92
|
feedback: string | Record<string, unknown>;
|
|
82
93
|
context: ReportContext;
|
|
83
|
-
}
|
|
94
|
+
}
|
|
95
|
+
);
|
|
84
96
|
|
|
85
97
|
export interface SubmitReportResult {
|
|
86
98
|
reportId: string;
|
|
87
99
|
status: ReportStatus;
|
|
100
|
+
/** True only when Cloud returned an existing report for `incidentKey`. */
|
|
101
|
+
deduplicated?: true;
|
|
88
102
|
}
|
|
89
103
|
|
|
90
104
|
export interface ReportLogEntry {
|
|
@@ -103,6 +117,17 @@ export interface ReportAttachmentInput {
|
|
|
103
117
|
|
|
104
118
|
export interface AddReportArtifactsResult {
|
|
105
119
|
stored: number;
|
|
120
|
+
/** Returned for a log upload sent with a `retryKey`. */
|
|
121
|
+
receipt?: { artifactId: string; sha256: string; sizeBytes: number };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface AddReportLogsOptions {
|
|
125
|
+
/**
|
|
126
|
+
* Artifact identity (`^[A-Za-z0-9._:-]{1,128}$`). Repeating it with identical
|
|
127
|
+
* entries is idempotent; different entries under the same key fail with
|
|
128
|
+
* HTTP 409. A Cloud that predates the field ignores it and stores a new artifact.
|
|
129
|
+
*/
|
|
130
|
+
retryKey?: string;
|
|
106
131
|
}
|
|
107
132
|
|
|
108
133
|
export interface ReportsDeps {
|
|
@@ -167,6 +192,7 @@ export class Reports {
|
|
|
167
192
|
reportId: string,
|
|
168
193
|
source: string,
|
|
169
194
|
entries: ReportLogEntry[],
|
|
195
|
+
options: AddReportLogsOptions = {},
|
|
170
196
|
): Promise<AddReportArtifactsResult> {
|
|
171
197
|
return await this.http.post<AddReportArtifactsResult>(
|
|
172
198
|
`${REPORTS_PATH}/${encodeURIComponent(reportId)}/artifacts`,
|
|
@@ -174,6 +200,7 @@ export class Reports {
|
|
|
174
200
|
type: "logs",
|
|
175
201
|
source,
|
|
176
202
|
entries,
|
|
203
|
+
...(options.retryKey !== undefined ? { retryKey: options.retryKey } : {}),
|
|
177
204
|
},
|
|
178
205
|
);
|
|
179
206
|
}
|