opticedge-types 1.0.63 → 1.0.64
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 +17 -33
- package/dist/types/instant.js +3 -3
- package/package.json +1 -1
- package/src/types/instant.ts +71 -104
package/dist/types/instant.d.ts
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
export type SubmissionStatus = 'REJECTED' | 'ACCEPTED';
|
|
2
|
-
export interface RejectedResponse {
|
|
3
|
-
submission_status: 'REJECTED';
|
|
4
|
-
rejection_message: string;
|
|
5
|
-
validation?: never;
|
|
6
|
-
overall_grade?: never;
|
|
7
|
-
front_subgrades?: never;
|
|
8
|
-
back_subgrades?: never;
|
|
9
|
-
environment_score?: never;
|
|
10
|
-
accuracy_score?: never;
|
|
11
|
-
grading_rationale?: never;
|
|
12
|
-
defect_map?: never;
|
|
13
|
-
}
|
|
14
|
-
export interface AcceptedResponse {
|
|
15
|
-
submission_status: 'ACCEPTED';
|
|
16
|
-
rejection_message?: never;
|
|
17
|
-
validation: ValidationResult;
|
|
18
|
-
overall_grade: number;
|
|
19
|
-
front_subgrades: SubGrades;
|
|
20
|
-
back_subgrades: SubGrades;
|
|
21
|
-
environment_score: number;
|
|
22
|
-
accuracy_score: number;
|
|
23
|
-
grading_rationale: string;
|
|
24
|
-
defect_map: DefectMap;
|
|
25
|
-
}
|
|
26
1
|
type SameCardConfidence = 'high' | 'medium' | 'low';
|
|
27
2
|
type ImageQuality = 'good' | 'borderline' | 'poor';
|
|
28
3
|
interface ValidationResult {
|
|
@@ -37,26 +12,35 @@ export interface SubGrades {
|
|
|
37
12
|
edges: number;
|
|
38
13
|
corners: number;
|
|
39
14
|
}
|
|
40
|
-
|
|
41
|
-
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';
|
|
42
|
-
export interface BoundingBox {
|
|
15
|
+
interface BBox {
|
|
43
16
|
x: number;
|
|
44
17
|
y: number;
|
|
45
18
|
width: number;
|
|
46
19
|
height: number;
|
|
47
20
|
}
|
|
48
|
-
|
|
21
|
+
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';
|
|
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 {
|
|
49
25
|
defect_type: DefectType;
|
|
50
26
|
severity: DefectSeverity;
|
|
51
27
|
confidence: number;
|
|
52
|
-
location_zone:
|
|
53
|
-
bbox_norm:
|
|
28
|
+
location_zone: DefectLocationZone;
|
|
29
|
+
bbox_norm: BBox;
|
|
54
30
|
notes: string;
|
|
55
31
|
}
|
|
56
32
|
export interface DefectMap {
|
|
57
33
|
front: Defect[];
|
|
58
34
|
back: Defect[];
|
|
59
35
|
}
|
|
60
|
-
export
|
|
61
|
-
|
|
36
|
+
export interface PromptGradingResult {
|
|
37
|
+
validation: ValidationResult;
|
|
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
|
+
}
|
|
62
46
|
export {};
|
package/dist/types/instant.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
// --------------------
|
|
3
|
+
// Validation
|
|
4
|
+
// --------------------
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
package/src/types/instant.ts
CHANGED
|
@@ -1,60 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
14
|
-
|
|
15
|
-
// explicitly forbid accepted fields
|
|
16
|
-
validation?: never
|
|
17
|
-
overall_grade?: never
|
|
18
|
-
front_subgrades?: never
|
|
19
|
-
back_subgrades?: never
|
|
20
|
-
environment_score?: never
|
|
21
|
-
accuracy_score?: never
|
|
22
|
-
grading_rationale?: never
|
|
23
|
-
defect_map?: never
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/* --------------------------------------------- */
|
|
27
|
-
/* ACCEPTED RESPONSE */
|
|
28
|
-
/* --------------------------------------------- */
|
|
29
|
-
|
|
30
|
-
export interface AcceptedResponse {
|
|
31
|
-
submission_status: 'ACCEPTED'
|
|
32
|
-
|
|
33
|
-
// explicitly forbid reject field
|
|
34
|
-
rejection_message?: never
|
|
35
|
-
|
|
36
|
-
validation: ValidationResult
|
|
37
|
-
|
|
38
|
-
overall_grade: number // 1.0–10.0
|
|
39
|
-
|
|
40
|
-
front_subgrades: SubGrades
|
|
41
|
-
back_subgrades: SubGrades
|
|
42
|
-
|
|
43
|
-
environment_score: number // 0–100
|
|
44
|
-
accuracy_score: number // 0–100
|
|
45
|
-
|
|
46
|
-
grading_rationale: string
|
|
47
|
-
|
|
48
|
-
defect_map: DefectMap
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* --------------------------------------------- */
|
|
52
|
-
/* Validation */
|
|
53
|
-
/* --------------------------------------------- */
|
|
1
|
+
// --------------------
|
|
2
|
+
// Validation
|
|
3
|
+
// --------------------
|
|
54
4
|
|
|
55
5
|
type SameCardConfidence = 'high' | 'medium' | 'low'
|
|
56
6
|
type ImageQuality = 'good' | 'borderline' | 'poor'
|
|
57
7
|
|
|
8
|
+
// --------------------
|
|
9
|
+
// Validation block
|
|
10
|
+
// --------------------
|
|
11
|
+
|
|
58
12
|
interface ValidationResult {
|
|
59
13
|
front_back_valid: boolean
|
|
60
14
|
same_card_confidence: SameCardConfidence
|
|
@@ -62,24 +16,29 @@ interface ValidationResult {
|
|
|
62
16
|
damage_override_triggered: boolean
|
|
63
17
|
}
|
|
64
18
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
19
|
+
// --------------------
|
|
20
|
+
// Subgrades
|
|
21
|
+
// --------------------
|
|
68
22
|
|
|
69
23
|
export interface SubGrades {
|
|
70
|
-
centering: number
|
|
24
|
+
centering: number
|
|
71
25
|
surface: number
|
|
72
26
|
edges: number
|
|
73
27
|
corners: number
|
|
74
28
|
}
|
|
75
29
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
30
|
+
// --------------------
|
|
31
|
+
// Defect Models
|
|
32
|
+
// --------------------
|
|
79
33
|
|
|
80
|
-
|
|
34
|
+
interface BBox {
|
|
35
|
+
x: number
|
|
36
|
+
y: number
|
|
37
|
+
width: number
|
|
38
|
+
height: number
|
|
39
|
+
}
|
|
81
40
|
|
|
82
|
-
|
|
41
|
+
type DefectType =
|
|
83
42
|
| 'corner_whitening'
|
|
84
43
|
| 'edge_whitening'
|
|
85
44
|
| 'surface_scratch'
|
|
@@ -92,40 +51,14 @@ export type DefectType =
|
|
|
92
51
|
| 'post_factory_dents'
|
|
93
52
|
| 'scuffing'
|
|
94
53
|
|
|
95
|
-
|
|
96
|
-
x: number // 0.0–1.0
|
|
97
|
-
y: number // 0.0–1.0
|
|
98
|
-
width: number // ≥0.01
|
|
99
|
-
height: number // ≥0.01
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface Defect {
|
|
103
|
-
defect_type: DefectType
|
|
104
|
-
severity: DefectSeverity
|
|
105
|
-
confidence: number // 0–1 recommended
|
|
106
|
-
location_zone: LocationZone
|
|
107
|
-
bbox_norm: BoundingBox
|
|
108
|
-
notes: string
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface DefectMap {
|
|
112
|
-
front: Defect[]
|
|
113
|
-
back: Defect[]
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/* --------------------------------------------- */
|
|
117
|
-
/* LOCATION ZONES */
|
|
118
|
-
/* --------------------------------------------- */
|
|
54
|
+
type DefectSeverity = 'minimal' | 'moderate' | 'major'
|
|
119
55
|
|
|
120
|
-
|
|
56
|
+
type DefectLocationZone =
|
|
57
|
+
// ---- FRONT ----
|
|
121
58
|
| 'front_top_left_corner'
|
|
122
59
|
| 'front_top_right_corner'
|
|
123
60
|
| 'front_bottom_left_corner'
|
|
124
61
|
| 'front_bottom_right_corner'
|
|
125
|
-
| 'back_top_left_corner'
|
|
126
|
-
| 'back_top_right_corner'
|
|
127
|
-
| 'back_bottom_left_corner'
|
|
128
|
-
| 'back_bottom_right_corner'
|
|
129
62
|
| 'front_top_edge_left'
|
|
130
63
|
| 'front_top_edge_center'
|
|
131
64
|
| 'front_top_edge_right'
|
|
@@ -138,6 +71,21 @@ export type LocationZone =
|
|
|
138
71
|
| 'front_right_edge_upper'
|
|
139
72
|
| 'front_right_edge_center'
|
|
140
73
|
| '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
|
+
|
|
84
|
+
// ---- BACK ----
|
|
85
|
+
| 'back_top_left_corner'
|
|
86
|
+
| 'back_top_right_corner'
|
|
87
|
+
| 'back_bottom_left_corner'
|
|
88
|
+
| 'back_bottom_right_corner'
|
|
141
89
|
| 'back_top_edge_left'
|
|
142
90
|
| 'back_top_edge_center'
|
|
143
91
|
| 'back_top_edge_right'
|
|
@@ -150,15 +98,6 @@ export type LocationZone =
|
|
|
150
98
|
| 'back_right_edge_upper'
|
|
151
99
|
| 'back_right_edge_center'
|
|
152
100
|
| 'back_right_edge_lower'
|
|
153
|
-
| 'front_inner_top_left'
|
|
154
|
-
| 'front_inner_top_center'
|
|
155
|
-
| 'front_inner_top_right'
|
|
156
|
-
| 'front_inner_middle_left'
|
|
157
|
-
| 'front_inner_middle_center'
|
|
158
|
-
| 'front_inner_middle_right'
|
|
159
|
-
| 'front_inner_bottom_left'
|
|
160
|
-
| 'front_inner_bottom_center'
|
|
161
|
-
| 'front_inner_bottom_right'
|
|
162
101
|
| 'back_inner_top_left'
|
|
163
102
|
| 'back_inner_top_center'
|
|
164
103
|
| 'back_inner_top_right'
|
|
@@ -169,8 +108,36 @@ export type LocationZone =
|
|
|
169
108
|
| 'back_inner_bottom_center'
|
|
170
109
|
| 'back_inner_bottom_right'
|
|
171
110
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
111
|
+
interface Defect {
|
|
112
|
+
defect_type: DefectType
|
|
113
|
+
severity: DefectSeverity
|
|
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
|
+
// --------------------
|
|
128
|
+
|
|
129
|
+
export interface PromptGradingResult {
|
|
130
|
+
validation: ValidationResult
|
|
175
131
|
|
|
176
|
-
|
|
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
|
+
}
|