opticedge-types 1.0.59 → 1.0.62
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/types/instant.d.ts +24 -17
- package/dist/types/instant.js +3 -3
- package/package.json +1 -1
- package/src/types/instant.ts +110 -63
package/dist/types/instant.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
export type SubmissionStatus = 'REJECTED' | 'ACCEPTED';
|
|
2
|
+
export interface RejectedResponse {
|
|
3
|
+
submission_status: 'REJECTED';
|
|
4
|
+
rejection_message: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AcceptedResponse {
|
|
7
|
+
submission_status: 'ACCEPTED';
|
|
8
|
+
validation: ValidationResult;
|
|
9
|
+
overall_grade: number;
|
|
10
|
+
front_subgrades: SubGrades;
|
|
11
|
+
back_subgrades: SubGrades;
|
|
12
|
+
environment_score: number;
|
|
13
|
+
accuracy_score: number;
|
|
14
|
+
grading_rationale: string;
|
|
15
|
+
defect_map: DefectMap;
|
|
16
|
+
}
|
|
1
17
|
type SameCardConfidence = 'high' | 'medium' | 'low';
|
|
2
18
|
type ImageQuality = 'good' | 'borderline' | 'poor';
|
|
3
19
|
interface ValidationResult {
|
|
@@ -12,35 +28,26 @@ export interface SubGrades {
|
|
|
12
28
|
edges: number;
|
|
13
29
|
corners: number;
|
|
14
30
|
}
|
|
15
|
-
|
|
31
|
+
export type DefectSeverity = 'minimal' | 'moderate' | 'major';
|
|
32
|
+
export type DefectType = 'corner_whitening' | 'edge_whitening' | 'surface_scratch' | 'holo_or_foil_scratching' | 'crease' | 'foil_wear' | 'edge_chip' | 'corner_rounding' | 'staining_or_ink_bleed' | 'post_factory_dents' | 'scuffing';
|
|
33
|
+
export interface BoundingBox {
|
|
16
34
|
x: number;
|
|
17
35
|
y: number;
|
|
18
36
|
width: number;
|
|
19
37
|
height: number;
|
|
20
38
|
}
|
|
21
|
-
|
|
22
|
-
type DefectSeverity = 'minimal' | 'moderate' | 'major';
|
|
23
|
-
type DefectLocationZone = 'front_top_left_corner' | 'front_top_right_corner' | 'front_bottom_left_corner' | 'front_bottom_right_corner' | 'front_top_edge_left' | 'front_top_edge_center' | 'front_top_edge_right' | 'front_bottom_edge_left' | 'front_bottom_edge_center' | 'front_bottom_edge_right' | 'front_left_edge_upper' | 'front_left_edge_center' | 'front_left_edge_lower' | 'front_right_edge_upper' | 'front_right_edge_center' | 'front_right_edge_lower' | 'front_inner_top_left' | 'front_inner_top_center' | 'front_inner_top_right' | 'front_inner_middle_left' | 'front_inner_middle_center' | 'front_inner_middle_right' | 'front_inner_bottom_left' | 'front_inner_bottom_center' | 'front_inner_bottom_right' | 'back_top_left_corner' | 'back_top_right_corner' | 'back_bottom_left_corner' | 'back_bottom_right_corner' | 'back_top_edge_left' | 'back_top_edge_center' | 'back_top_edge_right' | 'back_bottom_edge_left' | 'back_bottom_edge_center' | 'back_bottom_edge_right' | 'back_left_edge_upper' | 'back_left_edge_center' | 'back_left_edge_lower' | 'back_right_edge_upper' | 'back_right_edge_center' | 'back_right_edge_lower' | 'back_inner_top_left' | 'back_inner_top_center' | 'back_inner_top_right' | 'back_inner_middle_left' | 'back_inner_middle_center' | 'back_inner_middle_right' | 'back_inner_bottom_left' | 'back_inner_bottom_center' | 'back_inner_bottom_right';
|
|
24
|
-
interface Defect {
|
|
39
|
+
export interface Defect {
|
|
25
40
|
defect_type: DefectType;
|
|
26
41
|
severity: DefectSeverity;
|
|
27
42
|
confidence: number;
|
|
28
|
-
location_zone:
|
|
29
|
-
bbox_norm:
|
|
43
|
+
location_zone: LocationZone;
|
|
44
|
+
bbox_norm: BoundingBox;
|
|
30
45
|
notes: string;
|
|
31
46
|
}
|
|
32
47
|
export interface DefectMap {
|
|
33
48
|
front: Defect[];
|
|
34
49
|
back: Defect[];
|
|
35
50
|
}
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
overall_grade: number;
|
|
39
|
-
front_subgrades: SubGrades;
|
|
40
|
-
back_subgrades: SubGrades;
|
|
41
|
-
environment_score: number;
|
|
42
|
-
accuracy_score: number;
|
|
43
|
-
grading_rationale: string;
|
|
44
|
-
defect_map: DefectMap;
|
|
45
|
-
}
|
|
51
|
+
export type LocationZone = 'front_top_left_corner' | 'front_top_right_corner' | 'front_bottom_left_corner' | 'front_bottom_right_corner' | 'back_top_left_corner' | 'back_top_right_corner' | 'back_bottom_left_corner' | 'back_bottom_right_corner' | 'front_top_edge_left' | 'front_top_edge_center' | 'front_top_edge_right' | 'front_bottom_edge_left' | 'front_bottom_edge_center' | 'front_bottom_edge_right' | 'front_left_edge_upper' | 'front_left_edge_center' | 'front_left_edge_lower' | 'front_right_edge_upper' | 'front_right_edge_center' | 'front_right_edge_lower' | 'back_top_edge_left' | 'back_top_edge_center' | 'back_top_edge_right' | 'back_bottom_edge_left' | 'back_bottom_edge_center' | 'back_bottom_edge_right' | 'back_left_edge_upper' | 'back_left_edge_center' | 'back_left_edge_lower' | 'back_right_edge_upper' | 'back_right_edge_center' | 'back_right_edge_lower' | 'front_inner_top_left' | 'front_inner_top_center' | 'front_inner_top_right' | 'front_inner_middle_left' | 'front_inner_middle_center' | 'front_inner_middle_right' | 'front_inner_bottom_left' | 'front_inner_bottom_center' | 'front_inner_bottom_right' | 'back_inner_top_left' | 'back_inner_top_center' | 'back_inner_top_right' | 'back_inner_middle_left' | 'back_inner_middle_center' | 'back_inner_middle_right' | 'back_inner_bottom_left' | 'back_inner_bottom_center' | 'back_inner_bottom_right';
|
|
52
|
+
export type PromptGradingResponse = RejectedResponse | AcceptedResponse;
|
|
46
53
|
export {};
|
package/dist/types/instant.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/* --------------------------------------------- */
|
|
3
|
+
/* Submission Status */
|
|
4
|
+
/* --------------------------------------------- */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
package/src/types/instant.ts
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
/* --------------------------------------------- */
|
|
2
|
+
/* Submission Status */
|
|
3
|
+
/* --------------------------------------------- */
|
|
4
|
+
|
|
5
|
+
export type SubmissionStatus = 'REJECTED' | 'ACCEPTED'
|
|
6
|
+
|
|
7
|
+
/* --------------------------------------------- */
|
|
8
|
+
/* REJECTED RESPONSE */
|
|
9
|
+
/* --------------------------------------------- */
|
|
10
|
+
|
|
11
|
+
export interface RejectedResponse {
|
|
12
|
+
submission_status: 'REJECTED'
|
|
13
|
+
rejection_message: string // single sentence, <200 chars
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* --------------------------------------------- */
|
|
17
|
+
/* ACCEPTED RESPONSE */
|
|
18
|
+
/* --------------------------------------------- */
|
|
19
|
+
|
|
20
|
+
export interface AcceptedResponse {
|
|
21
|
+
submission_status: 'ACCEPTED'
|
|
22
|
+
|
|
23
|
+
validation: ValidationResult
|
|
24
|
+
|
|
25
|
+
overall_grade: number // 1.0–10.0
|
|
26
|
+
|
|
27
|
+
front_subgrades: SubGrades
|
|
28
|
+
back_subgrades: SubGrades
|
|
29
|
+
|
|
30
|
+
environment_score: number // 0–100
|
|
31
|
+
accuracy_score: number // 0–100
|
|
32
|
+
|
|
33
|
+
grading_rationale: string
|
|
34
|
+
|
|
35
|
+
defect_map: DefectMap
|
|
36
|
+
}
|
|
37
|
+
|
|
1
38
|
// --------------------
|
|
2
39
|
// Validation
|
|
3
40
|
// --------------------
|
|
@@ -16,29 +53,24 @@ interface ValidationResult {
|
|
|
16
53
|
damage_override_triggered: boolean
|
|
17
54
|
}
|
|
18
55
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
56
|
+
/* --------------------------------------------- */
|
|
57
|
+
/* SUBGRADES */
|
|
58
|
+
/* --------------------------------------------- */
|
|
22
59
|
|
|
23
60
|
export interface SubGrades {
|
|
24
|
-
centering: number
|
|
61
|
+
centering: number // 1.0–10.0
|
|
25
62
|
surface: number
|
|
26
63
|
edges: number
|
|
27
64
|
corners: number
|
|
28
65
|
}
|
|
29
66
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
67
|
+
/* --------------------------------------------- */
|
|
68
|
+
/* DEFECT */
|
|
69
|
+
/* --------------------------------------------- */
|
|
33
70
|
|
|
34
|
-
|
|
35
|
-
x: number
|
|
36
|
-
y: number
|
|
37
|
-
width: number
|
|
38
|
-
height: number
|
|
39
|
-
}
|
|
71
|
+
export type DefectSeverity = 'minimal' | 'moderate' | 'major'
|
|
40
72
|
|
|
41
|
-
type DefectType =
|
|
73
|
+
export type DefectType =
|
|
42
74
|
| 'corner_whitening'
|
|
43
75
|
| 'edge_whitening'
|
|
44
76
|
| 'surface_scratch'
|
|
@@ -51,53 +83,96 @@ type DefectType =
|
|
|
51
83
|
| 'post_factory_dents'
|
|
52
84
|
| 'scuffing'
|
|
53
85
|
|
|
54
|
-
|
|
86
|
+
export interface BoundingBox {
|
|
87
|
+
x: number // 0.0–1.0
|
|
88
|
+
y: number // 0.0–1.0
|
|
89
|
+
width: number // ≥0.01
|
|
90
|
+
height: number // ≥0.01
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface Defect {
|
|
94
|
+
defect_type: DefectType
|
|
95
|
+
severity: DefectSeverity
|
|
96
|
+
confidence: number // 0–1 recommended
|
|
97
|
+
location_zone: LocationZone
|
|
98
|
+
bbox_norm: BoundingBox
|
|
99
|
+
notes: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface DefectMap {
|
|
103
|
+
front: Defect[]
|
|
104
|
+
back: Defect[]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* --------------------------------------------- */
|
|
108
|
+
/* LOCATION ZONES */
|
|
109
|
+
/* --------------------------------------------- */
|
|
55
110
|
|
|
56
|
-
type
|
|
57
|
-
//
|
|
111
|
+
export type LocationZone =
|
|
112
|
+
// FRONT — Corners
|
|
58
113
|
| 'front_top_left_corner'
|
|
59
114
|
| 'front_top_right_corner'
|
|
60
115
|
| 'front_bottom_left_corner'
|
|
61
116
|
| 'front_bottom_right_corner'
|
|
117
|
+
|
|
118
|
+
// BACK — Corners
|
|
119
|
+
| 'back_top_left_corner'
|
|
120
|
+
| 'back_top_right_corner'
|
|
121
|
+
| 'back_bottom_left_corner'
|
|
122
|
+
| 'back_bottom_right_corner'
|
|
123
|
+
|
|
124
|
+
// FRONT — Top Edge
|
|
62
125
|
| 'front_top_edge_left'
|
|
63
126
|
| 'front_top_edge_center'
|
|
64
127
|
| 'front_top_edge_right'
|
|
128
|
+
|
|
129
|
+
// FRONT — Bottom Edge
|
|
65
130
|
| 'front_bottom_edge_left'
|
|
66
131
|
| 'front_bottom_edge_center'
|
|
67
132
|
| 'front_bottom_edge_right'
|
|
133
|
+
|
|
134
|
+
// FRONT — Left Edge
|
|
68
135
|
| 'front_left_edge_upper'
|
|
69
136
|
| 'front_left_edge_center'
|
|
70
137
|
| 'front_left_edge_lower'
|
|
138
|
+
|
|
139
|
+
// FRONT — Right Edge
|
|
71
140
|
| 'front_right_edge_upper'
|
|
72
141
|
| 'front_right_edge_center'
|
|
73
142
|
| 'front_right_edge_lower'
|
|
74
|
-
| 'front_inner_top_left'
|
|
75
|
-
| 'front_inner_top_center'
|
|
76
|
-
| 'front_inner_top_right'
|
|
77
|
-
| 'front_inner_middle_left'
|
|
78
|
-
| 'front_inner_middle_center'
|
|
79
|
-
| 'front_inner_middle_right'
|
|
80
|
-
| 'front_inner_bottom_left'
|
|
81
|
-
| 'front_inner_bottom_center'
|
|
82
|
-
| 'front_inner_bottom_right'
|
|
83
143
|
|
|
84
|
-
//
|
|
85
|
-
| 'back_top_left_corner'
|
|
86
|
-
| 'back_top_right_corner'
|
|
87
|
-
| 'back_bottom_left_corner'
|
|
88
|
-
| 'back_bottom_right_corner'
|
|
144
|
+
// BACK — Top Edge
|
|
89
145
|
| 'back_top_edge_left'
|
|
90
146
|
| 'back_top_edge_center'
|
|
91
147
|
| 'back_top_edge_right'
|
|
148
|
+
|
|
149
|
+
// BACK — Bottom Edge
|
|
92
150
|
| 'back_bottom_edge_left'
|
|
93
151
|
| 'back_bottom_edge_center'
|
|
94
152
|
| 'back_bottom_edge_right'
|
|
153
|
+
|
|
154
|
+
// BACK — Left Edge
|
|
95
155
|
| 'back_left_edge_upper'
|
|
96
156
|
| 'back_left_edge_center'
|
|
97
157
|
| 'back_left_edge_lower'
|
|
158
|
+
|
|
159
|
+
// BACK — Right Edge
|
|
98
160
|
| 'back_right_edge_upper'
|
|
99
161
|
| 'back_right_edge_center'
|
|
100
162
|
| 'back_right_edge_lower'
|
|
163
|
+
|
|
164
|
+
// FRONT — Interior
|
|
165
|
+
| 'front_inner_top_left'
|
|
166
|
+
| 'front_inner_top_center'
|
|
167
|
+
| 'front_inner_top_right'
|
|
168
|
+
| 'front_inner_middle_left'
|
|
169
|
+
| 'front_inner_middle_center'
|
|
170
|
+
| 'front_inner_middle_right'
|
|
171
|
+
| 'front_inner_bottom_left'
|
|
172
|
+
| 'front_inner_bottom_center'
|
|
173
|
+
| 'front_inner_bottom_right'
|
|
174
|
+
|
|
175
|
+
// BACK — Interior
|
|
101
176
|
| 'back_inner_top_left'
|
|
102
177
|
| 'back_inner_top_center'
|
|
103
178
|
| 'back_inner_top_right'
|
|
@@ -108,36 +183,8 @@ type DefectLocationZone =
|
|
|
108
183
|
| 'back_inner_bottom_center'
|
|
109
184
|
| 'back_inner_bottom_right'
|
|
110
185
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
confidence: number
|
|
115
|
-
location_zone: DefectLocationZone
|
|
116
|
-
bbox_norm: BBox
|
|
117
|
-
notes: string
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface DefectMap {
|
|
121
|
-
front: Defect[]
|
|
122
|
-
back: Defect[]
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// --------------------
|
|
126
|
-
// Main Prompt Result
|
|
127
|
-
// --------------------
|
|
186
|
+
/* --------------------------------------------- */
|
|
187
|
+
/* UNION TYPE */
|
|
188
|
+
/* --------------------------------------------- */
|
|
128
189
|
|
|
129
|
-
export
|
|
130
|
-
validation: ValidationResult
|
|
131
|
-
|
|
132
|
-
overall_grade: number
|
|
133
|
-
|
|
134
|
-
front_subgrades: SubGrades
|
|
135
|
-
back_subgrades: SubGrades
|
|
136
|
-
|
|
137
|
-
environment_score: number
|
|
138
|
-
accuracy_score: number
|
|
139
|
-
|
|
140
|
-
grading_rationale: string
|
|
141
|
-
|
|
142
|
-
defect_map: DefectMap
|
|
143
|
-
}
|
|
190
|
+
export type PromptGradingResponse = RejectedResponse | AcceptedResponse
|