@bbearai/core 0.2.8 → 0.2.10
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/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +31 -9
- package/dist/index.mjs +31 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -270,6 +270,8 @@ interface SubmitFeedbackOptions {
|
|
|
270
270
|
feedback: TestFeedback;
|
|
271
271
|
/** Time taken to complete in seconds */
|
|
272
272
|
timeToCompleteSeconds?: number;
|
|
273
|
+
/** Screenshot URLs attached to the feedback */
|
|
274
|
+
screenshotUrls?: string[];
|
|
273
275
|
}
|
|
274
276
|
interface TesterInfo {
|
|
275
277
|
id: string;
|
|
@@ -720,7 +722,7 @@ declare class BugBearClient {
|
|
|
720
722
|
/**
|
|
721
723
|
* Upload a screenshot (web - uses File/Blob)
|
|
722
724
|
*/
|
|
723
|
-
uploadScreenshot(file: File | Blob, filename?: string): Promise<string | null>;
|
|
725
|
+
uploadScreenshot(file: File | Blob, filename?: string, bucket?: 'screenshots' | 'discussion-attachments'): Promise<string | null>;
|
|
724
726
|
/**
|
|
725
727
|
* Upload an image from a local file URI (React Native compatible).
|
|
726
728
|
* Fetches the URI as a blob and uploads to Supabase Storage.
|
package/dist/index.d.ts
CHANGED
|
@@ -270,6 +270,8 @@ interface SubmitFeedbackOptions {
|
|
|
270
270
|
feedback: TestFeedback;
|
|
271
271
|
/** Time taken to complete in seconds */
|
|
272
272
|
timeToCompleteSeconds?: number;
|
|
273
|
+
/** Screenshot URLs attached to the feedback */
|
|
274
|
+
screenshotUrls?: string[];
|
|
273
275
|
}
|
|
274
276
|
interface TesterInfo {
|
|
275
277
|
id: string;
|
|
@@ -720,7 +722,7 @@ declare class BugBearClient {
|
|
|
720
722
|
/**
|
|
721
723
|
* Upload a screenshot (web - uses File/Blob)
|
|
722
724
|
*/
|
|
723
|
-
uploadScreenshot(file: File | Blob, filename?: string): Promise<string | null>;
|
|
725
|
+
uploadScreenshot(file: File | Blob, filename?: string, bucket?: 'screenshots' | 'discussion-attachments'): Promise<string | null>;
|
|
724
726
|
/**
|
|
725
727
|
* Upload an image from a local file URI (React Native compatible).
|
|
726
728
|
* Fetches the URI as a blob and uploads to Supabase Storage.
|
package/dist/index.js
CHANGED
|
@@ -180,7 +180,7 @@ var BugBearClient = class {
|
|
|
180
180
|
console.error("BugBear: Failed to fetch assignments", error);
|
|
181
181
|
return [];
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
const mapped = (data || []).map((item) => ({
|
|
184
184
|
id: item.id,
|
|
185
185
|
status: item.status,
|
|
186
186
|
startedAt: item.started_at,
|
|
@@ -213,6 +213,12 @@ var BugBearClient = class {
|
|
|
213
213
|
} : void 0
|
|
214
214
|
}
|
|
215
215
|
}));
|
|
216
|
+
mapped.sort((a, b) => {
|
|
217
|
+
if (a.isVerification && !b.isVerification) return -1;
|
|
218
|
+
if (!a.isVerification && b.isVerification) return 1;
|
|
219
|
+
return 0;
|
|
220
|
+
});
|
|
221
|
+
return mapped;
|
|
216
222
|
} catch (err) {
|
|
217
223
|
console.error("BugBear: Error fetching assignments", err);
|
|
218
224
|
return [];
|
|
@@ -296,6 +302,11 @@ var BugBearClient = class {
|
|
|
296
302
|
try {
|
|
297
303
|
const { data: currentAssignment, error: fetchError } = await this.supabase.from("test_assignments").select("status, started_at").eq("id", assignmentId).single();
|
|
298
304
|
if (fetchError || !currentAssignment) {
|
|
305
|
+
console.error("BugBear: Assignment not found", {
|
|
306
|
+
message: fetchError?.message,
|
|
307
|
+
code: fetchError?.code,
|
|
308
|
+
assignmentId
|
|
309
|
+
});
|
|
299
310
|
return { success: false, error: "Assignment not found" };
|
|
300
311
|
}
|
|
301
312
|
const updateData = { status };
|
|
@@ -320,7 +331,15 @@ var BugBearClient = class {
|
|
|
320
331
|
}
|
|
321
332
|
const { error } = await this.supabase.from("test_assignments").update(updateData).eq("id", assignmentId);
|
|
322
333
|
if (error) {
|
|
323
|
-
console.error("BugBear: Failed to update assignment status",
|
|
334
|
+
console.error("BugBear: Failed to update assignment status", {
|
|
335
|
+
message: error.message,
|
|
336
|
+
details: error.details,
|
|
337
|
+
hint: error.hint,
|
|
338
|
+
code: error.code,
|
|
339
|
+
assignmentId,
|
|
340
|
+
status,
|
|
341
|
+
updateData
|
|
342
|
+
});
|
|
324
343
|
return { success: false, error: error.message };
|
|
325
344
|
}
|
|
326
345
|
if (options?.feedback && ["passed", "failed", "blocked"].includes(status)) {
|
|
@@ -382,7 +401,7 @@ var BugBearClient = class {
|
|
|
382
401
|
if (!testerInfo) {
|
|
383
402
|
return { success: false, error: "Not authenticated as tester" };
|
|
384
403
|
}
|
|
385
|
-
const { testCaseId, assignmentId, feedback, timeToCompleteSeconds } = options;
|
|
404
|
+
const { testCaseId, assignmentId, feedback, timeToCompleteSeconds, screenshotUrls } = options;
|
|
386
405
|
if (feedback.rating < 1 || feedback.rating > 5) {
|
|
387
406
|
return { success: false, error: "Rating must be between 1 and 5" };
|
|
388
407
|
}
|
|
@@ -402,7 +421,8 @@ var BugBearClient = class {
|
|
|
402
421
|
steps_unclear: feedback.stepsUnclear || false,
|
|
403
422
|
expected_result_unclear: feedback.expectedResultUnclear || false,
|
|
404
423
|
platform: this.getDeviceInfo().platform,
|
|
405
|
-
time_to_complete_seconds: timeToCompleteSeconds || null
|
|
424
|
+
time_to_complete_seconds: timeToCompleteSeconds || null,
|
|
425
|
+
screenshot_urls: screenshotUrls || []
|
|
406
426
|
});
|
|
407
427
|
if (feedbackError) {
|
|
408
428
|
console.error("BugBear: Failed to submit feedback", feedbackError);
|
|
@@ -717,19 +737,21 @@ var BugBearClient = class {
|
|
|
717
737
|
/**
|
|
718
738
|
* Upload a screenshot (web - uses File/Blob)
|
|
719
739
|
*/
|
|
720
|
-
async uploadScreenshot(file, filename) {
|
|
740
|
+
async uploadScreenshot(file, filename, bucket = "screenshots") {
|
|
721
741
|
try {
|
|
722
|
-
const
|
|
742
|
+
const contentType = file.type || "image/png";
|
|
743
|
+
const ext = contentType.includes("png") ? "png" : "jpg";
|
|
744
|
+
const name = filename || `screenshot-${Date.now()}.${ext}`;
|
|
723
745
|
const path = `${this.config.projectId}/${name}`;
|
|
724
|
-
const { error } = await this.supabase.storage.from(
|
|
725
|
-
contentType
|
|
746
|
+
const { error } = await this.supabase.storage.from(bucket).upload(path, file, {
|
|
747
|
+
contentType,
|
|
726
748
|
upsert: false
|
|
727
749
|
});
|
|
728
750
|
if (error) {
|
|
729
751
|
console.error("BugBear: Failed to upload screenshot", error);
|
|
730
752
|
return null;
|
|
731
753
|
}
|
|
732
|
-
const { data: { publicUrl } } = this.supabase.storage.from(
|
|
754
|
+
const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
|
|
733
755
|
return publicUrl;
|
|
734
756
|
} catch (err) {
|
|
735
757
|
console.error("BugBear: Error uploading screenshot", err);
|
package/dist/index.mjs
CHANGED
|
@@ -151,7 +151,7 @@ var BugBearClient = class {
|
|
|
151
151
|
console.error("BugBear: Failed to fetch assignments", error);
|
|
152
152
|
return [];
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
const mapped = (data || []).map((item) => ({
|
|
155
155
|
id: item.id,
|
|
156
156
|
status: item.status,
|
|
157
157
|
startedAt: item.started_at,
|
|
@@ -184,6 +184,12 @@ var BugBearClient = class {
|
|
|
184
184
|
} : void 0
|
|
185
185
|
}
|
|
186
186
|
}));
|
|
187
|
+
mapped.sort((a, b) => {
|
|
188
|
+
if (a.isVerification && !b.isVerification) return -1;
|
|
189
|
+
if (!a.isVerification && b.isVerification) return 1;
|
|
190
|
+
return 0;
|
|
191
|
+
});
|
|
192
|
+
return mapped;
|
|
187
193
|
} catch (err) {
|
|
188
194
|
console.error("BugBear: Error fetching assignments", err);
|
|
189
195
|
return [];
|
|
@@ -267,6 +273,11 @@ var BugBearClient = class {
|
|
|
267
273
|
try {
|
|
268
274
|
const { data: currentAssignment, error: fetchError } = await this.supabase.from("test_assignments").select("status, started_at").eq("id", assignmentId).single();
|
|
269
275
|
if (fetchError || !currentAssignment) {
|
|
276
|
+
console.error("BugBear: Assignment not found", {
|
|
277
|
+
message: fetchError?.message,
|
|
278
|
+
code: fetchError?.code,
|
|
279
|
+
assignmentId
|
|
280
|
+
});
|
|
270
281
|
return { success: false, error: "Assignment not found" };
|
|
271
282
|
}
|
|
272
283
|
const updateData = { status };
|
|
@@ -291,7 +302,15 @@ var BugBearClient = class {
|
|
|
291
302
|
}
|
|
292
303
|
const { error } = await this.supabase.from("test_assignments").update(updateData).eq("id", assignmentId);
|
|
293
304
|
if (error) {
|
|
294
|
-
console.error("BugBear: Failed to update assignment status",
|
|
305
|
+
console.error("BugBear: Failed to update assignment status", {
|
|
306
|
+
message: error.message,
|
|
307
|
+
details: error.details,
|
|
308
|
+
hint: error.hint,
|
|
309
|
+
code: error.code,
|
|
310
|
+
assignmentId,
|
|
311
|
+
status,
|
|
312
|
+
updateData
|
|
313
|
+
});
|
|
295
314
|
return { success: false, error: error.message };
|
|
296
315
|
}
|
|
297
316
|
if (options?.feedback && ["passed", "failed", "blocked"].includes(status)) {
|
|
@@ -353,7 +372,7 @@ var BugBearClient = class {
|
|
|
353
372
|
if (!testerInfo) {
|
|
354
373
|
return { success: false, error: "Not authenticated as tester" };
|
|
355
374
|
}
|
|
356
|
-
const { testCaseId, assignmentId, feedback, timeToCompleteSeconds } = options;
|
|
375
|
+
const { testCaseId, assignmentId, feedback, timeToCompleteSeconds, screenshotUrls } = options;
|
|
357
376
|
if (feedback.rating < 1 || feedback.rating > 5) {
|
|
358
377
|
return { success: false, error: "Rating must be between 1 and 5" };
|
|
359
378
|
}
|
|
@@ -373,7 +392,8 @@ var BugBearClient = class {
|
|
|
373
392
|
steps_unclear: feedback.stepsUnclear || false,
|
|
374
393
|
expected_result_unclear: feedback.expectedResultUnclear || false,
|
|
375
394
|
platform: this.getDeviceInfo().platform,
|
|
376
|
-
time_to_complete_seconds: timeToCompleteSeconds || null
|
|
395
|
+
time_to_complete_seconds: timeToCompleteSeconds || null,
|
|
396
|
+
screenshot_urls: screenshotUrls || []
|
|
377
397
|
});
|
|
378
398
|
if (feedbackError) {
|
|
379
399
|
console.error("BugBear: Failed to submit feedback", feedbackError);
|
|
@@ -688,19 +708,21 @@ var BugBearClient = class {
|
|
|
688
708
|
/**
|
|
689
709
|
* Upload a screenshot (web - uses File/Blob)
|
|
690
710
|
*/
|
|
691
|
-
async uploadScreenshot(file, filename) {
|
|
711
|
+
async uploadScreenshot(file, filename, bucket = "screenshots") {
|
|
692
712
|
try {
|
|
693
|
-
const
|
|
713
|
+
const contentType = file.type || "image/png";
|
|
714
|
+
const ext = contentType.includes("png") ? "png" : "jpg";
|
|
715
|
+
const name = filename || `screenshot-${Date.now()}.${ext}`;
|
|
694
716
|
const path = `${this.config.projectId}/${name}`;
|
|
695
|
-
const { error } = await this.supabase.storage.from(
|
|
696
|
-
contentType
|
|
717
|
+
const { error } = await this.supabase.storage.from(bucket).upload(path, file, {
|
|
718
|
+
contentType,
|
|
697
719
|
upsert: false
|
|
698
720
|
});
|
|
699
721
|
if (error) {
|
|
700
722
|
console.error("BugBear: Failed to upload screenshot", error);
|
|
701
723
|
return null;
|
|
702
724
|
}
|
|
703
|
-
const { data: { publicUrl } } = this.supabase.storage.from(
|
|
725
|
+
const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
|
|
704
726
|
return publicUrl;
|
|
705
727
|
} catch (err) {
|
|
706
728
|
console.error("BugBear: Error uploading screenshot", err);
|