@bbearai/core 0.9.4 → 0.9.6

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 CHANGED
@@ -1389,8 +1389,9 @@ declare class BugBearClient {
1389
1389
  /**
1390
1390
  * Get issue counts for the tester (Open, Done, Reopened)
1391
1391
  * Used by the widget HomeScreen cards
1392
+ * @param mineOnly - If true (default), only counts the tester's own reports. If false, counts all project reports.
1392
1393
  */
1393
- getIssueCounts(): Promise<{
1394
+ getIssueCounts(mineOnly?: boolean): Promise<{
1394
1395
  open: number;
1395
1396
  done: number;
1396
1397
  reopened: number;
@@ -1399,8 +1400,9 @@ declare class BugBearClient {
1399
1400
  * Get issues for the tester by category.
1400
1401
  * Returns enriched data: done issues include verification proof,
1401
1402
  * reopened issues include original bug context.
1403
+ * @param mineOnly - If true (default), only returns the tester's own reports. If false, returns all project reports.
1402
1404
  */
1403
- getIssues(category: 'open' | 'done' | 'reopened'): Promise<TesterIssue[]>;
1405
+ getIssues(category: 'open' | 'done' | 'reopened', mineOnly?: boolean): Promise<TesterIssue[]>;
1404
1406
  /**
1405
1407
  * Reopen a done issue that the tester believes isn't actually fixed.
1406
1408
  * Transitions the report from a done status back to 'confirmed'.
package/dist/index.d.ts CHANGED
@@ -1389,8 +1389,9 @@ declare class BugBearClient {
1389
1389
  /**
1390
1390
  * Get issue counts for the tester (Open, Done, Reopened)
1391
1391
  * Used by the widget HomeScreen cards
1392
+ * @param mineOnly - If true (default), only counts the tester's own reports. If false, counts all project reports.
1392
1393
  */
1393
- getIssueCounts(): Promise<{
1394
+ getIssueCounts(mineOnly?: boolean): Promise<{
1394
1395
  open: number;
1395
1396
  done: number;
1396
1397
  reopened: number;
@@ -1399,8 +1400,9 @@ declare class BugBearClient {
1399
1400
  * Get issues for the tester by category.
1400
1401
  * Returns enriched data: done issues include verification proof,
1401
1402
  * reopened issues include original bug context.
1403
+ * @param mineOnly - If true (default), only returns the tester's own reports. If false, returns all project reports.
1402
1404
  */
1403
- getIssues(category: 'open' | 'done' | 'reopened'): Promise<TesterIssue[]>;
1405
+ getIssues(category: 'open' | 'done' | 'reopened', mineOnly?: boolean): Promise<TesterIssue[]>;
1404
1406
  /**
1405
1407
  * Reopen a done issue that the tester believes isn't actually fixed.
1406
1408
  * Transitions the report from a done status back to 'confirmed'.
package/dist/index.js CHANGED
@@ -1200,12 +1200,12 @@ var BugBearClient = class {
1200
1200
  return { success: true };
1201
1201
  });
1202
1202
  this._queue.registerHandler("message", async (payload) => {
1203
- const { error } = await this.supabase.from("discussion_messages").insert(payload);
1203
+ const { error } = await this.supabase.from("discussion_messages").insert(payload).select("id").single();
1204
1204
  if (error) return { success: false, error: error.message };
1205
1205
  return { success: true };
1206
1206
  });
1207
1207
  this._queue.registerHandler("feedback", async (payload) => {
1208
- const { error } = await this.supabase.from("test_feedback").insert(payload);
1208
+ const { error } = await this.supabase.from("test_feedback").insert(payload).select("id").single();
1209
1209
  if (error) return { success: false, error: error.message };
1210
1210
  return { success: true };
1211
1211
  });
@@ -1229,6 +1229,8 @@ var BugBearClient = class {
1229
1229
  subscribeToChanges(callbacks) {
1230
1230
  this.unsubscribeAll();
1231
1231
  const projectId = this.config.projectId;
1232
+ if (!projectId) return () => {
1233
+ };
1232
1234
  const debounce = (fn, ms = 500) => {
1233
1235
  let timer;
1234
1236
  return () => {
@@ -1352,7 +1354,7 @@ var BugBearClient = class {
1352
1354
  return { success: false, error: validationError };
1353
1355
  }
1354
1356
  const userInfo = await this.getCurrentUserInfo();
1355
- const rateLimitId = userInfo?.email || this.config.projectId;
1357
+ const rateLimitId = userInfo?.email || this.config.projectId || "unknown";
1356
1358
  const rateLimit = await this.checkRateLimit(rateLimitId, "report_submit");
1357
1359
  if (!rateLimit.allowed) {
1358
1360
  return { success: false, error: rateLimit.error };
@@ -2037,14 +2039,16 @@ var BugBearClient = class {
2037
2039
  /**
2038
2040
  * Get issue counts for the tester (Open, Done, Reopened)
2039
2041
  * Used by the widget HomeScreen cards
2042
+ * @param mineOnly - If true (default), only counts the tester's own reports. If false, counts all project reports.
2040
2043
  */
2041
- async getIssueCounts() {
2044
+ async getIssueCounts(mineOnly = true) {
2042
2045
  try {
2043
2046
  const testerInfo = await this.getTesterInfo();
2044
2047
  if (!testerInfo) return { open: 0, done: 0, reopened: 0 };
2045
2048
  const { data, error } = await this.supabase.rpc("get_tester_issue_counts", {
2046
2049
  p_project_id: this.config.projectId,
2047
- p_tester_id: testerInfo.id
2050
+ p_tester_id: testerInfo.id,
2051
+ p_mine_only: mineOnly
2048
2052
  });
2049
2053
  if (error) {
2050
2054
  console.error("BugBear: Failed to fetch issue counts", formatPgError(error));
@@ -2064,15 +2068,17 @@ var BugBearClient = class {
2064
2068
  * Get issues for the tester by category.
2065
2069
  * Returns enriched data: done issues include verification proof,
2066
2070
  * reopened issues include original bug context.
2071
+ * @param mineOnly - If true (default), only returns the tester's own reports. If false, returns all project reports.
2067
2072
  */
2068
- async getIssues(category) {
2073
+ async getIssues(category, mineOnly = true) {
2069
2074
  try {
2070
2075
  const testerInfo = await this.getTesterInfo();
2071
2076
  if (!testerInfo) return [];
2072
2077
  const { data, error } = await this.supabase.rpc("get_tester_issues", {
2073
2078
  p_project_id: this.config.projectId,
2074
2079
  p_tester_id: testerInfo.id,
2075
- p_category: category
2080
+ p_category: category,
2081
+ p_mine_only: mineOnly
2076
2082
  });
2077
2083
  if (error) {
2078
2084
  console.error("BugBear: Failed to fetch issues", formatPgError(error));
package/dist/index.mjs CHANGED
@@ -1154,12 +1154,12 @@ var BugBearClient = class {
1154
1154
  return { success: true };
1155
1155
  });
1156
1156
  this._queue.registerHandler("message", async (payload) => {
1157
- const { error } = await this.supabase.from("discussion_messages").insert(payload);
1157
+ const { error } = await this.supabase.from("discussion_messages").insert(payload).select("id").single();
1158
1158
  if (error) return { success: false, error: error.message };
1159
1159
  return { success: true };
1160
1160
  });
1161
1161
  this._queue.registerHandler("feedback", async (payload) => {
1162
- const { error } = await this.supabase.from("test_feedback").insert(payload);
1162
+ const { error } = await this.supabase.from("test_feedback").insert(payload).select("id").single();
1163
1163
  if (error) return { success: false, error: error.message };
1164
1164
  return { success: true };
1165
1165
  });
@@ -1183,6 +1183,8 @@ var BugBearClient = class {
1183
1183
  subscribeToChanges(callbacks) {
1184
1184
  this.unsubscribeAll();
1185
1185
  const projectId = this.config.projectId;
1186
+ if (!projectId) return () => {
1187
+ };
1186
1188
  const debounce = (fn, ms = 500) => {
1187
1189
  let timer;
1188
1190
  return () => {
@@ -1306,7 +1308,7 @@ var BugBearClient = class {
1306
1308
  return { success: false, error: validationError };
1307
1309
  }
1308
1310
  const userInfo = await this.getCurrentUserInfo();
1309
- const rateLimitId = userInfo?.email || this.config.projectId;
1311
+ const rateLimitId = userInfo?.email || this.config.projectId || "unknown";
1310
1312
  const rateLimit = await this.checkRateLimit(rateLimitId, "report_submit");
1311
1313
  if (!rateLimit.allowed) {
1312
1314
  return { success: false, error: rateLimit.error };
@@ -1991,14 +1993,16 @@ var BugBearClient = class {
1991
1993
  /**
1992
1994
  * Get issue counts for the tester (Open, Done, Reopened)
1993
1995
  * Used by the widget HomeScreen cards
1996
+ * @param mineOnly - If true (default), only counts the tester's own reports. If false, counts all project reports.
1994
1997
  */
1995
- async getIssueCounts() {
1998
+ async getIssueCounts(mineOnly = true) {
1996
1999
  try {
1997
2000
  const testerInfo = await this.getTesterInfo();
1998
2001
  if (!testerInfo) return { open: 0, done: 0, reopened: 0 };
1999
2002
  const { data, error } = await this.supabase.rpc("get_tester_issue_counts", {
2000
2003
  p_project_id: this.config.projectId,
2001
- p_tester_id: testerInfo.id
2004
+ p_tester_id: testerInfo.id,
2005
+ p_mine_only: mineOnly
2002
2006
  });
2003
2007
  if (error) {
2004
2008
  console.error("BugBear: Failed to fetch issue counts", formatPgError(error));
@@ -2018,15 +2022,17 @@ var BugBearClient = class {
2018
2022
  * Get issues for the tester by category.
2019
2023
  * Returns enriched data: done issues include verification proof,
2020
2024
  * reopened issues include original bug context.
2025
+ * @param mineOnly - If true (default), only returns the tester's own reports. If false, returns all project reports.
2021
2026
  */
2022
- async getIssues(category) {
2027
+ async getIssues(category, mineOnly = true) {
2023
2028
  try {
2024
2029
  const testerInfo = await this.getTesterInfo();
2025
2030
  if (!testerInfo) return [];
2026
2031
  const { data, error } = await this.supabase.rpc("get_tester_issues", {
2027
2032
  p_project_id: this.config.projectId,
2028
2033
  p_tester_id: testerInfo.id,
2029
- p_category: category
2034
+ p_category: category,
2035
+ p_mine_only: mineOnly
2030
2036
  });
2031
2037
  if (error) {
2032
2038
  console.error("BugBear: Failed to fetch issues", formatPgError(error));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbearai/core",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Core utilities and types for BugBear QA platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",