dserver-client 0.0.0-stage → 0.1.0
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/CHANGELOG.md +56 -0
- package/LICENSE +21 -0
- package/README.md +346 -2
- package/dist/client.d.mts +714 -0
- package/dist/client.d.mts.map +1 -0
- package/dist/client.d.ts +714 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +962 -0
- package/dist/client.mjs +833 -0
- package/dist/client.mjs.map +1 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.mjs +1 -0
- package/dist/vue.d.mts +82 -0
- package/dist/vue.d.mts.map +1 -0
- package/dist/vue.d.ts +82 -0
- package/dist/vue.d.ts.map +1 -0
- package/dist/vue.js +307 -0
- package/dist/vue.mjs +306 -0
- package/dist/vue.mjs.map +1 -0
- package/package.json +94 -4
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for dserver signed URL API
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for the DServerClient
|
|
6
|
+
*/
|
|
7
|
+
interface DServerClientConfig {
|
|
8
|
+
/** Base URL of the dserver instance (e.g., "http://localhost:5000") */
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
/** JWT authentication token */
|
|
11
|
+
token?: string;
|
|
12
|
+
/** Optional fetch implementation (defaults to global fetch) */
|
|
13
|
+
fetch?: typeof fetch;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Response from the dataset signed URLs endpoint
|
|
17
|
+
*/
|
|
18
|
+
interface DatasetSignedURLsResponse {
|
|
19
|
+
/** Dataset URI */
|
|
20
|
+
uri: string;
|
|
21
|
+
/** URL expiry time in seconds */
|
|
22
|
+
expiry_seconds: number;
|
|
23
|
+
/** ISO format expiry timestamp */
|
|
24
|
+
expiry_timestamp: string;
|
|
25
|
+
/** Signed URL for admin metadata (dtool file) */
|
|
26
|
+
admin_metadata_url: string;
|
|
27
|
+
/** Signed URL for manifest.json */
|
|
28
|
+
manifest_url: string;
|
|
29
|
+
/** Signed URL for README.yml */
|
|
30
|
+
readme_url: string;
|
|
31
|
+
/** Map of item identifier to signed URL */
|
|
32
|
+
item_urls: Record<string, string>;
|
|
33
|
+
/** Map of overlay name to signed URL */
|
|
34
|
+
overlay_urls: Record<string, string>;
|
|
35
|
+
/** Map of annotation name to signed URL */
|
|
36
|
+
annotation_urls: Record<string, string>;
|
|
37
|
+
/** Dataset tags */
|
|
38
|
+
tags: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Response from the single item signed URL endpoint
|
|
42
|
+
*/
|
|
43
|
+
interface ItemSignedURLResponse {
|
|
44
|
+
/** Dataset URI */
|
|
45
|
+
uri: string;
|
|
46
|
+
/** Item identifier */
|
|
47
|
+
identifier: string;
|
|
48
|
+
/** URL expiry time in seconds */
|
|
49
|
+
expiry_seconds: number;
|
|
50
|
+
/** ISO format expiry timestamp */
|
|
51
|
+
expiry_timestamp: string;
|
|
52
|
+
/** Signed URL for the item */
|
|
53
|
+
url: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Item information for upload request - includes full metadata for server-side manifest generation
|
|
57
|
+
*/
|
|
58
|
+
interface UploadItem {
|
|
59
|
+
/** Relative path of the item within the dataset */
|
|
60
|
+
relpath: string;
|
|
61
|
+
/** Size of the item in bytes */
|
|
62
|
+
size_in_bytes: number;
|
|
63
|
+
/** Hash of the item content (MD5 hex digest) */
|
|
64
|
+
hash: string;
|
|
65
|
+
/** UTC timestamp of the item */
|
|
66
|
+
utc_timestamp: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Request body for getting upload URLs.
|
|
70
|
+
* The server uses this metadata to create admin_metadata, manifest, structure,
|
|
71
|
+
* tags, and annotations directly in storage. Only README and items need
|
|
72
|
+
* separate uploads via signed URLs.
|
|
73
|
+
*/
|
|
74
|
+
interface UploadRequest {
|
|
75
|
+
/** Dataset UUID */
|
|
76
|
+
uuid: string;
|
|
77
|
+
/** Dataset name */
|
|
78
|
+
name: string;
|
|
79
|
+
/** Username of the dataset creator */
|
|
80
|
+
creator_username: string;
|
|
81
|
+
/** UTC timestamp when dataset was frozen */
|
|
82
|
+
frozen_at: number;
|
|
83
|
+
/** List of items with full metadata */
|
|
84
|
+
items?: UploadItem[];
|
|
85
|
+
/** Dataset tags */
|
|
86
|
+
tags?: string[];
|
|
87
|
+
/** Dataset annotations as key-value pairs */
|
|
88
|
+
annotations?: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Upload URL information for a single item
|
|
92
|
+
*/
|
|
93
|
+
interface UploadItemURL {
|
|
94
|
+
/** Signed URL for uploading the item */
|
|
95
|
+
url: string;
|
|
96
|
+
/** Relative path of the item */
|
|
97
|
+
relpath: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Upload URLs for dataset files.
|
|
101
|
+
* Only includes URLs for README and items - other metadata is written
|
|
102
|
+
* directly by the server.
|
|
103
|
+
*/
|
|
104
|
+
interface UploadURLs {
|
|
105
|
+
/** Signed URL for README */
|
|
106
|
+
readme: string;
|
|
107
|
+
/** Map of item identifier to upload URL info */
|
|
108
|
+
items: Record<string, UploadItemURL>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Response from the upload URLs endpoint
|
|
112
|
+
*/
|
|
113
|
+
interface UploadURLsResponse {
|
|
114
|
+
/** Dataset UUID */
|
|
115
|
+
uuid: string;
|
|
116
|
+
/** Full dataset URI */
|
|
117
|
+
uri: string;
|
|
118
|
+
/** Base URI */
|
|
119
|
+
base_uri: string;
|
|
120
|
+
/** URL expiry time in seconds */
|
|
121
|
+
expiry_seconds: number;
|
|
122
|
+
/** ISO format expiry timestamp */
|
|
123
|
+
expiry_timestamp: string;
|
|
124
|
+
/** Upload URLs for all dataset components */
|
|
125
|
+
upload_urls: UploadURLs;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Request body for signaling upload completion
|
|
129
|
+
*/
|
|
130
|
+
interface UploadCompleteRequest {
|
|
131
|
+
/** Dataset URI */
|
|
132
|
+
uri: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Response from the upload complete endpoint
|
|
136
|
+
*/
|
|
137
|
+
interface UploadCompleteResponse {
|
|
138
|
+
/** Dataset URI */
|
|
139
|
+
uri: string;
|
|
140
|
+
/** Registration status */
|
|
141
|
+
status: string;
|
|
142
|
+
/** Dataset name */
|
|
143
|
+
name: string;
|
|
144
|
+
/** Dataset UUID */
|
|
145
|
+
uuid: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* dtool dataset admin metadata
|
|
149
|
+
*/
|
|
150
|
+
interface AdminMetadata {
|
|
151
|
+
uuid: string;
|
|
152
|
+
name: string;
|
|
153
|
+
type: "dataset" | "protodataset";
|
|
154
|
+
creator_username: string;
|
|
155
|
+
created_at?: number;
|
|
156
|
+
frozen_at?: number;
|
|
157
|
+
[key: string]: unknown;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* dtool manifest item
|
|
161
|
+
*/
|
|
162
|
+
interface ManifestItem {
|
|
163
|
+
hash: string;
|
|
164
|
+
relpath: string;
|
|
165
|
+
size_in_bytes: number;
|
|
166
|
+
utc_timestamp: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* dtool dataset manifest
|
|
170
|
+
*/
|
|
171
|
+
interface Manifest {
|
|
172
|
+
dtoolcore_version: string;
|
|
173
|
+
hash_function: string;
|
|
174
|
+
items: Record<string, ManifestItem>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Progress callback for download/upload operations
|
|
178
|
+
*/
|
|
179
|
+
interface ProgressCallback {
|
|
180
|
+
(loaded: number, total: number, item?: string): void;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Options for download operations
|
|
184
|
+
*/
|
|
185
|
+
interface DownloadOptions {
|
|
186
|
+
/** Progress callback */
|
|
187
|
+
onProgress?: ProgressCallback;
|
|
188
|
+
/** AbortSignal for cancellation */
|
|
189
|
+
signal?: AbortSignal;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Options for upload operations
|
|
193
|
+
*/
|
|
194
|
+
interface UploadOptions {
|
|
195
|
+
/** Progress callback */
|
|
196
|
+
onProgress?: ProgressCallback;
|
|
197
|
+
/** AbortSignal for cancellation */
|
|
198
|
+
signal?: AbortSignal;
|
|
199
|
+
/** Dataset README content (YAML string) */
|
|
200
|
+
readme?: string;
|
|
201
|
+
/** Dataset annotations */
|
|
202
|
+
annotations?: Record<string, unknown>;
|
|
203
|
+
/** Dataset tags */
|
|
204
|
+
tags?: string[];
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* File to upload with its content
|
|
208
|
+
*/
|
|
209
|
+
interface FileToUpload {
|
|
210
|
+
/** Relative path within the dataset */
|
|
211
|
+
relpath: string;
|
|
212
|
+
/** File content as Blob, ArrayBuffer, or string */
|
|
213
|
+
content: Blob | ArrayBuffer | string;
|
|
214
|
+
/** Optional MIME type */
|
|
215
|
+
contentType?: string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Error thrown by the dserver client
|
|
219
|
+
*/
|
|
220
|
+
declare class DServerError extends Error {
|
|
221
|
+
readonly status?: number | undefined;
|
|
222
|
+
readonly statusText?: string | undefined;
|
|
223
|
+
readonly body?: unknown | undefined;
|
|
224
|
+
constructor(message: string, status?: number | undefined, statusText?: string | undefined, body?: unknown | undefined);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Error thrown when authentication fails
|
|
228
|
+
*/
|
|
229
|
+
declare class AuthenticationError extends DServerError {
|
|
230
|
+
constructor(message?: string, body?: unknown);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Error thrown when authorization fails
|
|
234
|
+
*/
|
|
235
|
+
declare class AuthorizationError extends DServerError {
|
|
236
|
+
constructor(message?: string, body?: unknown);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Error thrown when a resource is not found
|
|
240
|
+
*/
|
|
241
|
+
declare class NotFoundError extends DServerError {
|
|
242
|
+
constructor(message?: string, body?: unknown);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Dataset entry returned from search/list endpoints
|
|
246
|
+
*/
|
|
247
|
+
interface DatasetEntry {
|
|
248
|
+
uuid: string;
|
|
249
|
+
uri: string;
|
|
250
|
+
base_uri: string;
|
|
251
|
+
name: string;
|
|
252
|
+
creator_username: string;
|
|
253
|
+
created_at: number;
|
|
254
|
+
frozen_at: number;
|
|
255
|
+
tags?: string[];
|
|
256
|
+
number_of_items?: number;
|
|
257
|
+
size_in_bytes?: number;
|
|
258
|
+
/** Authenticated identity that registered the dataset (server-asserted). */
|
|
259
|
+
uploaded_by?: string | null;
|
|
260
|
+
/** Unix timestamp of the registration. */
|
|
261
|
+
uploaded_at?: number | null;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Search query parameters
|
|
265
|
+
*/
|
|
266
|
+
interface SearchQuery {
|
|
267
|
+
free_text?: string;
|
|
268
|
+
creator_usernames?: string[];
|
|
269
|
+
base_uris?: string[];
|
|
270
|
+
uuids?: string[];
|
|
271
|
+
tags?: string[];
|
|
272
|
+
/** Authenticated identities that registered the datasets (server-asserted). */
|
|
273
|
+
uploaded_by?: string[];
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Pagination parameters for search
|
|
277
|
+
*/
|
|
278
|
+
interface PaginationParams {
|
|
279
|
+
page?: number;
|
|
280
|
+
page_size?: number;
|
|
281
|
+
sort?: string;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Pagination info returned in headers
|
|
285
|
+
*/
|
|
286
|
+
interface PaginationInfo {
|
|
287
|
+
total: number;
|
|
288
|
+
page: number;
|
|
289
|
+
per_page: number;
|
|
290
|
+
pages: number;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Response with pagination
|
|
294
|
+
*/
|
|
295
|
+
interface PaginatedResponse<T> {
|
|
296
|
+
data: T[];
|
|
297
|
+
pagination: PaginationInfo;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Server config versions
|
|
301
|
+
*/
|
|
302
|
+
interface ServerVersions {
|
|
303
|
+
dservercore?: string;
|
|
304
|
+
dserver_search_plugin_mongo?: string;
|
|
305
|
+
dserver_retrieve_plugin_mongo?: string;
|
|
306
|
+
dserver_direct_mongo_plugin?: string;
|
|
307
|
+
dserver_signed_url_plugin?: string;
|
|
308
|
+
dserver_dependency_graph_plugin?: string;
|
|
309
|
+
dserver_notification_plugin?: string;
|
|
310
|
+
[key: string]: string | undefined;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Tags response
|
|
314
|
+
*/
|
|
315
|
+
interface TagsResponse {
|
|
316
|
+
tags: string[];
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Annotations response (key-value pairs)
|
|
320
|
+
*/
|
|
321
|
+
interface AnnotationsResponse {
|
|
322
|
+
annotations: Record<string, unknown>;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Readme response
|
|
326
|
+
*/
|
|
327
|
+
interface ReadmeResponse {
|
|
328
|
+
readme: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Manifest response from REST API
|
|
332
|
+
*/
|
|
333
|
+
interface ManifestResponse {
|
|
334
|
+
dtoolcore_version: string;
|
|
335
|
+
hash_function: string;
|
|
336
|
+
items: Record<string, ManifestItem>;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Authenticated user info (response of GET /me).
|
|
340
|
+
*/
|
|
341
|
+
interface UserWithPermissions {
|
|
342
|
+
username: string | null;
|
|
343
|
+
is_admin: boolean;
|
|
344
|
+
register_permissions_on_base_uris: string[];
|
|
345
|
+
search_permissions_on_base_uris: string[];
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* User summary info
|
|
349
|
+
*/
|
|
350
|
+
interface SummaryInfo {
|
|
351
|
+
number_of_datasets: number;
|
|
352
|
+
total_size_in_bytes: number;
|
|
353
|
+
creator_usernames: string[];
|
|
354
|
+
base_uris: string[];
|
|
355
|
+
tags: string[];
|
|
356
|
+
datasets_per_creator: Record<string, number>;
|
|
357
|
+
datasets_per_base_uri: Record<string, number>;
|
|
358
|
+
datasets_per_tag: Record<string, number>;
|
|
359
|
+
size_in_bytes_per_creator: Record<string, number>;
|
|
360
|
+
size_in_bytes_per_base_uri: Record<string, number>;
|
|
361
|
+
size_in_bytes_per_tag: Record<string, number>;
|
|
362
|
+
/** Authenticated identities that registered datasets (server-asserted). */
|
|
363
|
+
uploaders?: string[];
|
|
364
|
+
datasets_per_uploader?: Record<string, number>;
|
|
365
|
+
size_in_bytes_per_uploader?: Record<string, number>;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* User information returned from user endpoints
|
|
369
|
+
*/
|
|
370
|
+
interface UserInfo {
|
|
371
|
+
username: string;
|
|
372
|
+
display_name?: string | null;
|
|
373
|
+
is_admin: boolean;
|
|
374
|
+
search_permissions_on_base_uris: string[];
|
|
375
|
+
register_permissions_on_base_uris: string[];
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* User creation/update request (PUT - full replacement)
|
|
379
|
+
*/
|
|
380
|
+
interface UserRequest {
|
|
381
|
+
is_admin?: boolean;
|
|
382
|
+
display_name?: string | null;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* User partial update request (PATCH)
|
|
386
|
+
*/
|
|
387
|
+
interface UserUpdateRequest {
|
|
388
|
+
is_admin?: boolean;
|
|
389
|
+
display_name?: string | null;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Base URI information
|
|
393
|
+
*/
|
|
394
|
+
interface BaseURIInfo {
|
|
395
|
+
base_uri: string;
|
|
396
|
+
users_with_search_permissions: string[];
|
|
397
|
+
users_with_register_permissions: string[];
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Base URI permissions update request
|
|
401
|
+
*/
|
|
402
|
+
interface BaseURIPermissionsRequest {
|
|
403
|
+
users_with_search_permissions?: string[];
|
|
404
|
+
users_with_register_permissions?: string[];
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Dataset entry with dependency information from graph plugin.
|
|
408
|
+
* The derived_from field contains UUID strings of parent datasets.
|
|
409
|
+
*/
|
|
410
|
+
interface GraphDatasetEntry extends DatasetEntry {
|
|
411
|
+
/** UUIDs of datasets this dataset is derived from (as string array) */
|
|
412
|
+
derived_from?: string[];
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Client for interacting with dserver's signed URL API
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```typescript
|
|
419
|
+
* const client = new DServerClient({
|
|
420
|
+
* baseUrl: "http://localhost:5000",
|
|
421
|
+
* token: "your-jwt-token"
|
|
422
|
+
* });
|
|
423
|
+
*
|
|
424
|
+
* // Get signed URLs for a dataset
|
|
425
|
+
* const urls = await client.getDatasetSignedUrls("s3://bucket/uuid");
|
|
426
|
+
*
|
|
427
|
+
* // Download an item
|
|
428
|
+
* const content = await client.downloadItem(urls, "item-identifier");
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
declare class DServerClient {
|
|
432
|
+
private baseUrl;
|
|
433
|
+
private token?;
|
|
434
|
+
private fetchImpl;
|
|
435
|
+
constructor(config: DServerClientConfig);
|
|
436
|
+
/**
|
|
437
|
+
* Set or update the authentication token
|
|
438
|
+
*/
|
|
439
|
+
setToken(token: string): void;
|
|
440
|
+
/**
|
|
441
|
+
* Get authorization headers
|
|
442
|
+
*/
|
|
443
|
+
private getHeaders;
|
|
444
|
+
/**
|
|
445
|
+
* Make an authenticated request to dserver
|
|
446
|
+
*/
|
|
447
|
+
private request;
|
|
448
|
+
/**
|
|
449
|
+
* Get signed URLs for reading an entire dataset
|
|
450
|
+
*
|
|
451
|
+
* @param uri - Dataset URI (e.g., "s3://bucket/uuid")
|
|
452
|
+
* @returns Signed URLs for all dataset components
|
|
453
|
+
*/
|
|
454
|
+
getDatasetSignedUrls(uri: string): Promise<DatasetSignedURLsResponse>;
|
|
455
|
+
/**
|
|
456
|
+
* Get a signed URL for a single dataset item
|
|
457
|
+
*
|
|
458
|
+
* @param uri - Dataset URI
|
|
459
|
+
* @param identifier - Item identifier (SHA-1 hash of relpath)
|
|
460
|
+
* @returns Signed URL for the item
|
|
461
|
+
*/
|
|
462
|
+
getItemSignedUrl(uri: string, identifier: string): Promise<ItemSignedURLResponse>;
|
|
463
|
+
/**
|
|
464
|
+
* Get signed URLs for uploading a new dataset
|
|
465
|
+
*
|
|
466
|
+
* @param baseUri - Base URI (e.g., "s3://bucket")
|
|
467
|
+
* @param request - Upload request with UUID, name, and items
|
|
468
|
+
* @returns Signed URLs for uploading dataset components
|
|
469
|
+
*/
|
|
470
|
+
getUploadUrls(baseUri: string, request: UploadRequest): Promise<UploadURLsResponse>;
|
|
471
|
+
/**
|
|
472
|
+
* Signal that a dataset upload is complete
|
|
473
|
+
*
|
|
474
|
+
* @param uri - Dataset URI
|
|
475
|
+
* @returns Registration result
|
|
476
|
+
*/
|
|
477
|
+
signalUploadComplete(uri: string): Promise<UploadCompleteResponse>;
|
|
478
|
+
/**
|
|
479
|
+
* Download a dataset item using its signed URL
|
|
480
|
+
*
|
|
481
|
+
* @param urls - Signed URLs response from getDatasetSignedUrls
|
|
482
|
+
* @param identifier - Item identifier
|
|
483
|
+
* @param options - Download options
|
|
484
|
+
* @returns Item content as ArrayBuffer
|
|
485
|
+
*/
|
|
486
|
+
downloadItem(urls: DatasetSignedURLsResponse, identifier: string, options?: DownloadOptions): Promise<ArrayBuffer>;
|
|
487
|
+
/**
|
|
488
|
+
* Download and parse the dataset manifest
|
|
489
|
+
*
|
|
490
|
+
* @param urls - Signed URLs response
|
|
491
|
+
* @returns Parsed manifest
|
|
492
|
+
*/
|
|
493
|
+
downloadManifest(urls: DatasetSignedURLsResponse): Promise<Manifest>;
|
|
494
|
+
/**
|
|
495
|
+
* Download and parse the dataset admin metadata
|
|
496
|
+
*
|
|
497
|
+
* @param urls - Signed URLs response
|
|
498
|
+
* @returns Parsed admin metadata
|
|
499
|
+
*/
|
|
500
|
+
downloadAdminMetadata(urls: DatasetSignedURLsResponse): Promise<AdminMetadata>;
|
|
501
|
+
/**
|
|
502
|
+
* Download the dataset README
|
|
503
|
+
*
|
|
504
|
+
* @param urls - Signed URLs response
|
|
505
|
+
* @returns README content as string
|
|
506
|
+
*/
|
|
507
|
+
downloadReadme(urls: DatasetSignedURLsResponse): Promise<string>;
|
|
508
|
+
/**
|
|
509
|
+
* Download an overlay
|
|
510
|
+
*
|
|
511
|
+
* @param urls - Signed URLs response
|
|
512
|
+
* @param overlayName - Name of the overlay
|
|
513
|
+
* @returns Overlay data
|
|
514
|
+
*/
|
|
515
|
+
downloadOverlay(urls: DatasetSignedURLsResponse, overlayName: string): Promise<Record<string, unknown>>;
|
|
516
|
+
/**
|
|
517
|
+
* Download an annotation
|
|
518
|
+
*
|
|
519
|
+
* @param urls - Signed URLs response
|
|
520
|
+
* @param annotationName - Name of the annotation
|
|
521
|
+
* @returns Annotation value
|
|
522
|
+
*/
|
|
523
|
+
downloadAnnotation(urls: DatasetSignedURLsResponse, annotationName: string): Promise<unknown>;
|
|
524
|
+
/**
|
|
525
|
+
* Create and upload a new dataset
|
|
526
|
+
*
|
|
527
|
+
* The server handles admin_metadata, manifest, structure, tags, and annotations
|
|
528
|
+
* directly based on metadata sent in the upload request. We only need to upload
|
|
529
|
+
* README and item files.
|
|
530
|
+
*
|
|
531
|
+
* @param baseUri - Base URI (e.g., "s3://bucket")
|
|
532
|
+
* @param name - Dataset name
|
|
533
|
+
* @param files - Files to upload
|
|
534
|
+
* @param options - Upload options (readme, tags, annotations)
|
|
535
|
+
* @returns Upload completion response
|
|
536
|
+
*/
|
|
537
|
+
createDataset(baseUri: string, name: string, files: FileToUpload[], options?: UploadOptions): Promise<UploadCompleteResponse>;
|
|
538
|
+
/**
|
|
539
|
+
* Compute size and hash for a file item
|
|
540
|
+
*/
|
|
541
|
+
private computeItemMetadata;
|
|
542
|
+
/**
|
|
543
|
+
* Upload text data to a signed URL
|
|
544
|
+
*/
|
|
545
|
+
private uploadText;
|
|
546
|
+
/**
|
|
547
|
+
* Get server configuration versions
|
|
548
|
+
*/
|
|
549
|
+
getServerVersions(): Promise<ServerVersions>;
|
|
550
|
+
/**
|
|
551
|
+
* Check server health (no auth required)
|
|
552
|
+
*/
|
|
553
|
+
checkHealth(): Promise<{
|
|
554
|
+
status: string;
|
|
555
|
+
}>;
|
|
556
|
+
/**
|
|
557
|
+
* Get user summary info
|
|
558
|
+
*/
|
|
559
|
+
getUserSummary(username: string): Promise<SummaryInfo>;
|
|
560
|
+
/**
|
|
561
|
+
* Get information on the currently authenticated user.
|
|
562
|
+
*/
|
|
563
|
+
getMe(): Promise<UserWithPermissions>;
|
|
564
|
+
/**
|
|
565
|
+
* Get the summary for the currently authenticated user — no username needed.
|
|
566
|
+
*/
|
|
567
|
+
getMySummary(): Promise<SummaryInfo>;
|
|
568
|
+
/**
|
|
569
|
+
* Search datasets with pagination
|
|
570
|
+
*/
|
|
571
|
+
searchDatasets(query: SearchQuery, pagination?: PaginationParams): Promise<PaginatedResponse<DatasetEntry>>;
|
|
572
|
+
/**
|
|
573
|
+
* Read the error body and throw a typed error carrying the server's
|
|
574
|
+
* message so callers can surface the actual reason for the failure.
|
|
575
|
+
*/
|
|
576
|
+
private handleErrorResponse;
|
|
577
|
+
/**
|
|
578
|
+
* Get manifest for a dataset
|
|
579
|
+
*/
|
|
580
|
+
getManifest(uri: string): Promise<ManifestResponse>;
|
|
581
|
+
/**
|
|
582
|
+
* Get readme for a dataset
|
|
583
|
+
*/
|
|
584
|
+
getReadme(uri: string): Promise<ReadmeResponse>;
|
|
585
|
+
/**
|
|
586
|
+
* Set readme for a dataset
|
|
587
|
+
*/
|
|
588
|
+
setReadme(uri: string, content: string): Promise<ReadmeResponse>;
|
|
589
|
+
/**
|
|
590
|
+
* Get tags for a dataset
|
|
591
|
+
*/
|
|
592
|
+
getTags(uri: string): Promise<TagsResponse>;
|
|
593
|
+
/**
|
|
594
|
+
* Set all tags for a dataset (replaces existing)
|
|
595
|
+
*/
|
|
596
|
+
setTags(uri: string, tags: string[]): Promise<TagsResponse>;
|
|
597
|
+
/**
|
|
598
|
+
* Add a single tag to a dataset
|
|
599
|
+
*/
|
|
600
|
+
addTag(uri: string, tag: string): Promise<TagsResponse>;
|
|
601
|
+
/**
|
|
602
|
+
* Remove a single tag from a dataset
|
|
603
|
+
*/
|
|
604
|
+
removeTag(uri: string, tag: string): Promise<TagsResponse>;
|
|
605
|
+
/**
|
|
606
|
+
* Get annotations for a dataset
|
|
607
|
+
*/
|
|
608
|
+
getAnnotations(uri: string): Promise<AnnotationsResponse>;
|
|
609
|
+
/**
|
|
610
|
+
* Set all annotations for a dataset (replaces existing)
|
|
611
|
+
*/
|
|
612
|
+
setAnnotations(uri: string, annotations: Record<string, unknown>): Promise<AnnotationsResponse>;
|
|
613
|
+
/**
|
|
614
|
+
* Set a single annotation
|
|
615
|
+
*/
|
|
616
|
+
setAnnotation(uri: string, name: string, value: unknown): Promise<AnnotationsResponse>;
|
|
617
|
+
/**
|
|
618
|
+
* Delete a single annotation
|
|
619
|
+
*/
|
|
620
|
+
deleteAnnotation(uri: string, name: string): Promise<AnnotationsResponse>;
|
|
621
|
+
/**
|
|
622
|
+
* Get current user info (includes is_admin flag)
|
|
623
|
+
*/
|
|
624
|
+
getCurrentUser(): Promise<UserInfo>;
|
|
625
|
+
/**
|
|
626
|
+
* List all users (admin only)
|
|
627
|
+
*/
|
|
628
|
+
listUsers(): Promise<UserInfo[]>;
|
|
629
|
+
/**
|
|
630
|
+
* Get a specific user
|
|
631
|
+
*/
|
|
632
|
+
getUser(username: string): Promise<UserInfo>;
|
|
633
|
+
/**
|
|
634
|
+
* Create or register a new user (admin only)
|
|
635
|
+
* Note: dserver uses PUT for user creation/update (idempotent operation)
|
|
636
|
+
*/
|
|
637
|
+
createUser(username: string, options?: UserRequest): Promise<UserInfo>;
|
|
638
|
+
/**
|
|
639
|
+
* Delete a user (admin only)
|
|
640
|
+
*/
|
|
641
|
+
deleteUser(username: string): Promise<void>;
|
|
642
|
+
/**
|
|
643
|
+
* Update user fields (partial update, admin only)
|
|
644
|
+
*
|
|
645
|
+
* @param username - Username to update
|
|
646
|
+
* @param updates - Fields to update (is_admin, display_name)
|
|
647
|
+
* @returns Updated user info
|
|
648
|
+
*/
|
|
649
|
+
updateUser(username: string, updates: {
|
|
650
|
+
is_admin?: boolean;
|
|
651
|
+
display_name?: string | null;
|
|
652
|
+
}): Promise<UserInfo>;
|
|
653
|
+
/**
|
|
654
|
+
* Update user admin status (admin only)
|
|
655
|
+
* @deprecated Use updateUser() instead for more flexibility
|
|
656
|
+
*/
|
|
657
|
+
updateUserAdmin(username: string, isAdmin: boolean): Promise<UserInfo>;
|
|
658
|
+
/**
|
|
659
|
+
* List all base URIs (admin only)
|
|
660
|
+
*/
|
|
661
|
+
listBaseURIs(): Promise<BaseURIInfo[]>;
|
|
662
|
+
/**
|
|
663
|
+
* Get a specific base URI
|
|
664
|
+
*/
|
|
665
|
+
getBaseURI(baseUri: string): Promise<BaseURIInfo>;
|
|
666
|
+
/**
|
|
667
|
+
* Register a new base URI (admin only)
|
|
668
|
+
*/
|
|
669
|
+
createBaseURI(baseUri: string): Promise<BaseURIInfo>;
|
|
670
|
+
/**
|
|
671
|
+
* Delete a base URI (admin only)
|
|
672
|
+
*/
|
|
673
|
+
deleteBaseURI(baseUri: string): Promise<void>;
|
|
674
|
+
/**
|
|
675
|
+
* Grant search permission to a user on a base URI (admin only)
|
|
676
|
+
*/
|
|
677
|
+
grantSearchPermission(username: string, baseUri: string): Promise<UserInfo>;
|
|
678
|
+
/**
|
|
679
|
+
* Revoke search permission from a user on a base URI (admin only)
|
|
680
|
+
*/
|
|
681
|
+
revokeSearchPermission(username: string, baseUri: string): Promise<UserInfo>;
|
|
682
|
+
/**
|
|
683
|
+
* Grant register permission to a user on a base URI (admin only)
|
|
684
|
+
*/
|
|
685
|
+
grantRegisterPermission(username: string, baseUri: string): Promise<UserInfo>;
|
|
686
|
+
/**
|
|
687
|
+
* Revoke register permission from a user on a base URI (admin only)
|
|
688
|
+
*/
|
|
689
|
+
revokeRegisterPermission(username: string, baseUri: string): Promise<UserInfo>;
|
|
690
|
+
/**
|
|
691
|
+
* Get datasets by UUID
|
|
692
|
+
* Returns all instances of a dataset with that UUID across base URIs the user has access to
|
|
693
|
+
*
|
|
694
|
+
* @param uuid - Dataset UUID
|
|
695
|
+
* @returns Array of datasets with that UUID
|
|
696
|
+
*/
|
|
697
|
+
getDatasetsByUuid(uuid: string): Promise<DatasetEntry[]>;
|
|
698
|
+
/**
|
|
699
|
+
* Get the dependency graph of a dataset by UUID
|
|
700
|
+
* Returns all datasets in the same dependency graph (bidirectional traversal),
|
|
701
|
+
* fetching every page of the paginated response.
|
|
702
|
+
* Requires dserver-dependency-graph-plugin to be installed
|
|
703
|
+
*
|
|
704
|
+
* @param uuid - Dataset UUID
|
|
705
|
+
* @param dependencyKeys - Optional custom dependency keys (e.g.,
|
|
706
|
+
* ["readme_parsed.derived_from.uuid"]); honored only if the server allows
|
|
707
|
+
* dynamic dependency keys. Omit to use the server's keys.
|
|
708
|
+
* @returns Datasets in the dependency graph, each with derived_from: the
|
|
709
|
+
* UUIDs of its parents within the graph
|
|
710
|
+
*/
|
|
711
|
+
getDependencyGraph(uuid: string, dependencyKeys?: string[]): Promise<GraphDatasetEntry[]>;
|
|
712
|
+
}
|
|
713
|
+
export { UploadCompleteResponse as A, UserWithPermissions as B, ProgressCallback as C, SummaryInfo as D, ServerVersions as E, UploadURLs as F, UploadURLsResponse as I, UserInfo as L, UploadItemURL as M, UploadOptions as N, TagsResponse as O, UploadRequest as P, UserRequest as R, PaginationParams as S, SearchQuery as T, ManifestItem as _, AuthorizationError as a, PaginatedResponse as b, DServerClientConfig as c, DatasetSignedURLsResponse as d, DownloadOptions as f, Manifest as g, ItemSignedURLResponse as h, AuthenticationError as i, UploadItem as j, UploadCompleteRequest as k, DServerError as l, GraphDatasetEntry as m, AdminMetadata as n, BaseURIInfo as o, FileToUpload as p, AnnotationsResponse as r, BaseURIPermissionsRequest as s, DServerClient as t, DatasetEntry as u, ManifestResponse as v, ReadmeResponse as w, PaginationInfo as x, NotFoundError as y, UserUpdateRequest as z };
|
|
714
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../src/types.ts","../src/client.ts"],"mappings":";;;;;;UAOiB;;EAEf;;EAEA;;EAEA,eAAe;;;;;UAMA;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,WAAW;;EAEX,cAAc;;EAEd,iBAAiB;;EAEjB;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;;;UASe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;EAEA,cAAc;;;;;UAMC;;EAEf;;EAEA;;;;;;;UAQe;;EAEf;;EAEA,OAAO,eAAe;;;;;UAMP;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,aAAa;;;;;UAME;;EAEf;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;;;;UAMe;EACf;EACA;EACA;EACA;EACA;EACA;GACC;;;;;UAMc;EACf;EACA;EACA;EACA;;;;;UAMe;EACf;EACA;EACA,OAAO,eAAe;;;;;UAMP;GACd,gBAAgB,eAAe;;;;;UAMjB;;EAEf,aAAa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