@proofhound/api-client 0.1.13 → 0.1.15
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/dataset-import.d.ts +124 -37
- package/dist/dataset-import.d.ts.map +1 -1
- package/dist/dataset-import.js +16 -6
- package/dist/dataset-import.js.map +1 -1
- package/package.json +2 -2
package/dist/dataset-import.d.ts
CHANGED
|
@@ -1,74 +1,161 @@
|
|
|
1
|
-
import type { CreateDatasetImportDto, DatasetImportBatchDto } from '@proofhound/shared';
|
|
1
|
+
import type { CreateDatasetImportDto, CreateRawDatasetImportDto, DatasetImportBatchDto, DatasetRawUploadSessionDto } from '@proofhound/shared';
|
|
2
2
|
export declare const datasetImportClient: {
|
|
3
3
|
getDatasetImport: (projectId: string, importId: string) => Promise<{
|
|
4
4
|
id: string;
|
|
5
5
|
projectId: string;
|
|
6
6
|
datasetId: string | null;
|
|
7
|
+
importMode: "batch" | "raw_object";
|
|
7
8
|
name: string;
|
|
8
9
|
description: string | null;
|
|
9
10
|
fileName: string;
|
|
10
11
|
fileSizeBytes: number;
|
|
11
|
-
sourceFormat: "csv" | "jsonl" | "tsv";
|
|
12
|
+
sourceFormat: "json" | "csv" | "jsonl" | "tsv" | "zip";
|
|
12
13
|
declaredTotalRows: number | null;
|
|
13
14
|
receivedRows: number;
|
|
14
|
-
status: "importing" | "
|
|
15
|
+
status: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
15
16
|
createdAt: string;
|
|
16
17
|
updatedAt: string;
|
|
18
|
+
state: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
19
|
+
progress: {
|
|
20
|
+
state: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
21
|
+
uploadedBytes: number | null;
|
|
22
|
+
parsedRows: number;
|
|
23
|
+
importedRows: number;
|
|
24
|
+
totalRows: number | null;
|
|
25
|
+
totalBytes: number | null;
|
|
26
|
+
percentage: number | null;
|
|
27
|
+
};
|
|
28
|
+
errorCode: string | null;
|
|
29
|
+
errorMessage: string | null;
|
|
30
|
+
jobId: string | null;
|
|
31
|
+
rawUploadCompletedAt: string | null;
|
|
32
|
+
queuedAt: string | null;
|
|
33
|
+
startedAt: string | null;
|
|
34
|
+
completedAt: string | null;
|
|
35
|
+
failedAt: string | null;
|
|
36
|
+
abortedAt: string | null;
|
|
37
|
+
}>;
|
|
38
|
+
getRawImportCapabilities: (_projectId: string) => Promise<{
|
|
39
|
+
supported: boolean;
|
|
40
|
+
maxBytes: number;
|
|
17
41
|
}>;
|
|
18
42
|
createDatasetImport: (projectId: string, body: CreateDatasetImportDto) => Promise<{
|
|
19
43
|
id: string;
|
|
20
44
|
projectId: string;
|
|
21
45
|
datasetId: string | null;
|
|
46
|
+
importMode: "batch" | "raw_object";
|
|
22
47
|
name: string;
|
|
23
48
|
description: string | null;
|
|
24
49
|
fileName: string;
|
|
25
50
|
fileSizeBytes: number;
|
|
26
|
-
sourceFormat: "csv" | "jsonl" | "tsv";
|
|
51
|
+
sourceFormat: "json" | "csv" | "jsonl" | "tsv" | "zip";
|
|
27
52
|
declaredTotalRows: number | null;
|
|
28
53
|
receivedRows: number;
|
|
29
|
-
status: "importing" | "
|
|
54
|
+
status: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
30
55
|
createdAt: string;
|
|
31
56
|
updatedAt: string;
|
|
32
57
|
}>;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
receivedRows: number;
|
|
36
|
-
}>;
|
|
37
|
-
completeDatasetImport: (projectId: string, importId: string) => Promise<{
|
|
38
|
-
dataset: {
|
|
58
|
+
createRawDatasetImport: (projectId: string, body: CreateRawDatasetImportDto) => Promise<{
|
|
59
|
+
import: {
|
|
39
60
|
id: string;
|
|
40
61
|
projectId: string;
|
|
62
|
+
datasetId: string | null;
|
|
63
|
+
importMode: "batch" | "raw_object";
|
|
41
64
|
name: string;
|
|
42
|
-
status: "active" | "archived";
|
|
43
65
|
description: string | null;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
categoryDistribution: {
|
|
51
|
-
field: string | null;
|
|
52
|
-
total: number;
|
|
53
|
-
categories: {
|
|
54
|
-
label: string;
|
|
55
|
-
count: number;
|
|
56
|
-
}[];
|
|
57
|
-
};
|
|
58
|
-
references: {
|
|
59
|
-
experiments: number;
|
|
60
|
-
optimizations: number;
|
|
61
|
-
};
|
|
62
|
-
hasImages: boolean;
|
|
63
|
-
storagePrefix: string | null;
|
|
64
|
-
createdBy: string;
|
|
65
|
-
createdByDisplayName: string | null;
|
|
66
|
+
fileName: string;
|
|
67
|
+
fileSizeBytes: number;
|
|
68
|
+
sourceFormat: "json" | "csv" | "jsonl" | "tsv" | "zip";
|
|
69
|
+
declaredTotalRows: number | null;
|
|
70
|
+
receivedRows: number;
|
|
71
|
+
status: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
66
72
|
createdAt: string;
|
|
67
73
|
updatedAt: string;
|
|
68
|
-
archivedAt: string | null;
|
|
69
|
-
deletedAt: string | null;
|
|
70
74
|
};
|
|
71
|
-
|
|
75
|
+
uploadSession: {
|
|
76
|
+
sessionId: string;
|
|
77
|
+
url: string;
|
|
78
|
+
expiresAt: string;
|
|
79
|
+
headers?: Record<string, string> | undefined;
|
|
80
|
+
};
|
|
81
|
+
maxBytes: number;
|
|
82
|
+
}>;
|
|
83
|
+
uploadRawDatasetFile: (uploadSession: DatasetRawUploadSessionDto, file: Blob, options?: {
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
}) => Promise<void>;
|
|
86
|
+
appendDatasetImportBatch: (projectId: string, importId: string, body: DatasetImportBatchDto) => Promise<{
|
|
87
|
+
importId: string;
|
|
88
|
+
receivedRows: number;
|
|
89
|
+
}>;
|
|
90
|
+
completeRawDatasetUpload: (projectId: string, importId: string) => Promise<{
|
|
91
|
+
id: string;
|
|
92
|
+
projectId: string;
|
|
93
|
+
datasetId: string | null;
|
|
94
|
+
importMode: "batch" | "raw_object";
|
|
95
|
+
name: string;
|
|
96
|
+
description: string | null;
|
|
97
|
+
fileName: string;
|
|
98
|
+
fileSizeBytes: number;
|
|
99
|
+
sourceFormat: "json" | "csv" | "jsonl" | "tsv" | "zip";
|
|
100
|
+
declaredTotalRows: number | null;
|
|
101
|
+
receivedRows: number;
|
|
102
|
+
status: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
103
|
+
createdAt: string;
|
|
104
|
+
updatedAt: string;
|
|
105
|
+
state: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
106
|
+
progress: {
|
|
107
|
+
state: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
108
|
+
uploadedBytes: number | null;
|
|
109
|
+
parsedRows: number;
|
|
110
|
+
importedRows: number;
|
|
111
|
+
totalRows: number | null;
|
|
112
|
+
totalBytes: number | null;
|
|
113
|
+
percentage: number | null;
|
|
114
|
+
};
|
|
115
|
+
errorCode: string | null;
|
|
116
|
+
errorMessage: string | null;
|
|
117
|
+
jobId: string | null;
|
|
118
|
+
rawUploadCompletedAt: string | null;
|
|
119
|
+
queuedAt: string | null;
|
|
120
|
+
startedAt: string | null;
|
|
121
|
+
completedAt: string | null;
|
|
122
|
+
failedAt: string | null;
|
|
123
|
+
abortedAt: string | null;
|
|
124
|
+
}>;
|
|
125
|
+
completeDatasetImport: (projectId: string, importId: string) => Promise<{
|
|
126
|
+
id: string;
|
|
127
|
+
projectId: string;
|
|
128
|
+
datasetId: string | null;
|
|
129
|
+
importMode: "batch" | "raw_object";
|
|
130
|
+
name: string;
|
|
131
|
+
description: string | null;
|
|
132
|
+
fileName: string;
|
|
133
|
+
fileSizeBytes: number;
|
|
134
|
+
sourceFormat: "json" | "csv" | "jsonl" | "tsv" | "zip";
|
|
135
|
+
declaredTotalRows: number | null;
|
|
136
|
+
receivedRows: number;
|
|
137
|
+
status: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
138
|
+
createdAt: string;
|
|
139
|
+
updatedAt: string;
|
|
140
|
+
state: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
141
|
+
progress: {
|
|
142
|
+
state: "completed" | "failed" | "created" | "uploading" | "uploaded" | "queued" | "parsing" | "importing" | "aborted";
|
|
143
|
+
uploadedBytes: number | null;
|
|
144
|
+
parsedRows: number;
|
|
145
|
+
importedRows: number;
|
|
146
|
+
totalRows: number | null;
|
|
147
|
+
totalBytes: number | null;
|
|
148
|
+
percentage: number | null;
|
|
149
|
+
};
|
|
150
|
+
errorCode: string | null;
|
|
151
|
+
errorMessage: string | null;
|
|
152
|
+
jobId: string | null;
|
|
153
|
+
rawUploadCompletedAt: string | null;
|
|
154
|
+
queuedAt: string | null;
|
|
155
|
+
startedAt: string | null;
|
|
156
|
+
completedAt: string | null;
|
|
157
|
+
failedAt: string | null;
|
|
158
|
+
abortedAt: string | null;
|
|
72
159
|
}>;
|
|
73
160
|
abortDatasetImport: (projectId: string, importId: string) => Promise<undefined>;
|
|
74
161
|
abortDatasetImportBeacon: (projectId: string, importId: string) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataset-import.d.ts","sourceRoot":"","sources":["../src/dataset-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"dataset-import.d.ts","sourceRoot":"","sources":["../src/dataset-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,sBAAsB,EACtB,yBAAyB,EAEzB,qBAAqB,EAKrB,0BAA0B,EAC3B,MAAM,oBAAoB,CAAC;AAI5B,eAAO,MAAM,mBAAmB;kCACA,MAAM,YAAY,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAEf,MAAM;;;;qCAEZ,MAAM,QAAQ,sBAAsB;;;;;;;;;;;;;;;;wCAEjC,MAAM,QAAQ,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;0CAG1D,0BAA0B,QACnC,IAAI,YACA;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE;0CAYE,MAAM,YAAY,MAAM,QAAQ,qBAAqB;;;;0CAErD,MAAM,YAAY,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAE3B,MAAM,YAAY,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAE3B,MAAM,YAAY,MAAM;0CAKlB,MAAM,YAAY,MAAM,KAAG,OAAO;CAIzE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC"}
|
package/dist/dataset-import.js
CHANGED
|
@@ -5,13 +5,23 @@ const http_1 = require("./http");
|
|
|
5
5
|
const public_env_1 = require("./public-env");
|
|
6
6
|
exports.datasetImportClient = {
|
|
7
7
|
getDatasetImport: (projectId, importId) => http_1.httpClient.get(`/dataset-imports/${importId}`).then((r) => r.data),
|
|
8
|
+
getRawImportCapabilities: (_projectId) => http_1.httpClient.get(`/dataset-imports/raw/capabilities`).then((r) => r.data),
|
|
8
9
|
createDatasetImport: (projectId, body) => http_1.httpClient.post(`/dataset-imports`, body).then((r) => r.data),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
createRawDatasetImport: (projectId, body) => http_1.httpClient.post(`/dataset-imports/raw`, body).then((r) => r.data),
|
|
11
|
+
uploadRawDatasetFile: async (uploadSession, file, options) => {
|
|
12
|
+
const response = await fetch(uploadSession.url, {
|
|
13
|
+
method: 'PUT',
|
|
14
|
+
headers: uploadSession.headers,
|
|
15
|
+
body: file,
|
|
16
|
+
signal: options?.signal,
|
|
17
|
+
});
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
throw new Error(`dataset_raw_upload_failed:${response.status}`);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
appendDatasetImportBatch: (projectId, importId, body) => http_1.httpClient.post(`/dataset-imports/${importId}/batch`, body).then((r) => r.data),
|
|
23
|
+
completeRawDatasetUpload: (projectId, importId) => http_1.httpClient.post(`/dataset-imports/${importId}/upload-complete`, {}).then((r) => r.data),
|
|
24
|
+
completeDatasetImport: (projectId, importId) => http_1.httpClient.post(`/dataset-imports/${importId}/complete`, {}).then((r) => r.data),
|
|
15
25
|
abortDatasetImport: (projectId, importId) => http_1.httpClient.post(`/dataset-imports/${importId}/abort`, {}).then(() => undefined),
|
|
16
26
|
// Fire-and-forget abort that survives page unload (tab close / refresh), where a normal fetch is
|
|
17
27
|
// cancelled by the browser. Auth rides the same trusted-header / LOCAL_ACTOR path as other UI calls
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataset-import.js","sourceRoot":"","sources":["../src/dataset-import.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"dataset-import.js","sourceRoot":"","sources":["../src/dataset-import.ts"],"names":[],"mappings":";;;AAYA,iCAAoC;AACpC,6CAAgD;AAEnC,QAAA,mBAAmB,GAAG;IACjC,gBAAgB,EAAE,CAAC,SAAiB,EAAE,QAAgB,EAAE,EAAE,CACxD,iBAAU,CAAC,GAAG,CAAyB,oBAAoB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5F,wBAAwB,EAAE,CAAC,UAAkB,EAAE,EAAE,CAC/C,iBAAU,CAAC,GAAG,CAAkC,mCAAmC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CA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AAC;IACjH,qBAAqB,EAAE,CAAC,SAAiB,EAAE,QAAgB,EAAE,EAAE,CAC7D,iBAAU,CAAC,IAAI,CAAmC,oBAAoB,QAAQ,WAAW,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACpH,kBAAkB,EAAE,CAAC,SAAiB,EAAE,QAAgB,EAAE,EAAE,CAC1D,iBAAU,CAAC,IAAI,CAAO,oBAAoB,QAAQ,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;IACvF,iGAAiG;IACjG,oGAAoG;IACpG,mGAAmG;IACnG,wBAAwB,EAAE,CAAC,SAAiB,EAAE,QAAgB,EAAW,EAAE;QACzE,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QACjG,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,IAAA,6BAAgB,GAAE,oBAAoB,QAAQ,QAAQ,CAAC,CAAC;IACzF,CAAC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proofhound/api-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Frontend C1 layer: HTTP client, split by resource",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.16.1",
|
|
13
13
|
"zod": "^4.4.3",
|
|
14
|
-
"@proofhound/shared": "0.1.
|
|
14
|
+
"@proofhound/shared": "0.1.15"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "^24.12.4",
|