@bbearai/core 0.4.4 → 0.4.5
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 +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +50 -7
- package/dist/index.mjs +47 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
type ReportType = 'bug' | 'feedback' | 'suggestion' | 'test_pass' | 'test_fail';
|
|
5
5
|
type Severity = 'critical' | 'high' | 'medium' | 'low';
|
|
6
|
-
|
|
6
|
+
/** Valid bug categories - single source of truth */
|
|
7
|
+
declare const BUG_CATEGORIES: readonly ["ui_ux", "functional", "crash", "security", "other"];
|
|
8
|
+
/** Bug category type derived from BUG_CATEGORIES */
|
|
9
|
+
type BugCategory = typeof BUG_CATEGORIES[number];
|
|
10
|
+
/** Type guard to check if a string is a valid BugCategory */
|
|
11
|
+
declare function isBugCategory(value: unknown): value is BugCategory;
|
|
7
12
|
type ReportStatus = 'new' | 'triaging' | 'confirmed' | 'in_progress' | 'fixed' | 'ready_to_test' | 'verified' | 'resolved' | 'reviewed' | 'closed' | 'wont_fix' | 'duplicate';
|
|
8
13
|
interface AppContext {
|
|
9
14
|
/** Current route/screen path */
|
|
@@ -1068,4 +1073,4 @@ declare function captureError(error: Error, errorInfo?: {
|
|
|
1068
1073
|
componentStack?: string;
|
|
1069
1074
|
};
|
|
1070
1075
|
|
|
1071
|
-
export { type AddFindingOptions, type AppContext, BugBearClient, type BugBearConfig, type BugBearReport, type BugBearTheme, type BugCategory, type ChecklistItem, type ChecklistResult, type ConsoleLogEntry, type CoverageGap, type CoverageMatrixCell, type CoverageMatrixRow, type DeployChecklist, type DeviceInfo, type EndSessionOptions, type EnhancedBugContext, type FindingSeverity, type FindingType, type HostUserInfo, type IssueCategory, type IssueCounts, type MessageSenderType, type NetworkRequest, type PriorityFactors, type ProjectRole, type QAFinding, type QAHealthMetrics, type QAHealthScore, type QASession, type QASessionStatus, type QATrack, type RegressionEvent, type ReportStatus, type ReportType, type RoutePriority, type RouteTestStats, type RubricMode, type RubricResult, type Severity, type SkipReason, type StartSessionOptions, type SubmitFeedbackOptions, type TestAssignment, type TestFeedback, type TestGroup, type TestResult, type TestStep, type TestTemplate, type TesterInfo, type TesterIssue, type TesterMessage, type TesterProfileUpdate, type TesterThread, type ThreadPriority, type ThreadType, captureError, contextCapture, createBugBear };
|
|
1076
|
+
export { type AddFindingOptions, type AppContext, BUG_CATEGORIES, BugBearClient, type BugBearConfig, type BugBearReport, type BugBearTheme, type BugCategory, type ChecklistItem, type ChecklistResult, type ConsoleLogEntry, type CoverageGap, type CoverageMatrixCell, type CoverageMatrixRow, type DeployChecklist, type DeviceInfo, type EndSessionOptions, type EnhancedBugContext, type FindingSeverity, type FindingType, type HostUserInfo, type IssueCategory, type IssueCounts, type MessageSenderType, type NetworkRequest, type PriorityFactors, type ProjectRole, type QAFinding, type QAHealthMetrics, type QAHealthScore, type QASession, type QASessionStatus, type QATrack, type RegressionEvent, type ReportStatus, type ReportType, type RoutePriority, type RouteTestStats, type RubricMode, type RubricResult, type Severity, type SkipReason, type StartSessionOptions, type SubmitFeedbackOptions, type TestAssignment, type TestFeedback, type TestGroup, type TestResult, type TestStep, type TestTemplate, type TesterInfo, type TesterIssue, type TesterMessage, type TesterProfileUpdate, type TesterThread, type ThreadPriority, type ThreadType, captureError, contextCapture, createBugBear, isBugCategory };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
type ReportType = 'bug' | 'feedback' | 'suggestion' | 'test_pass' | 'test_fail';
|
|
5
5
|
type Severity = 'critical' | 'high' | 'medium' | 'low';
|
|
6
|
-
|
|
6
|
+
/** Valid bug categories - single source of truth */
|
|
7
|
+
declare const BUG_CATEGORIES: readonly ["ui_ux", "functional", "crash", "security", "other"];
|
|
8
|
+
/** Bug category type derived from BUG_CATEGORIES */
|
|
9
|
+
type BugCategory = typeof BUG_CATEGORIES[number];
|
|
10
|
+
/** Type guard to check if a string is a valid BugCategory */
|
|
11
|
+
declare function isBugCategory(value: unknown): value is BugCategory;
|
|
7
12
|
type ReportStatus = 'new' | 'triaging' | 'confirmed' | 'in_progress' | 'fixed' | 'ready_to_test' | 'verified' | 'resolved' | 'reviewed' | 'closed' | 'wont_fix' | 'duplicate';
|
|
8
13
|
interface AppContext {
|
|
9
14
|
/** Current route/screen path */
|
|
@@ -1068,4 +1073,4 @@ declare function captureError(error: Error, errorInfo?: {
|
|
|
1068
1073
|
componentStack?: string;
|
|
1069
1074
|
};
|
|
1070
1075
|
|
|
1071
|
-
export { type AddFindingOptions, type AppContext, BugBearClient, type BugBearConfig, type BugBearReport, type BugBearTheme, type BugCategory, type ChecklistItem, type ChecklistResult, type ConsoleLogEntry, type CoverageGap, type CoverageMatrixCell, type CoverageMatrixRow, type DeployChecklist, type DeviceInfo, type EndSessionOptions, type EnhancedBugContext, type FindingSeverity, type FindingType, type HostUserInfo, type IssueCategory, type IssueCounts, type MessageSenderType, type NetworkRequest, type PriorityFactors, type ProjectRole, type QAFinding, type QAHealthMetrics, type QAHealthScore, type QASession, type QASessionStatus, type QATrack, type RegressionEvent, type ReportStatus, type ReportType, type RoutePriority, type RouteTestStats, type RubricMode, type RubricResult, type Severity, type SkipReason, type StartSessionOptions, type SubmitFeedbackOptions, type TestAssignment, type TestFeedback, type TestGroup, type TestResult, type TestStep, type TestTemplate, type TesterInfo, type TesterIssue, type TesterMessage, type TesterProfileUpdate, type TesterThread, type ThreadPriority, type ThreadType, captureError, contextCapture, createBugBear };
|
|
1076
|
+
export { type AddFindingOptions, type AppContext, BUG_CATEGORIES, BugBearClient, type BugBearConfig, type BugBearReport, type BugBearTheme, type BugCategory, type ChecklistItem, type ChecklistResult, type ConsoleLogEntry, type CoverageGap, type CoverageMatrixCell, type CoverageMatrixRow, type DeployChecklist, type DeviceInfo, type EndSessionOptions, type EnhancedBugContext, type FindingSeverity, type FindingType, type HostUserInfo, type IssueCategory, type IssueCounts, type MessageSenderType, type NetworkRequest, type PriorityFactors, type ProjectRole, type QAFinding, type QAHealthMetrics, type QAHealthScore, type QASession, type QASessionStatus, type QATrack, type RegressionEvent, type ReportStatus, type ReportType, type RoutePriority, type RouteTestStats, type RubricMode, type RubricResult, type Severity, type SkipReason, type StartSessionOptions, type SubmitFeedbackOptions, type TestAssignment, type TestFeedback, type TestGroup, type TestResult, type TestStep, type TestTemplate, type TesterInfo, type TesterIssue, type TesterMessage, type TesterProfileUpdate, type TesterThread, type ThreadPriority, type ThreadType, captureError, contextCapture, createBugBear, isBugCategory };
|
package/dist/index.js
CHANGED
|
@@ -20,13 +20,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
BUG_CATEGORIES: () => BUG_CATEGORIES,
|
|
23
24
|
BugBearClient: () => BugBearClient,
|
|
24
25
|
captureError: () => captureError,
|
|
25
26
|
contextCapture: () => contextCapture,
|
|
26
|
-
createBugBear: () => createBugBear
|
|
27
|
+
createBugBear: () => createBugBear,
|
|
28
|
+
isBugCategory: () => isBugCategory
|
|
27
29
|
});
|
|
28
30
|
module.exports = __toCommonJS(index_exports);
|
|
29
31
|
|
|
32
|
+
// src/types.ts
|
|
33
|
+
var BUG_CATEGORIES = ["ui_ux", "functional", "crash", "security", "other"];
|
|
34
|
+
function isBugCategory(value) {
|
|
35
|
+
return typeof value === "string" && BUG_CATEGORIES.includes(value);
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
// src/client.ts
|
|
31
39
|
var import_supabase_js = require("@supabase/supabase-js");
|
|
32
40
|
|
|
@@ -975,9 +983,8 @@ var BugBearClient = class {
|
|
|
975
983
|
if (report.severity && !validSeverities.includes(report.severity)) {
|
|
976
984
|
return `Invalid severity: ${report.severity}. Must be one of: ${validSeverities.join(", ")}`;
|
|
977
985
|
}
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
return `Invalid category: ${report.category}. Must be one of: ${validCategories.join(", ")}`;
|
|
986
|
+
if (report.category && !BUG_CATEGORIES.includes(report.category)) {
|
|
987
|
+
return `Invalid category: ${report.category}. Must be one of: ${BUG_CATEGORIES.join(", ")}`;
|
|
981
988
|
}
|
|
982
989
|
if (report.title && report.title.length > 500) {
|
|
983
990
|
return "Title must be 500 characters or less";
|
|
@@ -1051,6 +1058,10 @@ var BugBearClient = class {
|
|
|
1051
1058
|
});
|
|
1052
1059
|
if (error) {
|
|
1053
1060
|
console.warn("BugBear: Rate limit check failed, allowing request", error.message);
|
|
1061
|
+
this.config.onError?.(new Error(`Rate limit check failed: ${error.message}`), {
|
|
1062
|
+
projectId: this.config.projectId,
|
|
1063
|
+
context: "rate_limit_check_failed_open"
|
|
1064
|
+
});
|
|
1054
1065
|
return { allowed: true };
|
|
1055
1066
|
}
|
|
1056
1067
|
if (!data.allowed) {
|
|
@@ -1067,7 +1078,12 @@ var BugBearClient = class {
|
|
|
1067
1078
|
resetAt: data.reset_at
|
|
1068
1079
|
};
|
|
1069
1080
|
} catch (err) {
|
|
1081
|
+
const message = err instanceof Error ? err.message : "Unknown rate limit error";
|
|
1070
1082
|
console.warn("BugBear: Rate limit check error", err);
|
|
1083
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), {
|
|
1084
|
+
projectId: this.config.projectId,
|
|
1085
|
+
context: "rate_limit_check_failed_open"
|
|
1086
|
+
});
|
|
1071
1087
|
return { allowed: true };
|
|
1072
1088
|
}
|
|
1073
1089
|
}
|
|
@@ -1131,6 +1147,9 @@ var BugBearClient = class {
|
|
|
1131
1147
|
}
|
|
1132
1148
|
return data ?? true;
|
|
1133
1149
|
} catch (err) {
|
|
1150
|
+
const message = err instanceof Error ? err.message : "Unknown error checking QA status";
|
|
1151
|
+
console.error("BugBear: Error checking QA status", err);
|
|
1152
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), { projectId: this.config.projectId });
|
|
1134
1153
|
return true;
|
|
1135
1154
|
}
|
|
1136
1155
|
}
|
|
@@ -1159,13 +1178,24 @@ var BugBearClient = class {
|
|
|
1159
1178
|
upsert: false
|
|
1160
1179
|
});
|
|
1161
1180
|
if (error) {
|
|
1162
|
-
|
|
1181
|
+
const formattedError = formatPgError(error);
|
|
1182
|
+
const errorMessage = formattedError.message || "Failed to upload screenshot";
|
|
1183
|
+
console.error("BugBear: Failed to upload screenshot", formattedError);
|
|
1184
|
+
this.config.onError?.(new Error(errorMessage), {
|
|
1185
|
+
projectId: this.config.projectId,
|
|
1186
|
+
context: "screenshot_upload_failed"
|
|
1187
|
+
});
|
|
1163
1188
|
return null;
|
|
1164
1189
|
}
|
|
1165
1190
|
const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
|
|
1166
1191
|
return publicUrl;
|
|
1167
1192
|
} catch (err) {
|
|
1193
|
+
const message = err instanceof Error ? err.message : "Unknown error uploading screenshot";
|
|
1168
1194
|
console.error("BugBear: Error uploading screenshot", err);
|
|
1195
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), {
|
|
1196
|
+
projectId: this.config.projectId,
|
|
1197
|
+
context: "screenshot_upload_failed"
|
|
1198
|
+
});
|
|
1169
1199
|
return null;
|
|
1170
1200
|
}
|
|
1171
1201
|
}
|
|
@@ -1190,13 +1220,24 @@ var BugBearClient = class {
|
|
|
1190
1220
|
upsert: false
|
|
1191
1221
|
});
|
|
1192
1222
|
if (error) {
|
|
1193
|
-
|
|
1223
|
+
const formattedError = formatPgError(error);
|
|
1224
|
+
const errorMessage = formattedError.message || "Failed to upload image";
|
|
1225
|
+
console.error("BugBear: Failed to upload image from URI", formattedError);
|
|
1226
|
+
this.config.onError?.(new Error(errorMessage), {
|
|
1227
|
+
projectId: this.config.projectId,
|
|
1228
|
+
context: "image_upload_failed"
|
|
1229
|
+
});
|
|
1194
1230
|
return null;
|
|
1195
1231
|
}
|
|
1196
1232
|
const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
|
|
1197
1233
|
return publicUrl;
|
|
1198
1234
|
} catch (err) {
|
|
1235
|
+
const message = err instanceof Error ? err.message : "Unknown error uploading image";
|
|
1199
1236
|
console.error("BugBear: Error uploading image from URI", err);
|
|
1237
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), {
|
|
1238
|
+
projectId: this.config.projectId,
|
|
1239
|
+
context: "image_upload_failed"
|
|
1240
|
+
});
|
|
1200
1241
|
return null;
|
|
1201
1242
|
}
|
|
1202
1243
|
}
|
|
@@ -1727,8 +1768,10 @@ function createBugBear(config) {
|
|
|
1727
1768
|
}
|
|
1728
1769
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1729
1770
|
0 && (module.exports = {
|
|
1771
|
+
BUG_CATEGORIES,
|
|
1730
1772
|
BugBearClient,
|
|
1731
1773
|
captureError,
|
|
1732
1774
|
contextCapture,
|
|
1733
|
-
createBugBear
|
|
1775
|
+
createBugBear,
|
|
1776
|
+
isBugCategory
|
|
1734
1777
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// src/types.ts
|
|
2
|
+
var BUG_CATEGORIES = ["ui_ux", "functional", "crash", "security", "other"];
|
|
3
|
+
function isBugCategory(value) {
|
|
4
|
+
return typeof value === "string" && BUG_CATEGORIES.includes(value);
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
// src/client.ts
|
|
2
8
|
import { createClient } from "@supabase/supabase-js";
|
|
3
9
|
|
|
@@ -946,9 +952,8 @@ var BugBearClient = class {
|
|
|
946
952
|
if (report.severity && !validSeverities.includes(report.severity)) {
|
|
947
953
|
return `Invalid severity: ${report.severity}. Must be one of: ${validSeverities.join(", ")}`;
|
|
948
954
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
return `Invalid category: ${report.category}. Must be one of: ${validCategories.join(", ")}`;
|
|
955
|
+
if (report.category && !BUG_CATEGORIES.includes(report.category)) {
|
|
956
|
+
return `Invalid category: ${report.category}. Must be one of: ${BUG_CATEGORIES.join(", ")}`;
|
|
952
957
|
}
|
|
953
958
|
if (report.title && report.title.length > 500) {
|
|
954
959
|
return "Title must be 500 characters or less";
|
|
@@ -1022,6 +1027,10 @@ var BugBearClient = class {
|
|
|
1022
1027
|
});
|
|
1023
1028
|
if (error) {
|
|
1024
1029
|
console.warn("BugBear: Rate limit check failed, allowing request", error.message);
|
|
1030
|
+
this.config.onError?.(new Error(`Rate limit check failed: ${error.message}`), {
|
|
1031
|
+
projectId: this.config.projectId,
|
|
1032
|
+
context: "rate_limit_check_failed_open"
|
|
1033
|
+
});
|
|
1025
1034
|
return { allowed: true };
|
|
1026
1035
|
}
|
|
1027
1036
|
if (!data.allowed) {
|
|
@@ -1038,7 +1047,12 @@ var BugBearClient = class {
|
|
|
1038
1047
|
resetAt: data.reset_at
|
|
1039
1048
|
};
|
|
1040
1049
|
} catch (err) {
|
|
1050
|
+
const message = err instanceof Error ? err.message : "Unknown rate limit error";
|
|
1041
1051
|
console.warn("BugBear: Rate limit check error", err);
|
|
1052
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), {
|
|
1053
|
+
projectId: this.config.projectId,
|
|
1054
|
+
context: "rate_limit_check_failed_open"
|
|
1055
|
+
});
|
|
1042
1056
|
return { allowed: true };
|
|
1043
1057
|
}
|
|
1044
1058
|
}
|
|
@@ -1102,6 +1116,9 @@ var BugBearClient = class {
|
|
|
1102
1116
|
}
|
|
1103
1117
|
return data ?? true;
|
|
1104
1118
|
} catch (err) {
|
|
1119
|
+
const message = err instanceof Error ? err.message : "Unknown error checking QA status";
|
|
1120
|
+
console.error("BugBear: Error checking QA status", err);
|
|
1121
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), { projectId: this.config.projectId });
|
|
1105
1122
|
return true;
|
|
1106
1123
|
}
|
|
1107
1124
|
}
|
|
@@ -1130,13 +1147,24 @@ var BugBearClient = class {
|
|
|
1130
1147
|
upsert: false
|
|
1131
1148
|
});
|
|
1132
1149
|
if (error) {
|
|
1133
|
-
|
|
1150
|
+
const formattedError = formatPgError(error);
|
|
1151
|
+
const errorMessage = formattedError.message || "Failed to upload screenshot";
|
|
1152
|
+
console.error("BugBear: Failed to upload screenshot", formattedError);
|
|
1153
|
+
this.config.onError?.(new Error(errorMessage), {
|
|
1154
|
+
projectId: this.config.projectId,
|
|
1155
|
+
context: "screenshot_upload_failed"
|
|
1156
|
+
});
|
|
1134
1157
|
return null;
|
|
1135
1158
|
}
|
|
1136
1159
|
const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
|
|
1137
1160
|
return publicUrl;
|
|
1138
1161
|
} catch (err) {
|
|
1162
|
+
const message = err instanceof Error ? err.message : "Unknown error uploading screenshot";
|
|
1139
1163
|
console.error("BugBear: Error uploading screenshot", err);
|
|
1164
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), {
|
|
1165
|
+
projectId: this.config.projectId,
|
|
1166
|
+
context: "screenshot_upload_failed"
|
|
1167
|
+
});
|
|
1140
1168
|
return null;
|
|
1141
1169
|
}
|
|
1142
1170
|
}
|
|
@@ -1161,13 +1189,24 @@ var BugBearClient = class {
|
|
|
1161
1189
|
upsert: false
|
|
1162
1190
|
});
|
|
1163
1191
|
if (error) {
|
|
1164
|
-
|
|
1192
|
+
const formattedError = formatPgError(error);
|
|
1193
|
+
const errorMessage = formattedError.message || "Failed to upload image";
|
|
1194
|
+
console.error("BugBear: Failed to upload image from URI", formattedError);
|
|
1195
|
+
this.config.onError?.(new Error(errorMessage), {
|
|
1196
|
+
projectId: this.config.projectId,
|
|
1197
|
+
context: "image_upload_failed"
|
|
1198
|
+
});
|
|
1165
1199
|
return null;
|
|
1166
1200
|
}
|
|
1167
1201
|
const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
|
|
1168
1202
|
return publicUrl;
|
|
1169
1203
|
} catch (err) {
|
|
1204
|
+
const message = err instanceof Error ? err.message : "Unknown error uploading image";
|
|
1170
1205
|
console.error("BugBear: Error uploading image from URI", err);
|
|
1206
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), {
|
|
1207
|
+
projectId: this.config.projectId,
|
|
1208
|
+
context: "image_upload_failed"
|
|
1209
|
+
});
|
|
1171
1210
|
return null;
|
|
1172
1211
|
}
|
|
1173
1212
|
}
|
|
@@ -1697,8 +1736,10 @@ function createBugBear(config) {
|
|
|
1697
1736
|
return new BugBearClient(config);
|
|
1698
1737
|
}
|
|
1699
1738
|
export {
|
|
1739
|
+
BUG_CATEGORIES,
|
|
1700
1740
|
BugBearClient,
|
|
1701
1741
|
captureError,
|
|
1702
1742
|
contextCapture,
|
|
1703
|
-
createBugBear
|
|
1743
|
+
createBugBear,
|
|
1744
|
+
isBugCategory
|
|
1704
1745
|
};
|