@mentra/cloud-client 3.3.0-dev.424 → 3.3.0-dev.425

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/cloud-client",
3
- "version": "3.3.0-dev.424",
3
+ "version": "3.3.0-dev.425",
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.424",
15
+ "@mentra/cloud-protocol": "3.3.0-dev.425",
16
16
  "tweetnacl": "^1.0.3"
17
17
  },
18
18
  "devDependencies": {
@@ -153,6 +153,11 @@ export class Core {
153
153
  reportId: string,
154
154
  images: ReportAttachmentInput[],
155
155
  ): Promise<AddReportArtifactsResult>;
156
+ addVideos(
157
+ reportId: string,
158
+ source: string,
159
+ videos: ReportAttachmentInput[],
160
+ ): Promise<AddReportArtifactsResult>;
156
161
  complete(reportId: string): Promise<{ status: ReportStatus }>;
157
162
  };
158
163
  readonly supportProfile: {
@@ -210,6 +215,7 @@ export class Core {
210
215
  submit: reports.submit.bind(reports),
211
216
  addLogs: reports.addLogs.bind(reports),
212
217
  addScreenshots: reports.addScreenshots.bind(reports),
218
+ addVideos: reports.addVideos.bind(reports),
213
219
  complete: reports.complete.bind(reports),
214
220
  };
215
221
  this.supportProfile = {
@@ -144,6 +144,44 @@ export class Reports {
144
144
  );
145
145
  }
146
146
 
147
+ /**
148
+ * Attach MP4 recordings to an existing report through the same artifact
149
+ * route. `source` is the capture source the caller declares (for example
150
+ * `phone` or `host`); the server stores it as given.
151
+ */
152
+ addVideos(
153
+ reportId: string,
154
+ source: string,
155
+ videos: ReportAttachmentInput[],
156
+ ): Promise<AddReportArtifactsResult> {
157
+ const form = new FormData();
158
+ form.append("type", "video");
159
+ form.append("source", source);
160
+ for (const video of videos) {
161
+ const filename = video.fileName || `video-${Date.now()}.mp4`;
162
+ const mimeType = video.mimeType || "video/mp4";
163
+ if (video.blob) {
164
+ // The part's declared type comes from the Blob, so make it the MP4 type.
165
+ const blob = video.blob.type === mimeType ? video.blob : new Blob([video.blob], { type: mimeType });
166
+ form.append("files", blob, filename);
167
+ continue;
168
+ }
169
+ if (!video.uri) {
170
+ throw new Error("report video requires either blob or uri");
171
+ }
172
+ form.append("files", {
173
+ uri: video.uri,
174
+ name: filename,
175
+ type: mimeType,
176
+ } as unknown as Blob);
177
+ }
178
+
179
+ return this.http.postForm<AddReportArtifactsResult>(
180
+ `${REPORTS_PATH}/${encodeURIComponent(reportId)}/artifacts`,
181
+ form,
182
+ );
183
+ }
184
+
147
185
  complete(reportId: string): Promise<{ status: ReportStatus }> {
148
186
  return this.http.post<{ status: ReportStatus }>(
149
187
  `${REPORTS_PATH}/${encodeURIComponent(reportId)}/complete`,