@issue-reporter/core 0.1.1 → 0.1.4

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.
@@ -1,17 +1,38 @@
1
1
  import type { Buffer } from 'node:buffer';
2
2
  export type IssueReportStatusReason = 'missing_issue_sink_config' | 'missing_storage_config' | 'disabled';
3
+ export type IssueReportEvidenceMode = 'captured' | 'manual' | 'none';
4
+ export type IssueReportCaptureStrategy = 'native' | 'manual_upload' | 'manual_paste' | 'none';
5
+ export interface IssueReportCapabilities {
6
+ capturedEvidence: boolean;
7
+ manualEvidence: boolean;
8
+ noEvidence: boolean;
9
+ }
10
+ export interface IssueReportCaptureDiagnosticsBase {
11
+ nativeSupported: boolean;
12
+ retryCount: number;
13
+ failureReason?: string;
14
+ }
15
+ export interface IssueReportNativeCaptureDiagnostics extends IssueReportCaptureDiagnosticsBase {
16
+ strategy: 'native';
17
+ }
18
+ export interface IssueReportManualCaptureDiagnostics extends IssueReportCaptureDiagnosticsBase {
19
+ strategy: 'manual_upload' | 'manual_paste';
20
+ }
21
+ export interface IssueReportNoEvidenceCaptureDiagnostics extends IssueReportCaptureDiagnosticsBase {
22
+ strategy: 'none';
23
+ }
24
+ export type IssueReportCaptureDiagnostics = IssueReportNativeCaptureDiagnostics | IssueReportManualCaptureDiagnostics | IssueReportNoEvidenceCaptureDiagnostics;
3
25
  export interface IssueReportStatus {
4
26
  enabled: boolean;
5
27
  reason?: IssueReportStatusReason;
28
+ capabilities: IssueReportCapabilities;
6
29
  }
7
30
  export interface IssueReportViewport {
8
31
  width: number;
9
32
  height: number;
10
33
  }
11
- export interface IssueReportSubmission {
34
+ export interface IssueReportBaseSubmission {
12
35
  note: string;
13
- screenshotBase64: string;
14
- screenshotMimeType: 'image/png';
15
36
  pageUrl: string;
16
37
  route: string;
17
38
  viewport: IssueReportViewport;
@@ -19,11 +40,42 @@ export interface IssueReportSubmission {
19
40
  appVersion: string;
20
41
  occurredAt: string;
21
42
  }
22
- export interface IssueReportResult {
43
+ export interface IssueReportCapturedSubmission extends IssueReportBaseSubmission {
44
+ evidenceMode: 'captured';
45
+ screenshotBase64: string;
46
+ screenshotMimeType: 'image/png';
47
+ diagnostics: IssueReportNativeCaptureDiagnostics;
48
+ }
49
+ export interface IssueReportManualSubmission extends IssueReportBaseSubmission {
50
+ evidenceMode: 'manual';
51
+ screenshotBase64: string;
52
+ screenshotMimeType: 'image/png';
53
+ diagnostics: IssueReportManualCaptureDiagnostics;
54
+ }
55
+ export interface IssueReportNoEvidenceSubmission extends IssueReportBaseSubmission {
56
+ evidenceMode: 'none';
57
+ screenshotBase64?: never;
58
+ screenshotMimeType?: never;
59
+ diagnostics: IssueReportNoEvidenceCaptureDiagnostics;
60
+ }
61
+ export type IssueReportSubmission = IssueReportCapturedSubmission | IssueReportManualSubmission | IssueReportNoEvidenceSubmission;
62
+ export interface IssueReportResultBase {
23
63
  issueNumber?: number;
24
64
  issueUrl: string;
65
+ }
66
+ export interface IssueReportCapturedResult extends IssueReportResultBase {
67
+ evidenceMode: 'captured';
68
+ screenshotUrl: string;
69
+ }
70
+ export interface IssueReportManualResult extends IssueReportResultBase {
71
+ evidenceMode: 'manual';
25
72
  screenshotUrl: string;
26
73
  }
74
+ export interface IssueReportNoEvidenceResult extends IssueReportResultBase {
75
+ evidenceMode: 'none';
76
+ screenshotUrl?: never;
77
+ }
78
+ export type IssueReportResult = IssueReportCapturedResult | IssueReportManualResult | IssueReportNoEvidenceResult;
27
79
  export interface IssueReportAsset {
28
80
  contentType: string;
29
81
  body: Buffer | Uint8Array;
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type IssueReporterErrorCode = 'disabled' | 'missing_issue_sink_config' | 'missing_storage_config' | 'missing_note' | 'note_too_long' | 'invalid_screenshot' | 'invalid_screenshot_type' | 'screenshot_too_large' | 'asset_not_found' | 'submission_failed' | 'service_unavailable';
1
+ export type IssueReporterErrorCode = 'disabled' | 'missing_issue_sink_config' | 'missing_storage_config' | 'missing_note' | 'note_too_long' | 'missing_screenshot' | 'invalid_screenshot' | 'invalid_screenshot_type' | 'screenshot_too_large' | 'asset_not_found' | 'submission_failed' | 'service_unavailable';
2
2
  export interface IssueReporterErrorOptions {
3
3
  code: IssueReporterErrorCode;
4
4
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAyB;IAC7B,UAAU,CAAS;IAE5B,YAAY,OAAkC;QAC5C,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAqBA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAyB;IAC7B,UAAU,CAAS;IAE5B,YAAY,OAAkC;QAC5C,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF"}
@@ -5,7 +5,7 @@ export interface BuildIssueReportTitleInput {
5
5
  }
6
6
  export interface BuildIssueReportBodyInput {
7
7
  submission: IssueReportSubmission;
8
- screenshotUrl: string;
8
+ screenshotUrl?: string;
9
9
  }
10
10
  export declare function buildIssueReportTitle(input: BuildIssueReportTitleInput): string;
11
11
  export declare function buildIssueReportBody(input: BuildIssueReportBodyInput): string;
@@ -4,14 +4,34 @@ export function buildIssueReportTitle(input) {
4
4
  }
5
5
  export function buildIssueReportBody(input) {
6
6
  const { submission, screenshotUrl } = input;
7
+ const screenshotSection = (() => {
8
+ switch (submission.evidenceMode) {
9
+ case 'none':
10
+ return ['## Screenshot', '', 'No screenshot was attached to this report.'];
11
+ case 'manual':
12
+ return screenshotUrl
13
+ ? ['## Manual Screenshot', '', `![Reported screenshot](${screenshotUrl})`]
14
+ : ['## Manual Screenshot', '', 'No screenshot URL was provided for this manual evidence.'];
15
+ case 'captured':
16
+ return screenshotUrl
17
+ ? ['## Captured Screenshot', '', `![Reported screenshot](${screenshotUrl})`]
18
+ : ['## Captured Screenshot', '', 'No screenshot URL was provided for this captured evidence.'];
19
+ }
20
+ })();
21
+ const diagnosticContext = [
22
+ `- Capture strategy: \`${submission.diagnostics.strategy}\``,
23
+ `- Native supported: \`${submission.diagnostics.nativeSupported}\``,
24
+ `- Retry count: \`${submission.diagnostics.retryCount}\``,
25
+ ...(submission.diagnostics.failureReason
26
+ ? [`- Failure reason: \`${submission.diagnostics.failureReason}\``]
27
+ : []),
28
+ ];
7
29
  return [
8
30
  '## User Report',
9
31
  '',
10
32
  submission.note.trim(),
11
33
  '',
12
- '## Screenshot',
13
- '',
14
- `![Reported screenshot](${screenshotUrl})`,
34
+ ...screenshotSection,
15
35
  '',
16
36
  '## Context',
17
37
  '',
@@ -21,6 +41,8 @@ export function buildIssueReportBody(input) {
21
41
  `- Viewport: \`${submission.viewport.width}x${submission.viewport.height}\``,
22
42
  `- Submitted at: \`${submission.occurredAt}\``,
23
43
  `- User agent: \`${submission.userAgent}\``,
44
+ `- Evidence mode: \`${submission.evidenceMode}\``,
45
+ ...diagnosticContext,
24
46
  ].join('\n');
25
47
  }
26
48
  //# sourceMappingURL=formatting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatting.js","sourceRoot":"","sources":["../src/formatting.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC;IACnF,OAAO,aAAa,OAAO,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IACnE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAE5C,OAAO;QACL,gBAAgB;QAChB,EAAE;QACF,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE;QACtB,EAAE;QACF,eAAe;QACf,EAAE;QACF,0BAA0B,aAAa,GAAG;QAC1C,EAAE;QACF,YAAY;QACZ,EAAE;QACF,cAAc,UAAU,CAAC,KAAK,IAAI;QAClC,iBAAiB,UAAU,CAAC,OAAO,IAAI;QACvC,oBAAoB,UAAU,CAAC,UAAU,IAAI;QAC7C,iBAAiB,UAAU,CAAC,QAAQ,CAAC,KAAK,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,IAAI;QAC5E,qBAAqB,UAAU,CAAC,UAAU,IAAI;QAC9C,mBAAmB,UAAU,CAAC,SAAS,IAAI;KAC5C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"formatting.js","sourceRoot":"","sources":["../src/formatting.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC;IACnF,OAAO,aAAa,OAAO,EAAE,CAAC;AAChC,CAAC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,CAAC,OAAO,IAAI;QACvC,oBAAoB,UAAU,CAAC,UAAU,IAAI;QAC7C,iBAAiB,UAAU,CAAC,QAAQ,CAAC,KAAK,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,IAAI;QAC5E,qBAAqB,UAAU,CAAC,UAAU,IAAI;QAC9C,mBAAmB,UAAU,CAAC,SAAS,IAAI;QAC3C,sBAAsB,UAAU,CAAC,YAAY,IAAI;QACjD,GAAG,iBAAiB;KACrB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
package/dist/schemas.d.ts CHANGED
@@ -4,6 +4,56 @@ export declare const issueReportStatusReasonSchema: z.ZodEnum<{
4
4
  missing_storage_config: "missing_storage_config";
5
5
  disabled: "disabled";
6
6
  }>;
7
+ export declare const issueReportEvidenceModeSchema: z.ZodEnum<{
8
+ captured: "captured";
9
+ manual: "manual";
10
+ none: "none";
11
+ }>;
12
+ export declare const issueReportCaptureStrategySchema: z.ZodEnum<{
13
+ none: "none";
14
+ native: "native";
15
+ manual_upload: "manual_upload";
16
+ manual_paste: "manual_paste";
17
+ }>;
18
+ export declare const issueReportCapabilitiesSchema: z.ZodObject<{
19
+ capturedEvidence: z.ZodBoolean;
20
+ manualEvidence: z.ZodBoolean;
21
+ noEvidence: z.ZodBoolean;
22
+ }, z.core.$strip>;
23
+ export declare const issueReportNativeCaptureDiagnosticsSchema: z.ZodObject<{
24
+ strategy: z.ZodLiteral<"native">;
25
+ nativeSupported: z.ZodBoolean;
26
+ retryCount: z.ZodNumber;
27
+ failureReason: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ export declare const issueReportManualCaptureDiagnosticsSchema: z.ZodObject<{
30
+ strategy: z.ZodUnion<readonly [z.ZodLiteral<"manual_upload">, z.ZodLiteral<"manual_paste">]>;
31
+ nativeSupported: z.ZodBoolean;
32
+ retryCount: z.ZodNumber;
33
+ failureReason: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>;
35
+ export declare const issueReportNoEvidenceCaptureDiagnosticsSchema: z.ZodObject<{
36
+ strategy: z.ZodLiteral<"none">;
37
+ nativeSupported: z.ZodBoolean;
38
+ retryCount: z.ZodNumber;
39
+ failureReason: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ export declare const issueReportCaptureDiagnosticsSchema: z.ZodUnion<readonly [z.ZodObject<{
42
+ strategy: z.ZodLiteral<"native">;
43
+ nativeSupported: z.ZodBoolean;
44
+ retryCount: z.ZodNumber;
45
+ failureReason: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strip>, z.ZodObject<{
47
+ strategy: z.ZodUnion<readonly [z.ZodLiteral<"manual_upload">, z.ZodLiteral<"manual_paste">]>;
48
+ nativeSupported: z.ZodBoolean;
49
+ retryCount: z.ZodNumber;
50
+ failureReason: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ strategy: z.ZodLiteral<"none">;
53
+ nativeSupported: z.ZodBoolean;
54
+ retryCount: z.ZodNumber;
55
+ failureReason: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strip>]>;
7
57
  export declare const issueReportStatusSchema: z.ZodObject<{
8
58
  enabled: z.ZodBoolean;
9
59
  reason: z.ZodOptional<z.ZodEnum<{
@@ -11,15 +61,50 @@ export declare const issueReportStatusSchema: z.ZodObject<{
11
61
  missing_storage_config: "missing_storage_config";
12
62
  disabled: "disabled";
13
63
  }>>;
64
+ capabilities: z.ZodObject<{
65
+ capturedEvidence: z.ZodBoolean;
66
+ manualEvidence: z.ZodBoolean;
67
+ noEvidence: z.ZodBoolean;
68
+ }, z.core.$strip>;
14
69
  }, z.core.$strip>;
15
70
  export declare const issueReportViewportSchema: z.ZodObject<{
16
71
  width: z.ZodNumber;
17
72
  height: z.ZodNumber;
18
73
  }, z.core.$strip>;
19
- export declare const issueReportSubmissionSchema: z.ZodObject<{
74
+ export declare const issueReportSubmissionBaseSchema: z.ZodObject<{
75
+ note: z.ZodString;
76
+ pageUrl: z.ZodString;
77
+ route: z.ZodString;
78
+ viewport: z.ZodObject<{
79
+ width: z.ZodNumber;
80
+ height: z.ZodNumber;
81
+ }, z.core.$strip>;
82
+ userAgent: z.ZodString;
83
+ appVersion: z.ZodString;
84
+ occurredAt: z.ZodString;
85
+ }, z.core.$strip>;
86
+ export declare const issueReportSubmissionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
20
87
  note: z.ZodString;
88
+ pageUrl: z.ZodString;
89
+ route: z.ZodString;
90
+ viewport: z.ZodObject<{
91
+ width: z.ZodNumber;
92
+ height: z.ZodNumber;
93
+ }, z.core.$strip>;
94
+ userAgent: z.ZodString;
95
+ appVersion: z.ZodString;
96
+ occurredAt: z.ZodString;
97
+ evidenceMode: z.ZodLiteral<"captured">;
21
98
  screenshotBase64: z.ZodString;
22
99
  screenshotMimeType: z.ZodLiteral<"image/png">;
100
+ diagnostics: z.ZodObject<{
101
+ strategy: z.ZodLiteral<"native">;
102
+ nativeSupported: z.ZodBoolean;
103
+ retryCount: z.ZodNumber;
104
+ failureReason: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>;
106
+ }, z.core.$strip>, z.ZodObject<{
107
+ note: z.ZodString;
23
108
  pageUrl: z.ZodString;
24
109
  route: z.ZodString;
25
110
  viewport: z.ZodObject<{
@@ -29,9 +114,53 @@ export declare const issueReportSubmissionSchema: z.ZodObject<{
29
114
  userAgent: z.ZodString;
30
115
  appVersion: z.ZodString;
31
116
  occurredAt: z.ZodString;
117
+ evidenceMode: z.ZodLiteral<"manual">;
118
+ screenshotBase64: z.ZodString;
119
+ screenshotMimeType: z.ZodLiteral<"image/png">;
120
+ diagnostics: z.ZodObject<{
121
+ strategy: z.ZodUnion<readonly [z.ZodLiteral<"manual_upload">, z.ZodLiteral<"manual_paste">]>;
122
+ nativeSupported: z.ZodBoolean;
123
+ retryCount: z.ZodNumber;
124
+ failureReason: z.ZodOptional<z.ZodString>;
125
+ }, z.core.$strip>;
126
+ }, z.core.$strip>, z.ZodObject<{
127
+ note: z.ZodString;
128
+ pageUrl: z.ZodString;
129
+ route: z.ZodString;
130
+ viewport: z.ZodObject<{
131
+ width: z.ZodNumber;
132
+ height: z.ZodNumber;
133
+ }, z.core.$strip>;
134
+ userAgent: z.ZodString;
135
+ appVersion: z.ZodString;
136
+ occurredAt: z.ZodString;
137
+ evidenceMode: z.ZodLiteral<"none">;
138
+ screenshotBase64: z.ZodOptional<z.ZodNever>;
139
+ screenshotMimeType: z.ZodOptional<z.ZodNever>;
140
+ diagnostics: z.ZodObject<{
141
+ strategy: z.ZodLiteral<"none">;
142
+ nativeSupported: z.ZodBoolean;
143
+ retryCount: z.ZodNumber;
144
+ failureReason: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strip>;
146
+ }, z.core.$strip>], "evidenceMode">;
147
+ export declare const issueReportResultBaseSchema: z.ZodObject<{
148
+ issueNumber: z.ZodOptional<z.ZodNumber>;
149
+ issueUrl: z.ZodString;
32
150
  }, z.core.$strip>;
33
- export declare const issueReportResultSchema: z.ZodObject<{
151
+ export declare const issueReportResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
152
+ evidenceMode: z.ZodLiteral<"captured">;
153
+ screenshotUrl: z.ZodString;
34
154
  issueNumber: z.ZodOptional<z.ZodNumber>;
35
155
  issueUrl: z.ZodString;
156
+ }, z.core.$strip>, z.ZodObject<{
157
+ evidenceMode: z.ZodLiteral<"manual">;
36
158
  screenshotUrl: z.ZodString;
37
- }, z.core.$strip>;
159
+ issueNumber: z.ZodOptional<z.ZodNumber>;
160
+ issueUrl: z.ZodString;
161
+ }, z.core.$strip>, z.ZodObject<{
162
+ evidenceMode: z.ZodLiteral<"none">;
163
+ screenshotUrl: z.ZodOptional<z.ZodNever>;
164
+ issueNumber: z.ZodOptional<z.ZodNumber>;
165
+ issueUrl: z.ZodString;
166
+ }, z.core.$strip>], "evidenceMode">;
package/dist/schemas.js CHANGED
@@ -4,18 +4,56 @@ export const issueReportStatusReasonSchema = z.enum([
4
4
  'missing_storage_config',
5
5
  'disabled',
6
6
  ]);
7
+ export const issueReportEvidenceModeSchema = z.enum([
8
+ 'captured',
9
+ 'manual',
10
+ 'none',
11
+ ]);
12
+ export const issueReportCaptureStrategySchema = z.enum([
13
+ 'native',
14
+ 'manual_upload',
15
+ 'manual_paste',
16
+ 'none',
17
+ ]);
18
+ export const issueReportCapabilitiesSchema = z.object({
19
+ capturedEvidence: z.boolean(),
20
+ manualEvidence: z.boolean(),
21
+ noEvidence: z.boolean(),
22
+ });
23
+ export const issueReportNativeCaptureDiagnosticsSchema = z.object({
24
+ strategy: z.literal('native'),
25
+ nativeSupported: z.boolean(),
26
+ retryCount: z.number().int().nonnegative(),
27
+ failureReason: z.string().min(1).optional(),
28
+ });
29
+ export const issueReportManualCaptureDiagnosticsSchema = z.object({
30
+ strategy: z.union([z.literal('manual_upload'), z.literal('manual_paste')]),
31
+ nativeSupported: z.boolean(),
32
+ retryCount: z.number().int().nonnegative(),
33
+ failureReason: z.string().min(1).optional(),
34
+ });
35
+ export const issueReportNoEvidenceCaptureDiagnosticsSchema = z.object({
36
+ strategy: z.literal('none'),
37
+ nativeSupported: z.boolean(),
38
+ retryCount: z.number().int().nonnegative(),
39
+ failureReason: z.string().min(1).optional(),
40
+ });
41
+ export const issueReportCaptureDiagnosticsSchema = z.union([
42
+ issueReportNativeCaptureDiagnosticsSchema,
43
+ issueReportManualCaptureDiagnosticsSchema,
44
+ issueReportNoEvidenceCaptureDiagnosticsSchema,
45
+ ]);
7
46
  export const issueReportStatusSchema = z.object({
8
47
  enabled: z.boolean(),
9
48
  reason: issueReportStatusReasonSchema.optional(),
49
+ capabilities: issueReportCapabilitiesSchema,
10
50
  });
11
51
  export const issueReportViewportSchema = z.object({
12
52
  width: z.number().finite(),
13
53
  height: z.number().finite(),
14
54
  });
15
- export const issueReportSubmissionSchema = z.object({
55
+ export const issueReportSubmissionBaseSchema = z.object({
16
56
  note: z.string(),
17
- screenshotBase64: z.string().min(1),
18
- screenshotMimeType: z.literal('image/png'),
19
57
  pageUrl: z.string().min(1),
20
58
  route: z.string().min(1),
21
59
  viewport: issueReportViewportSchema,
@@ -23,9 +61,51 @@ export const issueReportSubmissionSchema = z.object({
23
61
  appVersion: z.string().min(1),
24
62
  occurredAt: z.string().min(1),
25
63
  });
26
- export const issueReportResultSchema = z.object({
64
+ const issueReportCapturedSubmissionSchema = issueReportSubmissionBaseSchema.extend({
65
+ evidenceMode: z.literal('captured'),
66
+ screenshotBase64: z.string().min(1),
67
+ screenshotMimeType: z.literal('image/png'),
68
+ diagnostics: issueReportNativeCaptureDiagnosticsSchema,
69
+ });
70
+ const issueReportManualSubmissionSchema = issueReportSubmissionBaseSchema.extend({
71
+ evidenceMode: z.literal('manual'),
72
+ screenshotBase64: z.string().min(1),
73
+ screenshotMimeType: z.literal('image/png'),
74
+ diagnostics: issueReportManualCaptureDiagnosticsSchema,
75
+ });
76
+ const issueReportNoEvidenceSubmissionSchema = issueReportSubmissionBaseSchema.extend({
77
+ evidenceMode: z.literal('none'),
78
+ screenshotBase64: z.never().optional(),
79
+ screenshotMimeType: z.never().optional(),
80
+ diagnostics: issueReportNoEvidenceCaptureDiagnosticsSchema,
81
+ });
82
+ export const issueReportSubmissionSchema = z.discriminatedUnion('evidenceMode', [
83
+ issueReportCapturedSubmissionSchema,
84
+ issueReportManualSubmissionSchema,
85
+ issueReportNoEvidenceSubmissionSchema,
86
+ ]);
87
+ export const issueReportResultBaseSchema = z.object({
27
88
  issueNumber: z.number().int().positive().optional(),
28
89
  issueUrl: z.string().min(1),
90
+ });
91
+ const issueReportCapturedResultSchema = z.object({
92
+ ...issueReportResultBaseSchema.shape,
93
+ evidenceMode: z.literal('captured'),
94
+ screenshotUrl: z.string().min(1),
95
+ });
96
+ const issueReportManualResultSchema = z.object({
97
+ ...issueReportResultBaseSchema.shape,
98
+ evidenceMode: z.literal('manual'),
29
99
  screenshotUrl: z.string().min(1),
30
100
  });
101
+ const issueReportNoEvidenceResultSchema = z.object({
102
+ ...issueReportResultBaseSchema.shape,
103
+ evidenceMode: z.literal('none'),
104
+ screenshotUrl: z.never().optional(),
105
+ });
106
+ export const issueReportResultSchema = z.discriminatedUnion('evidenceMode', [
107
+ issueReportCapturedResultSchema,
108
+ issueReportManualResultSchema,
109
+ issueReportNoEvidenceResultSchema,
110
+ ]);
31
111
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC;IAClD,2BAA2B;IAC3B,wBAAwB;IACxB,UAAU;CACX,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,MAAM,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE;IAC1B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE;CAC5B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC1C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,C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CACjC,CAAC,CAAC;AAEH,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,GAAG,2BAA2B,CAAC,KAAK;IACpC,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,GAAG,2BAA2B,CAAC,KAAK;IACpC,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAC/B,aAAa,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,kBAAkB,CAAC,cAAc,EAAE;IAC1E,+BAA+B;IAC/B,6BAA6B;IAC7B,iCAAiC;CAClC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@issue-reporter/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "description": "Shared contracts, schemas, and formatting helpers for IssueReporter",
5
5
  "license": "MIT",
6
6
  "repository": {