This repository was archived by the owner on Mar 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes.ts
175 lines (149 loc) · 3.5 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import ExtractionGraph from "./ExtractionGraph";
interface IBase {
id: string;
namespace: string;
}
interface IMetadata extends IBase {
name: string;
labels: Record<string, string>;
created_at: number;
}
export interface INamespace {
name: string;
extraction_graphs: ExtractionGraph[];
}
export interface IEmbeddingSchema {
distance: string;
dim: number;
}
export interface IExtractorSchema {
outputs: Record<string, IEmbeddingSchema | Record<string, any>>;
}
export interface IExtractor {
name: string;
input_mime_types: string[];
description: string;
input_params: Record<string, any>;
outputs: IExtractorSchema;
}
export interface ISchema extends IBase {
extraction_graph_name: string;
columns: Record<
string,
{
type: string;
comment?: string;
}
>;
}
export interface IIndex {
name: string;
schema: Record<string, string | number | boolean>;
}
export interface IBaseContentMetadata extends IMetadata {
parent_id: string;
ingested_content_id: string;
mime_type: string;
storage_url: string;
source: string;
size: number;
hash: string;
extraction_graph_names: string[];
}
export interface IContentMetadata extends IBaseContentMetadata {
content_url: string;
}
export interface IExtractedMetadata extends IBase {
content_id: string;
metadata: Record<string, any>;
extractor_name: string;
}
export interface IExtractionPolicy {
id?: string;
extractor: string;
name: string;
labels_eq?: string;
input_params?: Record<string, string | number>;
content_source?: string;
graph_name?: string;
}
export interface ITaskContentMetadata extends IMetadata {
parent_id: string;
root_content_id: string;
content_type: string;
storage_url: string;
source: string;
size_bytes: number;
tombstoned: boolean;
hash: string;
extraction_policy_ids: Record<string, number>;
}
export enum TaskStatus {
Unknown = 0,
Failure = 1,
Success = 2,
}
export interface ITask extends IBase {
extractor: string;
extraction_policy_id: string;
output_index_table_mapping: Record<string, string>;
content_metadata: ITaskContentMetadata;
input_params: Record<string, any>;
outcome: TaskStatus;
index_tables: string[];
}
export interface IDocument {
text: string;
labels: Record<string, string>;
id?: string;
}
export interface IFeature {
feature_type: "embedding" | "metadata" | "unknown";
name: string;
data: Record<string, any>;
}
export interface IContent {
content_type: string;
bytes: string | number[];
features?: IFeature[];
labels?: Record<string, string>;
}
export interface IContentResp extends Omit<IContent, 'bytes'> {
bytes: number[];
}
export interface IExtractResponse {
features: IFeature[];
content: IContentResp[];
}
export interface ISearchIndexResponse {
content_id: string;
text: string;
confidence_score: number;
labels: Record<string, string>;
content_metadata: IContentMetadata;
root_content_metadata?: IContentMetadata;
}
export interface IAddExtractorGraphResponse {
indexes: string[];
}
export interface IMtlsConfig {
certPath: string;
keyPath: string;
caPath?: string; // Optional, only if using a custom CA
}
export interface StateChange extends IBase {
change_type: string;
created_at: number;
processed_at: number;
refcnt_object_id: string | null;
}
export interface ExtractionPolicyStatus {
pending: number;
success: number;
failure: number;
}
export interface ExtractionGraphAnalytics {
task_analytics: {
[policyName: string]: ExtractionPolicyStatus;
};
}