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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../src/types.ts","../src/utils.ts","../src/client.ts"],"sourcesContent":["/**\n * Type definitions for dserver signed URL API\n */\n\n/**\n * Configuration options for the DServerClient\n */\nexport interface DServerClientConfig {\n /** Base URL of the dserver instance (e.g., \"http://localhost:5000\") */\n baseUrl: string;\n /** JWT authentication token */\n token?: string;\n /** Optional fetch implementation (defaults to global fetch) */\n fetch?: typeof fetch;\n}\n\n/**\n * Response from the dataset signed URLs endpoint\n */\nexport interface DatasetSignedURLsResponse {\n /** Dataset URI */\n uri: string;\n /** URL expiry time in seconds */\n expiry_seconds: number;\n /** ISO format expiry timestamp */\n expiry_timestamp: string;\n /** Signed URL for admin metadata (dtool file) */\n admin_metadata_url: string;\n /** Signed URL for manifest.json */\n manifest_url: string;\n /** Signed URL for README.yml */\n readme_url: string;\n /** Map of item identifier to signed URL */\n item_urls: Record<string, string>;\n /** Map of overlay name to signed URL */\n overlay_urls: Record<string, string>;\n /** Map of annotation name to signed URL */\n annotation_urls: Record<string, string>;\n /** Dataset tags */\n tags: string[];\n}\n\n/**\n * Response from the single item signed URL endpoint\n */\nexport interface ItemSignedURLResponse {\n /** Dataset URI */\n uri: string;\n /** Item identifier */\n identifier: string;\n /** URL expiry time in seconds */\n expiry_seconds: number;\n /** ISO format expiry timestamp */\n expiry_timestamp: string;\n /** Signed URL for the item */\n url: string;\n}\n\n/**\n * Item information for upload request - includes full metadata for server-side manifest generation\n */\nexport interface UploadItem {\n /** Relative path of the item within the dataset */\n relpath: string;\n /** Size of the item in bytes */\n size_in_bytes: number;\n /** Hash of the item content (MD5 hex digest) */\n hash: string;\n /** UTC timestamp of the item */\n utc_timestamp: number;\n}\n\n/**\n * Request body for getting upload URLs.\n * The server uses this metadata to create admin_metadata, manifest, structure,\n * tags, and annotations directly in storage. Only README and items need\n * separate uploads via signed URLs.\n */\nexport interface UploadRequest {\n /** Dataset UUID */\n uuid: string;\n /** Dataset name */\n name: string;\n /** Username of the dataset creator */\n creator_username: string;\n /** UTC timestamp when dataset was frozen */\n frozen_at: number;\n /** List of items with full metadata */\n items?: UploadItem[];\n /** Dataset tags */\n tags?: string[];\n /** Dataset annotations as key-value pairs */\n annotations?: Record<string, unknown>;\n}\n\n/**\n * Upload URL information for a single item\n */\nexport interface UploadItemURL {\n /** Signed URL for uploading the item */\n url: string;\n /** Relative path of the item */\n relpath: string;\n}\n\n/**\n * Upload URLs for dataset files.\n * Only includes URLs for README and items - other metadata is written\n * directly by the server.\n */\nexport interface UploadURLs {\n /** Signed URL for README */\n readme: string;\n /** Map of item identifier to upload URL info */\n items: Record<string, UploadItemURL>;\n}\n\n/**\n * Response from the upload URLs endpoint\n */\nexport interface UploadURLsResponse {\n /** Dataset UUID */\n uuid: string;\n /** Full dataset URI */\n uri: string;\n /** Base URI */\n base_uri: string;\n /** URL expiry time in seconds */\n expiry_seconds: number;\n /** ISO format expiry timestamp */\n expiry_timestamp: string;\n /** Upload URLs for all dataset components */\n upload_urls: UploadURLs;\n}\n\n/**\n * Request body for signaling upload completion\n */\nexport interface UploadCompleteRequest {\n /** Dataset URI */\n uri: string;\n}\n\n/**\n * Response from the upload complete endpoint\n */\nexport interface UploadCompleteResponse {\n /** Dataset URI */\n uri: string;\n /** Registration status */\n status: string;\n /** Dataset name */\n name: string;\n /** Dataset UUID */\n uuid: string;\n}\n\n/**\n * dtool dataset admin metadata\n */\nexport interface AdminMetadata {\n uuid: string;\n name: string;\n type: \"dataset\" | \"protodataset\";\n creator_username: string;\n created_at?: number;\n frozen_at?: number;\n [key: string]: unknown;\n}\n\n/**\n * dtool manifest item\n */\nexport interface ManifestItem {\n hash: string;\n relpath: string;\n size_in_bytes: number;\n utc_timestamp: number;\n}\n\n/**\n * dtool dataset manifest\n */\nexport interface Manifest {\n dtoolcore_version: string;\n hash_function: string;\n items: Record<string, ManifestItem>;\n}\n\n/**\n * Progress callback for download/upload operations\n */\nexport interface ProgressCallback {\n (loaded: number, total: number, item?: string): void;\n}\n\n/**\n * Options for download operations\n */\nexport interface DownloadOptions {\n /** Progress callback */\n onProgress?: ProgressCallback;\n /** AbortSignal for cancellation */\n signal?: AbortSignal;\n}\n\n/**\n * Options for upload operations\n */\nexport interface UploadOptions {\n /** Progress callback */\n onProgress?: ProgressCallback;\n /** AbortSignal for cancellation */\n signal?: AbortSignal;\n /** Dataset README content (YAML string) */\n readme?: string;\n /** Dataset annotations */\n annotations?: Record<string, unknown>;\n /** Dataset tags */\n tags?: string[];\n}\n\n/**\n * File to upload with its content\n */\nexport interface FileToUpload {\n /** Relative path within the dataset */\n relpath: string;\n /** File content as Blob, ArrayBuffer, or string */\n content: Blob | ArrayBuffer | string;\n /** Optional MIME type */\n contentType?: string;\n}\n\n/**\n * Error thrown by the dserver client\n */\nexport class DServerError extends Error {\n constructor(\n message: string,\n public readonly status?: number,\n public readonly statusText?: string,\n public readonly body?: unknown\n ) {\n super(message);\n this.name = \"DServerError\";\n }\n}\n\n/**\n * Error thrown when authentication fails\n */\nexport class AuthenticationError extends DServerError {\n constructor(message = \"Authentication failed\", body?: unknown) {\n super(message, 401, \"Unauthorized\", body);\n this.name = \"AuthenticationError\";\n }\n}\n\n/**\n * Error thrown when authorization fails\n */\nexport class AuthorizationError extends DServerError {\n constructor(message = \"Access denied\", body?: unknown) {\n super(message, 403, \"Forbidden\", body);\n this.name = \"AuthorizationError\";\n }\n}\n\n/**\n * Error thrown when a resource is not found\n */\nexport class NotFoundError extends DServerError {\n constructor(message = \"Resource not found\", body?: unknown) {\n super(message, 404, \"Not Found\", body);\n this.name = \"NotFoundError\";\n }\n}\n\n// =========================================================================\n// REST API Types (for standard dserver endpoints)\n// =========================================================================\n\n/**\n * Dataset entry returned from search/list endpoints\n */\nexport interface DatasetEntry {\n uuid: string;\n uri: string;\n base_uri: string;\n name: string;\n creator_username: string;\n created_at: number;\n frozen_at: number;\n tags?: string[];\n number_of_items?: number;\n size_in_bytes?: number;\n /** Authenticated identity that registered the dataset (server-asserted). */\n uploaded_by?: string | null;\n /** Unix timestamp of the registration. */\n uploaded_at?: number | null;\n}\n\n/**\n * Search query parameters\n */\nexport interface SearchQuery {\n free_text?: string;\n creator_usernames?: string[];\n base_uris?: string[];\n uuids?: string[];\n tags?: string[];\n /** Authenticated identities that registered the datasets (server-asserted). */\n uploaded_by?: string[];\n}\n\n/**\n * Pagination parameters for search\n */\nexport interface PaginationParams {\n page?: number;\n page_size?: number;\n sort?: string;\n}\n\n/**\n * Pagination info returned in headers\n */\nexport interface PaginationInfo {\n total: number;\n page: number;\n per_page: number;\n pages: number;\n}\n\n/**\n * Response with pagination\n */\nexport interface PaginatedResponse<T> {\n data: T[];\n pagination: PaginationInfo;\n}\n\n/**\n * Server config versions\n */\nexport interface ServerVersions {\n dservercore?: string;\n dserver_search_plugin_mongo?: string;\n dserver_retrieve_plugin_mongo?: string;\n dserver_direct_mongo_plugin?: string;\n dserver_signed_url_plugin?: string;\n dserver_dependency_graph_plugin?: string;\n dserver_notification_plugin?: string;\n [key: string]: string | undefined;\n}\n\n/**\n * Tags response\n */\nexport interface TagsResponse {\n tags: string[];\n}\n\n/**\n * Annotations response (key-value pairs)\n */\nexport interface AnnotationsResponse {\n annotations: Record<string, unknown>;\n}\n\n/**\n * Readme response\n */\nexport interface ReadmeResponse {\n readme: string;\n}\n\n/**\n * Manifest response from REST API\n */\nexport interface ManifestResponse {\n dtoolcore_version: string;\n hash_function: string;\n items: Record<string, ManifestItem>;\n}\n\n/**\n * Authenticated user info (response of GET /me).\n */\nexport interface UserWithPermissions {\n username: string | null;\n is_admin: boolean;\n register_permissions_on_base_uris: string[];\n search_permissions_on_base_uris: string[];\n}\n\n/**\n * User summary info\n */\nexport interface SummaryInfo {\n number_of_datasets: number;\n total_size_in_bytes: number;\n creator_usernames: string[];\n base_uris: string[];\n tags: string[];\n datasets_per_creator: Record<string, number>;\n datasets_per_base_uri: Record<string, number>;\n datasets_per_tag: Record<string, number>;\n size_in_bytes_per_creator: Record<string, number>;\n size_in_bytes_per_base_uri: Record<string, number>;\n size_in_bytes_per_tag: Record<string, number>;\n /** Authenticated identities that registered datasets (server-asserted). */\n uploaders?: string[];\n datasets_per_uploader?: Record<string, number>;\n size_in_bytes_per_uploader?: Record<string, number>;\n}\n\n// =========================================================================\n// User Management Types\n// =========================================================================\n\n/**\n * User information returned from user endpoints\n */\nexport interface UserInfo {\n username: string;\n display_name?: string | null;\n is_admin: boolean;\n search_permissions_on_base_uris: string[];\n register_permissions_on_base_uris: string[];\n}\n\n/**\n * User creation/update request (PUT - full replacement)\n */\nexport interface UserRequest {\n is_admin?: boolean;\n display_name?: string | null;\n}\n\n/**\n * User partial update request (PATCH)\n */\nexport interface UserUpdateRequest {\n is_admin?: boolean;\n display_name?: string | null;\n}\n\n/**\n * Base URI information\n */\nexport interface BaseURIInfo {\n base_uri: string;\n users_with_search_permissions: string[];\n users_with_register_permissions: string[];\n}\n\n/**\n * Base URI permissions update request\n */\nexport interface BaseURIPermissionsRequest {\n users_with_search_permissions?: string[];\n users_with_register_permissions?: string[];\n}\n\n// =========================================================================\n// Dependency Graph Plugin Types\n// =========================================================================\n\n/**\n * Dataset entry with dependency information from graph plugin.\n * The derived_from field contains UUID strings of parent datasets.\n */\nexport interface GraphDatasetEntry extends DatasetEntry {\n /** UUIDs of datasets this dataset is derived from (as string array) */\n derived_from?: string[];\n}\n","/**\n * Utility functions for dserver client\n */\n\nimport type { PaginationInfo } from \"./types\";\n\n/**\n * Parse an X-Pagination response header into a PaginationInfo.\n *\n * dservercore (flask-smorest) emits\n * {\"total\", \"total_pages\", \"first_page\", \"last_page\", \"page\", \"next_page\"}\n * — note: no \"pages\" or \"per_page\" fields. Other servers may emit\n * {\"total\", \"page\", \"per_page\", \"pages\"} directly. Both shapes are\n * normalized here; missing fields are derived from the requested page\n * size and the number of returned items.\n */\nexport function parsePaginationHeader(\n headerValue: string | null | undefined,\n requestedPageSize: number | undefined,\n dataLength: number\n): PaginationInfo {\n let raw: Record<string, unknown> = {};\n if (headerValue) {\n try {\n raw = JSON.parse(headerValue);\n } catch {\n // Malformed header: fall through to derived defaults.\n }\n }\n const total = typeof raw.total === \"number\" ? raw.total : dataLength;\n const page = typeof raw.page === \"number\" ? raw.page : 1;\n const per_page =\n typeof raw.per_page === \"number\"\n ? raw.per_page\n : (requestedPageSize ?? dataLength);\n let pages: number;\n if (typeof raw.pages === \"number\") {\n pages = raw.pages;\n } else if (typeof raw.total_pages === \"number\") {\n pages = raw.total_pages;\n } else {\n pages = per_page > 0 ? Math.ceil(total / per_page) : 1;\n }\n return { total, page, per_page, pages };\n}\n\n/**\n * Generate a SHA-1 hash of a string (item identifier from relpath)\n * Uses the Web Crypto API which is available in browsers and Node.js 18+\n */\nexport async function generateIdentifier(relpath: string): Promise<string> {\n const encoder = new TextEncoder();\n const data = encoder.encode(relpath);\n const hashBuffer = await crypto.subtle.digest(\"SHA-1\", data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.map((b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Generate a UUID v4\n */\nexport function generateUUID(): string {\n // Use crypto.randomUUID if available (modern browsers and Node.js 19+)\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n\n // Fallback implementation\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * URL-encode a URI for use in API paths\n */\nexport function encodeUri(uri: string): string {\n return encodeURIComponent(uri);\n}\n\n/**\n * Extract the subject (username) from a JWT without verifying it.\n * Returns undefined for malformed tokens.\n */\nexport function getJwtSubject(token: string): string | undefined {\n const parts = token.split(\".\");\n if (parts.length !== 3) {\n return undefined;\n }\n try {\n const base64 = parts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const payload = JSON.parse(atob(base64));\n return typeof payload.sub === \"string\" ? payload.sub : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Get current Unix timestamp\n */\nexport function getCurrentTimestamp(): number {\n return Math.floor(Date.now() / 1000);\n}\n\n/**\n * Parse ISO timestamp to Unix timestamp\n */\nexport function parseISOTimestamp(isoString: string): number {\n return Math.floor(new Date(isoString).getTime() / 1000);\n}\n\n/**\n * Check if a signed URL has expired\n */\nexport function isExpired(expiryTimestamp: string): boolean {\n const expiry = parseISOTimestamp(expiryTimestamp);\n const now = getCurrentTimestamp();\n return now >= expiry;\n}\n\n/**\n * Calculate remaining time until expiry in seconds\n */\nexport function timeUntilExpiry(expiryTimestamp: string): number {\n const expiry = parseISOTimestamp(expiryTimestamp);\n const now = getCurrentTimestamp();\n return Math.max(0, expiry - now);\n}\n\n/**\n * Format bytes to human-readable string\n */\nexport function formatBytes(bytes: number, decimals = 2): string {\n if (bytes === 0) return \"0 Bytes\";\n\n const k = 1024;\n const dm = decimals < 0 ? 0 : decimals;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + \" \" + sizes[i];\n}\n\n/**\n * Create a delay promise (useful for rate limiting)\n */\nexport function delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Retry a function with exponential backoff\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n options: {\n maxRetries?: number;\n initialDelay?: number;\n maxDelay?: number;\n backoffFactor?: number;\n } = {}\n): Promise<T> {\n const {\n maxRetries = 3,\n initialDelay = 1000,\n maxDelay = 30000,\n backoffFactor = 2,\n } = options;\n\n let lastError: Error | undefined;\n let currentDelay = initialDelay;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n return await fn();\n } catch (error) {\n lastError = error as Error;\n\n // Aborts and client errors (4xx) will not succeed on retry.\n const status = (error as { status?: number }).status;\n if (\n lastError.name === \"AbortError\" ||\n (typeof status === \"number\" && status >= 400 && status < 500)\n ) {\n throw lastError;\n }\n\n if (attempt < maxRetries) {\n await delay(currentDelay);\n currentDelay = Math.min(currentDelay * backoffFactor, maxDelay);\n }\n }\n }\n\n throw lastError;\n}\n\n/**\n * Chunk an array into smaller arrays\n */\nexport function chunk<T>(array: T[], size: number): T[][] {\n const chunks: T[][] = [];\n for (let i = 0; i < array.length; i += size) {\n chunks.push(array.slice(i, i + size));\n }\n return chunks;\n}\n\n/**\n * Run promises with concurrency limit\n */\nexport async function parallelLimit<T, R>(\n items: T[],\n limit: number,\n fn: (item: T) => Promise<R>\n): Promise<R[]> {\n const results: Promise<R>[] = [];\n const executing = new Set<Promise<void>>();\n\n for (const item of items) {\n const p = Promise.resolve().then(() => fn(item));\n results.push(p);\n\n // Track completion without rethrowing here, so a rejected task cannot\n // surface as an unhandled rejection while later tasks are still queued.\n const e = p.then(\n () => undefined,\n () => undefined\n ).then(() => {\n executing.delete(e);\n });\n executing.add(e);\n if (executing.size >= limit) {\n await Promise.race(executing);\n }\n }\n\n // Wait for everything to settle so every rejection is observed, then\n // surface the first failure.\n const settled = await Promise.allSettled(results);\n const firstRejected = settled.find((s) => s.status === \"rejected\");\n if (firstRejected) {\n throw (firstRejected as PromiseRejectedResult).reason;\n }\n return settled.map((s) => (s as PromiseFulfilledResult<R>).value);\n}\n","/**\n * DServer Client - TypeScript client for dserver signed URL API\n */\n\nimport {\n DServerClientConfig,\n DatasetSignedURLsResponse,\n ItemSignedURLResponse,\n UploadRequest,\n UploadURLsResponse,\n UploadCompleteRequest,\n UploadCompleteResponse,\n AdminMetadata,\n Manifest,\n DownloadOptions,\n UploadOptions,\n FileToUpload,\n DServerError,\n AuthenticationError,\n AuthorizationError,\n NotFoundError,\n // REST API types\n DatasetEntry,\n SearchQuery,\n PaginationParams,\n PaginationInfo,\n PaginatedResponse,\n ServerVersions,\n TagsResponse,\n AnnotationsResponse,\n ReadmeResponse,\n ManifestResponse,\n SummaryInfo,\n // User management types\n UserWithPermissions,\n UserInfo,\n UserRequest,\n BaseURIInfo,\n // Dependency graph types\n GraphDatasetEntry,\n} from \"./types\";\n\nimport {\n encodeUri,\n generateIdentifier,\n generateUUID,\n getCurrentTimestamp,\n getJwtSubject,\n parallelLimit,\n parsePaginationHeader,\n} from \"./utils\";\n\nimport SparkMD5 from \"spark-md5\";\n\n/** Page size for fetching dependency graphs (the server's maximum). */\nconst GRAPH_PAGE_SIZE = 100;\n\n/**\n * Pull a human-readable message out of a dserver error body, if present.\n */\nfunction extractErrorMessage(errorBody: unknown): string | undefined {\n if (typeof errorBody === \"string\" && errorBody.trim()) {\n return errorBody;\n }\n if (errorBody && typeof errorBody === \"object\") {\n const body = errorBody as Record<string, unknown>;\n for (const key of [\"message\", \"error\", \"description\", \"msg\"]) {\n if (typeof body[key] === \"string\" && (body[key] as string).trim()) {\n return body[key] as string;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Client for interacting with dserver's signed URL API\n *\n * @example\n * ```typescript\n * const client = new DServerClient({\n * baseUrl: \"http://localhost:5000\",\n * token: \"your-jwt-token\"\n * });\n *\n * // Get signed URLs for a dataset\n * const urls = await client.getDatasetSignedUrls(\"s3://bucket/uuid\");\n *\n * // Download an item\n * const content = await client.downloadItem(urls, \"item-identifier\");\n * ```\n */\nexport class DServerClient {\n private baseUrl: string;\n private token?: string;\n private fetchImpl: typeof fetch;\n\n constructor(config: DServerClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, \"\"); // Remove trailing slash\n this.token = config.token;\n // Bind fetch to window/globalThis to avoid \"Illegal invocation\" errors\n this.fetchImpl = config.fetch ?? fetch.bind(globalThis);\n }\n\n /**\n * Set or update the authentication token\n */\n setToken(token: string): void {\n this.token = token;\n }\n\n /**\n * Get authorization headers\n */\n private getHeaders(): HeadersInit {\n const headers: HeadersInit = {\n \"Content-Type\": \"application/json\",\n };\n if (this.token) {\n headers[\"Authorization\"] = `Bearer ${this.token}`;\n }\n return headers;\n }\n\n /**\n * Make an authenticated request to dserver\n */\n private async request<T>(\n method: string,\n path: string,\n body?: unknown,\n signal?: AbortSignal\n ): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n const options: RequestInit = {\n method,\n headers: this.getHeaders(),\n signal,\n };\n\n if (body !== undefined) {\n options.body = JSON.stringify(body);\n }\n\n const response = await this.fetchImpl(url, options);\n\n if (!response.ok) {\n return this.handleErrorResponse(response);\n }\n\n // Some endpoints (e.g. user PUT/DELETE) return an empty body on success.\n const text = await response.text();\n return (text ? JSON.parse(text) : undefined) as T;\n }\n\n // =========================================================================\n // Signed URL API\n // =========================================================================\n\n /**\n * Get signed URLs for reading an entire dataset\n *\n * @param uri - Dataset URI (e.g., \"s3://bucket/uuid\")\n * @returns Signed URLs for all dataset components\n */\n async getDatasetSignedUrls(uri: string): Promise<DatasetSignedURLsResponse> {\n const encodedUri = encodeUri(uri);\n return this.request<DatasetSignedURLsResponse>(\n \"GET\",\n `/signed-urls/dataset/${encodedUri}`\n );\n }\n\n /**\n * Get a signed URL for a single dataset item\n *\n * @param uri - Dataset URI\n * @param identifier - Item identifier (SHA-1 hash of relpath)\n * @returns Signed URL for the item\n */\n async getItemSignedUrl(\n uri: string,\n identifier: string\n ): Promise<ItemSignedURLResponse> {\n const encodedUri = encodeUri(uri);\n return this.request<ItemSignedURLResponse>(\n \"GET\",\n `/signed-urls/item/${encodedUri}/${identifier}`\n );\n }\n\n /**\n * Get signed URLs for uploading a new dataset\n *\n * @param baseUri - Base URI (e.g., \"s3://bucket\")\n * @param request - Upload request with UUID, name, and items\n * @returns Signed URLs for uploading dataset components\n */\n async getUploadUrls(\n baseUri: string,\n request: UploadRequest\n ): Promise<UploadURLsResponse> {\n const encodedBaseUri = encodeUri(baseUri);\n return this.request<UploadURLsResponse>(\n \"POST\",\n `/signed-urls/upload/${encodedBaseUri}`,\n request\n );\n }\n\n /**\n * Signal that a dataset upload is complete\n *\n * @param uri - Dataset URI\n * @returns Registration result\n */\n async signalUploadComplete(uri: string): Promise<UploadCompleteResponse> {\n const request: UploadCompleteRequest = { uri };\n return this.request<UploadCompleteResponse>(\n \"POST\",\n `/signed-urls/upload-complete`,\n request\n );\n }\n\n // =========================================================================\n // High-level download operations\n // =========================================================================\n\n /**\n * Download a dataset item using its signed URL\n *\n * @param urls - Signed URLs response from getDatasetSignedUrls\n * @param identifier - Item identifier\n * @param options - Download options\n * @returns Item content as ArrayBuffer\n */\n async downloadItem(\n urls: DatasetSignedURLsResponse,\n identifier: string,\n options: DownloadOptions = {}\n ): Promise<ArrayBuffer> {\n const itemUrl = urls.item_urls[identifier];\n if (!itemUrl) {\n throw new NotFoundError(`Item ${identifier} not found in dataset`);\n }\n\n const response = await this.fetchImpl(itemUrl, { signal: options.signal });\n if (!response.ok) {\n throw new DServerError(\n `Failed to download item: ${response.statusText}`,\n response.status\n );\n }\n\n if (options.onProgress && response.body) {\n const reader = response.body.getReader();\n const contentLength = Number(response.headers.get(\"Content-Length\")) || 0;\n const chunks: Uint8Array[] = [];\n let receivedLength = 0;\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n chunks.push(value);\n receivedLength += value.length;\n options.onProgress(receivedLength, contentLength, identifier);\n }\n\n const result = new Uint8Array(receivedLength);\n let position = 0;\n for (const chunk of chunks) {\n result.set(chunk, position);\n position += chunk.length;\n }\n return result.buffer;\n }\n\n return response.arrayBuffer();\n }\n\n /**\n * Download and parse the dataset manifest\n *\n * @param urls - Signed URLs response\n * @returns Parsed manifest\n */\n async downloadManifest(urls: DatasetSignedURLsResponse): Promise<Manifest> {\n const response = await this.fetchImpl(urls.manifest_url);\n if (!response.ok) {\n throw new DServerError(\"Failed to download manifest\", response.status);\n }\n return response.json();\n }\n\n /**\n * Download and parse the dataset admin metadata\n *\n * @param urls - Signed URLs response\n * @returns Parsed admin metadata\n */\n async downloadAdminMetadata(\n urls: DatasetSignedURLsResponse\n ): Promise<AdminMetadata> {\n const response = await this.fetchImpl(urls.admin_metadata_url);\n if (!response.ok) {\n throw new DServerError(\n \"Failed to download admin metadata\",\n response.status\n );\n }\n return response.json();\n }\n\n /**\n * Download the dataset README\n *\n * @param urls - Signed URLs response\n * @returns README content as string\n */\n async downloadReadme(urls: DatasetSignedURLsResponse): Promise<string> {\n const response = await this.fetchImpl(urls.readme_url);\n if (!response.ok) {\n throw new DServerError(\"Failed to download README\", response.status);\n }\n return response.text();\n }\n\n /**\n * Download an overlay\n *\n * @param urls - Signed URLs response\n * @param overlayName - Name of the overlay\n * @returns Overlay data\n */\n async downloadOverlay(\n urls: DatasetSignedURLsResponse,\n overlayName: string\n ): Promise<Record<string, unknown>> {\n const overlayUrl = urls.overlay_urls[overlayName];\n if (!overlayUrl) {\n throw new NotFoundError(`Overlay ${overlayName} not found`);\n }\n const response = await this.fetchImpl(overlayUrl);\n if (!response.ok) {\n throw new DServerError(\"Failed to download overlay\", response.status);\n }\n return response.json();\n }\n\n /**\n * Download an annotation\n *\n * @param urls - Signed URLs response\n * @param annotationName - Name of the annotation\n * @returns Annotation value\n */\n async downloadAnnotation(\n urls: DatasetSignedURLsResponse,\n annotationName: string\n ): Promise<unknown> {\n const annotationUrl = urls.annotation_urls[annotationName];\n if (!annotationUrl) {\n throw new NotFoundError(`Annotation ${annotationName} not found`);\n }\n const response = await this.fetchImpl(annotationUrl);\n if (!response.ok) {\n throw new DServerError(\"Failed to download annotation\", response.status);\n }\n return response.json();\n }\n\n // =========================================================================\n // High-level upload operations\n // =========================================================================\n\n /**\n * Create and upload a new dataset\n *\n * The server handles admin_metadata, manifest, structure, tags, and annotations\n * directly based on metadata sent in the upload request. We only need to upload\n * README and item files.\n *\n * @param baseUri - Base URI (e.g., \"s3://bucket\")\n * @param name - Dataset name\n * @param files - Files to upload\n * @param options - Upload options (readme, tags, annotations)\n * @returns Upload completion response\n */\n async createDataset(\n baseUri: string,\n name: string,\n files: FileToUpload[],\n options: UploadOptions = {}\n ): Promise<UploadCompleteResponse> {\n const uuid = generateUUID();\n const creatorUsername =\n (this.token && getJwtSubject(this.token)) || \"webapp-user\";\n const frozenAt = getCurrentTimestamp();\n\n // Build item metadata with identifiers and hashes\n const itemsWithMetadata = await Promise.all(\n files.map(async (file) => {\n const identifier = await generateIdentifier(file.relpath);\n const { size, hash } = await this.computeItemMetadata(file);\n return {\n ...file,\n identifier,\n size_in_bytes: size,\n hash,\n utc_timestamp: frozenAt,\n };\n })\n );\n\n // Request upload URLs - server writes metadata directly to storage\n const uploadInfo = await this.getUploadUrls(baseUri, {\n uuid,\n name,\n creator_username: creatorUsername,\n frozen_at: frozenAt,\n items: itemsWithMetadata.map((item) => ({\n relpath: item.relpath,\n size_in_bytes: item.size_in_bytes,\n hash: item.hash,\n utc_timestamp: item.utc_timestamp,\n })),\n tags: options.tags,\n annotations: options.annotations,\n });\n\n const totalBytes = itemsWithMetadata.reduce(\n (sum, item) => sum + item.size_in_bytes,\n 0\n );\n let uploadedBytes = 0;\n\n // Upload README\n const readme = options.readme || \"---\\n\";\n await this.uploadText(uploadInfo.upload_urls.readme, readme, options.signal);\n\n // Upload items in parallel with concurrency limit\n await parallelLimit(itemsWithMetadata, 4, async (item) => {\n const uploadUrl = uploadInfo.upload_urls.items[item.identifier];\n if (!uploadUrl) {\n throw new DServerError(\n `No upload URL for item ${item.relpath}`,\n 500\n );\n }\n\n let body: BodyInit;\n if (item.content instanceof Blob) {\n body = item.content;\n } else if (item.content instanceof ArrayBuffer) {\n body = item.content;\n } else {\n body = item.content;\n }\n\n const response = await this.fetchImpl(uploadUrl.url, {\n method: \"PUT\",\n body,\n headers: item.contentType\n ? { \"Content-Type\": item.contentType }\n : undefined,\n signal: options.signal,\n });\n\n if (!response.ok) {\n throw new DServerError(\n `Failed to upload ${item.relpath}`,\n response.status\n );\n }\n\n uploadedBytes += item.size_in_bytes;\n options.onProgress?.(uploadedBytes, totalBytes, item.relpath);\n });\n\n // Signal upload complete\n return this.signalUploadComplete(uploadInfo.uri);\n }\n\n /**\n * Compute size and hash for a file item\n */\n private async computeItemMetadata(\n item: FileToUpload\n ): Promise<{ size: number; hash: string }> {\n let size: number;\n let contentBuffer: ArrayBuffer;\n\n if (item.content instanceof Blob) {\n size = item.content.size;\n contentBuffer = await item.content.arrayBuffer();\n } else if (item.content instanceof ArrayBuffer) {\n size = item.content.byteLength;\n contentBuffer = item.content;\n } else {\n const encoded = new TextEncoder().encode(item.content);\n size = encoded.length;\n contentBuffer = encoded.buffer;\n }\n\n // Calculate MD5 hash. WebCrypto does not support MD5, so use spark-md5;\n // dtool manifests record MD5 digests, so the hash function must match.\n const hash = SparkMD5.ArrayBuffer.hash(contentBuffer);\n\n return { size, hash };\n }\n\n /**\n * Upload text data to a signed URL\n */\n private async uploadText(\n url: string,\n text: string,\n signal?: AbortSignal\n ): Promise<void> {\n const response = await this.fetchImpl(url, {\n method: \"PUT\",\n body: text,\n headers: { \"Content-Type\": \"text/plain; charset=utf-8\" },\n signal,\n });\n\n if (!response.ok) {\n throw new DServerError(\"Failed to upload text\", response.status);\n }\n }\n\n // =========================================================================\n // REST API Methods (standard dserver endpoints)\n // =========================================================================\n\n /**\n * Get server configuration versions\n */\n async getServerVersions(): Promise<ServerVersions> {\n const response = await this.request<{ versions: ServerVersions }>(\n \"GET\",\n \"/config/versions\"\n );\n return response.versions;\n }\n\n /**\n * Check server health (no auth required)\n */\n async checkHealth(): Promise<{ status: string }> {\n const url = `${this.baseUrl}/config/health`;\n const response = await this.fetchImpl(url);\n if (!response.ok) {\n throw new DServerError(\"Health check failed\", response.status);\n }\n return response.json();\n }\n\n /**\n * Get user summary info\n */\n async getUserSummary(username: string): Promise<SummaryInfo> {\n return this.request<SummaryInfo>(\"GET\", `/users/${username}/summary`);\n }\n\n /**\n * Get information on the currently authenticated user.\n */\n async getMe(): Promise<UserWithPermissions> {\n return this.request<UserWithPermissions>(\"GET\", \"/me\");\n }\n\n /**\n * Get the summary for the currently authenticated user — no username needed.\n */\n async getMySummary(): Promise<SummaryInfo> {\n return this.request<SummaryInfo>(\"GET\", \"/me/summary\");\n }\n\n /**\n * Search datasets with pagination\n */\n async searchDatasets(\n query: SearchQuery,\n pagination?: PaginationParams\n ): Promise<PaginatedResponse<DatasetEntry>> {\n const params = new URLSearchParams();\n if (pagination?.page) params.set(\"page\", String(pagination.page));\n if (pagination?.page_size) params.set(\"page_size\", String(pagination.page_size));\n if (pagination?.sort) params.set(\"sort\", pagination.sort);\n\n const queryString = params.toString();\n const path = `/uris${queryString ? `?${queryString}` : \"\"}`;\n\n const url = `${this.baseUrl}${path}`;\n const response = await this.fetchImpl(url, {\n method: \"POST\",\n headers: this.getHeaders(),\n body: JSON.stringify(query),\n });\n\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n const data: DatasetEntry[] = await response.json();\n const paginationInfo: PaginationInfo = parsePaginationHeader(\n response.headers.get(\"x-pagination\"),\n pagination?.page_size,\n data.length\n );\n\n return { data, pagination: paginationInfo };\n }\n\n /**\n * Read the error body and throw a typed error carrying the server's\n * message so callers can surface the actual reason for the failure.\n */\n private async handleErrorResponse(response: Response): Promise<never> {\n const text = await response.text();\n let errorBody: unknown = text;\n try {\n errorBody = JSON.parse(text);\n } catch {\n // keep raw text\n }\n\n const serverMessage = extractErrorMessage(errorBody);\n\n switch (response.status) {\n case 401:\n throw new AuthenticationError(serverMessage, errorBody);\n case 403:\n throw new AuthorizationError(serverMessage, errorBody);\n case 404:\n throw new NotFoundError(serverMessage, errorBody);\n default:\n throw new DServerError(\n serverMessage ?? `Request failed: ${response.statusText}`,\n response.status,\n response.statusText,\n errorBody\n );\n }\n }\n\n /**\n * Get manifest for a dataset\n */\n async getManifest(uri: string): Promise<ManifestResponse> {\n const encodedUri = encodeURIComponent(uri);\n return this.request<ManifestResponse>(\"GET\", `/manifests/${encodedUri}`);\n }\n\n /**\n * Get readme for a dataset\n */\n async getReadme(uri: string): Promise<ReadmeResponse> {\n const encodedUri = encodeURIComponent(uri);\n return this.request<ReadmeResponse>(\"GET\", `/readmes/${encodedUri}`);\n }\n\n /**\n * Set readme for a dataset\n */\n async setReadme(uri: string, content: string): Promise<ReadmeResponse> {\n const encodedUri = encodeURIComponent(uri);\n return this.request<ReadmeResponse>(\"PUT\", `/readmes/${encodedUri}`, {\n readme: content,\n });\n }\n\n // =========================================================================\n // Tags API\n // =========================================================================\n\n /**\n * Get tags for a dataset\n */\n async getTags(uri: string): Promise<TagsResponse> {\n const encodedUri = encodeURIComponent(uri);\n return this.request<TagsResponse>(\"GET\", `/tags/${encodedUri}`);\n }\n\n /**\n * Set all tags for a dataset (replaces existing)\n */\n async setTags(uri: string, tags: string[]): Promise<TagsResponse> {\n const encodedUri = encodeURIComponent(uri);\n return this.request<TagsResponse>(\"PUT\", `/tags/${encodedUri}`, { tags });\n }\n\n /**\n * Add a single tag to a dataset\n */\n async addTag(uri: string, tag: string): Promise<TagsResponse> {\n const encodedUri = encodeURIComponent(uri);\n const encodedTag = encodeURIComponent(tag);\n return this.request<TagsResponse>(\n \"POST\",\n `/tags/${encodedUri}/${encodedTag}`,\n {}\n );\n }\n\n /**\n * Remove a single tag from a dataset\n */\n async removeTag(uri: string, tag: string): Promise<TagsResponse> {\n const encodedUri = encodeURIComponent(uri);\n const encodedTag = encodeURIComponent(tag);\n return this.request<TagsResponse>(\n \"DELETE\",\n `/tags/${encodedUri}/${encodedTag}`\n );\n }\n\n // =========================================================================\n // Annotations API\n // =========================================================================\n\n /**\n * Get annotations for a dataset\n */\n async getAnnotations(uri: string): Promise<AnnotationsResponse> {\n const encodedUri = encodeURIComponent(uri);\n return this.request<AnnotationsResponse>(\n \"GET\",\n `/annotations/${encodedUri}`\n );\n }\n\n /**\n * Set all annotations for a dataset (replaces existing)\n */\n async setAnnotations(\n uri: string,\n annotations: Record<string, unknown>\n ): Promise<AnnotationsResponse> {\n const encodedUri = encodeURIComponent(uri);\n return this.request<AnnotationsResponse>(\n \"PUT\",\n `/annotations/${encodedUri}`,\n { annotations }\n );\n }\n\n /**\n * Set a single annotation\n */\n async setAnnotation(\n uri: string,\n name: string,\n value: unknown\n ): Promise<AnnotationsResponse> {\n const encodedUri = encodeURIComponent(uri);\n const encodedName = encodeURIComponent(name);\n return this.request<AnnotationsResponse>(\n \"PUT\",\n `/annotations/${encodedUri}/${encodedName}`,\n { value }\n );\n }\n\n /**\n * Delete a single annotation\n */\n async deleteAnnotation(\n uri: string,\n name: string\n ): Promise<AnnotationsResponse> {\n const encodedUri = encodeURIComponent(uri);\n const encodedName = encodeURIComponent(name);\n return this.request<AnnotationsResponse>(\n \"DELETE\",\n `/annotations/${encodedUri}/${encodedName}`\n );\n }\n\n // =========================================================================\n // User Management API (Admin only)\n // =========================================================================\n\n /**\n * Get current user info (includes is_admin flag)\n */\n async getCurrentUser(): Promise<UserInfo> {\n return this.request<UserInfo>(\"GET\", \"/me\");\n }\n\n /**\n * List all users (admin only)\n */\n async listUsers(): Promise<UserInfo[]> {\n return this.request<UserInfo[]>(\"GET\", \"/users\");\n }\n\n /**\n * Get a specific user\n */\n async getUser(username: string): Promise<UserInfo> {\n const encodedUsername = encodeURIComponent(username);\n return this.request<UserInfo>(\"GET\", `/users/${encodedUsername}`);\n }\n\n /**\n * Create or register a new user (admin only)\n * Note: dserver uses PUT for user creation/update (idempotent operation)\n */\n async createUser(username: string, options?: UserRequest): Promise<UserInfo> {\n const encodedUsername = encodeURIComponent(username);\n return this.request<UserInfo>(\"PUT\", `/users/${encodedUsername}`, options || {});\n }\n\n /**\n * Delete a user (admin only)\n */\n async deleteUser(username: string): Promise<void> {\n const encodedUsername = encodeURIComponent(username);\n await this.request<void>(\"DELETE\", `/users/${encodedUsername}`);\n }\n\n /**\n * Update user fields (partial update, admin only)\n *\n * @param username - Username to update\n * @param updates - Fields to update (is_admin, display_name)\n * @returns Updated user info\n */\n async updateUser(username: string, updates: { is_admin?: boolean; display_name?: string | null }): Promise<UserInfo> {\n const encodedUsername = encodeURIComponent(username);\n return this.request<UserInfo>(\"PATCH\", `/users/${encodedUsername}`, updates);\n }\n\n /**\n * Update user admin status (admin only)\n * @deprecated Use updateUser() instead for more flexibility\n */\n async updateUserAdmin(username: string, isAdmin: boolean): Promise<UserInfo> {\n return this.updateUser(username, { is_admin: isAdmin });\n }\n\n // =========================================================================\n // Base URI Management API (Admin only)\n // =========================================================================\n\n /**\n * List all base URIs (admin only)\n */\n async listBaseURIs(): Promise<BaseURIInfo[]> {\n return this.request<BaseURIInfo[]>(\"GET\", \"/base-uris\");\n }\n\n /**\n * Get a specific base URI\n */\n async getBaseURI(baseUri: string): Promise<BaseURIInfo> {\n const encodedUri = encodeURIComponent(baseUri);\n return this.request<BaseURIInfo>(\"GET\", `/base-uris/${encodedUri}`);\n }\n\n /**\n * Register a new base URI (admin only)\n */\n async createBaseURI(baseUri: string): Promise<BaseURIInfo> {\n const encodedUri = encodeURIComponent(baseUri);\n return this.request<BaseURIInfo>(\"POST\", `/base-uris/${encodedUri}`, {});\n }\n\n /**\n * Delete a base URI (admin only)\n */\n async deleteBaseURI(baseUri: string): Promise<void> {\n const encodedUri = encodeURIComponent(baseUri);\n await this.request<void>(\"DELETE\", `/base-uris/${encodedUri}`);\n }\n\n /**\n * Grant search permission to a user on a base URI (admin only)\n */\n async grantSearchPermission(username: string, baseUri: string): Promise<UserInfo> {\n const encodedUsername = encodeURIComponent(username);\n const encodedUri = encodeURIComponent(baseUri);\n return this.request<UserInfo>(\"POST\", `/users/${encodedUsername}/search/${encodedUri}`, {});\n }\n\n /**\n * Revoke search permission from a user on a base URI (admin only)\n */\n async revokeSearchPermission(username: string, baseUri: string): Promise<UserInfo> {\n const encodedUsername = encodeURIComponent(username);\n const encodedUri = encodeURIComponent(baseUri);\n return this.request<UserInfo>(\"DELETE\", `/users/${encodedUsername}/search/${encodedUri}`);\n }\n\n /**\n * Grant register permission to a user on a base URI (admin only)\n */\n async grantRegisterPermission(username: string, baseUri: string): Promise<UserInfo> {\n const encodedUsername = encodeURIComponent(username);\n const encodedUri = encodeURIComponent(baseUri);\n return this.request<UserInfo>(\"POST\", `/users/${encodedUsername}/register/${encodedUri}`, {});\n }\n\n /**\n * Revoke register permission from a user on a base URI (admin only)\n */\n async revokeRegisterPermission(username: string, baseUri: string): Promise<UserInfo> {\n const encodedUsername = encodeURIComponent(username);\n const encodedUri = encodeURIComponent(baseUri);\n return this.request<UserInfo>(\"DELETE\", `/users/${encodedUsername}/register/${encodedUri}`);\n }\n\n // =========================================================================\n // UUID Lookup API\n // =========================================================================\n\n /**\n * Get datasets by UUID\n * Returns all instances of a dataset with that UUID across base URIs the user has access to\n *\n * @param uuid - Dataset UUID\n * @returns Array of datasets with that UUID\n */\n async getDatasetsByUuid(uuid: string): Promise<DatasetEntry[]> {\n return this.request<DatasetEntry[]>(\n \"GET\",\n `/uuids/${encodeURIComponent(uuid)}`\n );\n }\n\n // =========================================================================\n // Dependency Graph Plugin API\n // =========================================================================\n\n /**\n * Get the dependency graph of a dataset by UUID\n * Returns all datasets in the same dependency graph (bidirectional traversal),\n * fetching every page of the paginated response.\n * Requires dserver-dependency-graph-plugin to be installed\n *\n * @param uuid - Dataset UUID\n * @param dependencyKeys - Optional custom dependency keys (e.g.,\n * [\"readme_parsed.derived_from.uuid\"]); honored only if the server allows\n * dynamic dependency keys. Omit to use the server's keys.\n * @returns Datasets in the dependency graph, each with derived_from: the\n * UUIDs of its parents within the graph\n */\n async getDependencyGraph(uuid: string, dependencyKeys?: string[]): Promise<GraphDatasetEntry[]> {\n const encodedUuid = encodeURIComponent(uuid);\n const custom = dependencyKeys !== undefined && dependencyKeys.length > 0;\n const datasets: GraphDatasetEntry[] = [];\n for (let page = 1; ; page++) {\n const url =\n `${this.baseUrl}/graph/uuids/${encodedUuid}` +\n `?page=${page}&page_size=${GRAPH_PAGE_SIZE}`;\n const response = await this.fetchImpl(url, {\n method: custom ? \"POST\" : \"GET\",\n headers: this.getHeaders(),\n body: custom\n ? JSON.stringify({ dependency_keys: dependencyKeys })\n : undefined,\n });\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n const data: GraphDatasetEntry[] = await response.json();\n datasets.push(...data);\n const { pages } = parsePaginationHeader(\n response.headers.get(\"x-pagination\"),\n GRAPH_PAGE_SIZE,\n data.length\n );\n if (page >= pages || data.length === 0) {\n return datasets;\n }\n }\n }\n}\n"],"mappings":";;;;;AA6OA,IAAa,eAAb,cAAkC,MAAM;CACtC,YACE,SACgB,QACA,YACA,MAChB;EACA,MAAM,OAAO;EAJG,KAAA,SAAA;EACA,KAAA,aAAA;EACA,KAAA,OAAA;EAGhB,KAAK,OAAO;CACd;AACF;;;;AAKA,IAAa,sBAAb,cAAyC,aAAa;CACpD,YAAY,UAAU,yBAAyB,MAAgB;EAC7D,MAAM,SAAS,KAAK,gBAAgB,IAAI;EACxC,KAAK,OAAO;CACd;AACF;;;;AAKA,IAAa,qBAAb,cAAwC,aAAa;CACnD,YAAY,UAAU,iBAAiB,MAAgB;EACrD,MAAM,SAAS,KAAK,aAAa,IAAI;EACrC,KAAK,OAAO;CACd;AACF;;;;AAKA,IAAa,gBAAb,cAAmC,aAAa;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AC9B,QAAQ,KAAK,aAAa;GAC7B,MAAM,WAAW,MAAM,KAAK,UAAU,KAAK;IACzC,QAAQ,SAAS,SAAS;IAC1B,SAAS,KAAK,WAAW;IACzB,MAAM,SACF,KAAK,UAAU,EAAE,iBAAiB,eAAe,CAAC,IAClD,KAAA;GACN,CAAC;GACD,IAAI,CAAC,SAAS,IACZ,MAAM,KAAK,oBAAoB,QAAQ;GAEzC,MAAM,OAA4B,MAAM,SAAS,KAAK;GACtD,SAAS,KAAK,GAAG,IAAI;GACrB,MAAM,EAAE,UAAU,sBAChB,SAAS,QAAQ,IAAI,cAAc,GACnC,iBACA,KAAK,MACP;GACA,IAAI,QAAQ,SAAS,KAAK,WAAW,GACnC,OAAO;EAEX;CACF;AACF"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dserver-client - TypeScript/JavaScript client for dserver signed URL API
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { A as UploadCompleteResponse, B as UserWithPermissions, C as ProgressCallback, D as SummaryInfo, E as ServerVersions, F as UploadURLs, I as UploadURLsResponse, L as UserInfo, M as UploadItemURL, N as UploadOptions, O as TagsResponse, P as UploadRequest, R as UserRequest, S as PaginationParams, T as SearchQuery, _ as ManifestItem, a as AuthorizationError, b as PaginatedResponse, c as DServerClientConfig, d as DatasetSignedURLsResponse, f as DownloadOptions, g as Manifest, h as ItemSignedURLResponse, i as AuthenticationError, j as UploadItem, k as UploadCompleteRequest, l as DServerError, m as GraphDatasetEntry, n as AdminMetadata, o as BaseURIInfo, p as FileToUpload, r as AnnotationsResponse, s as BaseURIPermissionsRequest, t as DServerClient, u as DatasetEntry, v as ManifestResponse, w as ReadmeResponse, x as PaginationInfo, y as NotFoundError, z as UserUpdateRequest } from "./client.mjs";
|
|
7
|
+
/**
|
|
8
|
+
* Parse an X-Pagination response header into a PaginationInfo.
|
|
9
|
+
*
|
|
10
|
+
* dservercore (flask-smorest) emits
|
|
11
|
+
* {"total", "total_pages", "first_page", "last_page", "page", "next_page"}
|
|
12
|
+
* — note: no "pages" or "per_page" fields. Other servers may emit
|
|
13
|
+
* {"total", "page", "per_page", "pages"} directly. Both shapes are
|
|
14
|
+
* normalized here; missing fields are derived from the requested page
|
|
15
|
+
* size and the number of returned items.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parsePaginationHeader(headerValue: string | null | undefined, requestedPageSize: number | undefined, dataLength: number): PaginationInfo;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a SHA-1 hash of a string (item identifier from relpath)
|
|
20
|
+
* Uses the Web Crypto API which is available in browsers and Node.js 18+
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateIdentifier(relpath: string): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Generate a UUID v4
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateUUID(): string;
|
|
27
|
+
/**
|
|
28
|
+
* URL-encode a URI for use in API paths
|
|
29
|
+
*/
|
|
30
|
+
export declare function encodeUri(uri: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get current Unix timestamp
|
|
33
|
+
*/
|
|
34
|
+
export declare function getCurrentTimestamp(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Parse ISO timestamp to Unix timestamp
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseISOTimestamp(isoString: string): number;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a signed URL has expired
|
|
41
|
+
*/
|
|
42
|
+
export declare function isExpired(expiryTimestamp: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Calculate remaining time until expiry in seconds
|
|
45
|
+
*/
|
|
46
|
+
export declare function timeUntilExpiry(expiryTimestamp: string): number;
|
|
47
|
+
/**
|
|
48
|
+
* Format bytes to human-readable string
|
|
49
|
+
*/
|
|
50
|
+
export declare function formatBytes(bytes: number, decimals?: number): string;
|
|
51
|
+
/**
|
|
52
|
+
* Create a delay promise (useful for rate limiting)
|
|
53
|
+
*/
|
|
54
|
+
export declare function delay(ms: number): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Retry a function with exponential backoff
|
|
57
|
+
*/
|
|
58
|
+
export declare function withRetry<T>(fn: () => Promise<T>, options?: {
|
|
59
|
+
maxRetries?: number;
|
|
60
|
+
initialDelay?: number;
|
|
61
|
+
maxDelay?: number;
|
|
62
|
+
backoffFactor?: number;
|
|
63
|
+
}): Promise<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Chunk an array into smaller arrays
|
|
66
|
+
*/
|
|
67
|
+
export declare function chunk<T>(array: T[], size: number): T[][];
|
|
68
|
+
/**
|
|
69
|
+
* Run promises with concurrency limit
|
|
70
|
+
*/
|
|
71
|
+
export declare function parallelLimit<T, R>(items: T[], limit: number, fn: (item: T) => Promise<R>): Promise<R[]>;
|
|
72
|
+
export { type AdminMetadata, type AnnotationsResponse, AuthenticationError, AuthorizationError, type BaseURIInfo, type BaseURIPermissionsRequest, DServerClient, type DServerClientConfig, DServerError, type DatasetEntry, type DatasetSignedURLsResponse, type DownloadOptions, type FileToUpload, type GraphDatasetEntry, type ItemSignedURLResponse, type Manifest, type ManifestItem, type ManifestResponse, NotFoundError, type PaginatedResponse, type PaginationInfo, type PaginationParams, type ProgressCallback, type ReadmeResponse, type SearchQuery, type ServerVersions, type SummaryInfo, type TagsResponse, type UploadCompleteRequest, type UploadCompleteResponse, type UploadItem, type UploadItemURL, type UploadOptions, type UploadRequest, type UploadURLs, type UploadURLsResponse, type UserInfo, type UserRequest, type UserUpdateRequest, type UserWithPermissions };
|
|
73
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/utils.ts"],"mappings":";;;;;;;;;;;;;;;;wBAgBgB,sBACd,wCACA,uCACA,qBACC;;;;;wBA8BmB,mBAAmB,kBAAkB;;;;wBAW3C;;;;wBAiBA,UAAU;;;;wBAyBV;;;;wBAOA,kBAAkB;;;;wBAOlB,UAAU;;;;wBASV,gBAAgB;;;;wBAShB,YAAY,eAAe;;;;wBAe3B,MAAM,aAAa;;;;wBAOb,UAAU,GAC9B,UAAU,QAAQ,IAClB;EACE;EACA;EACA;EACA;IAED,QAAQ;;;;wBAuCK,MAAM,GAAG,OAAO,KAAK,eAAe;;;;wBAW9B,cAAc,GAAG,GACrC,OAAO,KACP,eACA,KAAK,MAAM,MAAM,QAAQ,KACxB,QAAQ"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dserver-client - TypeScript/JavaScript client for dserver signed URL API
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { A as UploadCompleteResponse, B as UserWithPermissions, C as ProgressCallback, D as SummaryInfo, E as ServerVersions, F as UploadURLs, I as UploadURLsResponse, L as UserInfo, M as UploadItemURL, N as UploadOptions, O as TagsResponse, P as UploadRequest, R as UserRequest, S as PaginationParams, T as SearchQuery, _ as ManifestItem, a as AuthorizationError, b as PaginatedResponse, c as DServerClientConfig, d as DatasetSignedURLsResponse, f as DownloadOptions, g as Manifest, h as ItemSignedURLResponse, i as AuthenticationError, j as UploadItem, k as UploadCompleteRequest, l as DServerError, m as GraphDatasetEntry, n as AdminMetadata, o as BaseURIInfo, p as FileToUpload, r as AnnotationsResponse, s as BaseURIPermissionsRequest, t as DServerClient, u as DatasetEntry, v as ManifestResponse, w as ReadmeResponse, x as PaginationInfo, y as NotFoundError, z as UserUpdateRequest } from "./client.js";
|
|
7
|
+
/**
|
|
8
|
+
* Parse an X-Pagination response header into a PaginationInfo.
|
|
9
|
+
*
|
|
10
|
+
* dservercore (flask-smorest) emits
|
|
11
|
+
* {"total", "total_pages", "first_page", "last_page", "page", "next_page"}
|
|
12
|
+
* — note: no "pages" or "per_page" fields. Other servers may emit
|
|
13
|
+
* {"total", "page", "per_page", "pages"} directly. Both shapes are
|
|
14
|
+
* normalized here; missing fields are derived from the requested page
|
|
15
|
+
* size and the number of returned items.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parsePaginationHeader(headerValue: string | null | undefined, requestedPageSize: number | undefined, dataLength: number): PaginationInfo;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a SHA-1 hash of a string (item identifier from relpath)
|
|
20
|
+
* Uses the Web Crypto API which is available in browsers and Node.js 18+
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateIdentifier(relpath: string): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Generate a UUID v4
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateUUID(): string;
|
|
27
|
+
/**
|
|
28
|
+
* URL-encode a URI for use in API paths
|
|
29
|
+
*/
|
|
30
|
+
export declare function encodeUri(uri: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get current Unix timestamp
|
|
33
|
+
*/
|
|
34
|
+
export declare function getCurrentTimestamp(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Parse ISO timestamp to Unix timestamp
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseISOTimestamp(isoString: string): number;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a signed URL has expired
|
|
41
|
+
*/
|
|
42
|
+
export declare function isExpired(expiryTimestamp: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Calculate remaining time until expiry in seconds
|
|
45
|
+
*/
|
|
46
|
+
export declare function timeUntilExpiry(expiryTimestamp: string): number;
|
|
47
|
+
/**
|
|
48
|
+
* Format bytes to human-readable string
|
|
49
|
+
*/
|
|
50
|
+
export declare function formatBytes(bytes: number, decimals?: number): string;
|
|
51
|
+
/**
|
|
52
|
+
* Create a delay promise (useful for rate limiting)
|
|
53
|
+
*/
|
|
54
|
+
export declare function delay(ms: number): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Retry a function with exponential backoff
|
|
57
|
+
*/
|
|
58
|
+
export declare function withRetry<T>(fn: () => Promise<T>, options?: {
|
|
59
|
+
maxRetries?: number;
|
|
60
|
+
initialDelay?: number;
|
|
61
|
+
maxDelay?: number;
|
|
62
|
+
backoffFactor?: number;
|
|
63
|
+
}): Promise<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Chunk an array into smaller arrays
|
|
66
|
+
*/
|
|
67
|
+
export declare function chunk<T>(array: T[], size: number): T[][];
|
|
68
|
+
/**
|
|
69
|
+
* Run promises with concurrency limit
|
|
70
|
+
*/
|
|
71
|
+
export declare function parallelLimit<T, R>(items: T[], limit: number, fn: (item: T) => Promise<R>): Promise<R[]>;
|
|
72
|
+
export { type AdminMetadata, type AnnotationsResponse, AuthenticationError, AuthorizationError, type BaseURIInfo, type BaseURIPermissionsRequest, DServerClient, type DServerClientConfig, DServerError, type DatasetEntry, type DatasetSignedURLsResponse, type DownloadOptions, type FileToUpload, type GraphDatasetEntry, type ItemSignedURLResponse, type Manifest, type ManifestItem, type ManifestResponse, NotFoundError, type PaginatedResponse, type PaginationInfo, type PaginationParams, type ProgressCallback, type ReadmeResponse, type SearchQuery, type ServerVersions, type SummaryInfo, type TagsResponse, type UploadCompleteRequest, type UploadCompleteResponse, type UploadItem, type UploadItemURL, type UploadOptions, type UploadRequest, type UploadURLs, type UploadURLsResponse, type UserInfo, type UserRequest, type UserUpdateRequest, type UserWithPermissions };
|
|
73
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/utils.ts"],"mappings":";;;;;;;;;;;;;;;;wBAgBgB,sBACd,wCACA,uCACA,qBACC;;;;;wBA8BmB,mBAAmB,kBAAkB;;;;wBAW3C;;;;wBAiBA,UAAU;;;;wBAyBV;;;;wBAOA,kBAAkB;;;;wBAOlB,UAAU;;;;wBASV,gBAAgB;;;;wBAShB,YAAY,eAAe;;;;wBAe3B,MAAM,aAAa;;;;wBAOb,UAAU,GAC9B,UAAU,QAAQ,IAClB;EACE;EACA;EACA;EACA;IAED,QAAQ;;;;wBAuCK,MAAM,GAAG,OAAO,KAAK,eAAe;;;;wBAW9B,cAAc,GAAG,GACrC,OAAO,KACP,eACA,KAAK,MAAM,MAAM,QAAQ,KACxB,QAAQ"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_client = require("./client.js");
|
|
3
|
+
exports.AuthenticationError = require_client.AuthenticationError;
|
|
4
|
+
exports.AuthorizationError = require_client.AuthorizationError;
|
|
5
|
+
exports.DServerClient = require_client.DServerClient;
|
|
6
|
+
exports.DServerError = require_client.DServerError;
|
|
7
|
+
exports.NotFoundError = require_client.NotFoundError;
|
|
8
|
+
exports.chunk = require_client.chunk;
|
|
9
|
+
exports.delay = require_client.delay;
|
|
10
|
+
exports.encodeUri = require_client.encodeUri;
|
|
11
|
+
exports.formatBytes = require_client.formatBytes;
|
|
12
|
+
exports.generateIdentifier = require_client.generateIdentifier;
|
|
13
|
+
exports.generateUUID = require_client.generateUUID;
|
|
14
|
+
exports.getCurrentTimestamp = require_client.getCurrentTimestamp;
|
|
15
|
+
exports.isExpired = require_client.isExpired;
|
|
16
|
+
exports.parallelLimit = require_client.parallelLimit;
|
|
17
|
+
exports.parseISOTimestamp = require_client.parseISOTimestamp;
|
|
18
|
+
exports.parsePaginationHeader = require_client.parsePaginationHeader;
|
|
19
|
+
exports.timeUntilExpiry = require_client.timeUntilExpiry;
|
|
20
|
+
exports.withRetry = require_client.withRetry;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { h as AuthenticationError, g as AuthorizationError, t as DServerClient, _ as DServerError, v as NotFoundError, n as chunk, r as delay, i as encodeUri, a as formatBytes, o as generateIdentifier, s as generateUUID, c as getCurrentTimestamp, l as isExpired, u as parallelLimit, d as parseISOTimestamp, f as parsePaginationHeader, p as timeUntilExpiry, m as withRetry } from "./client.mjs";
|
package/dist/vue.d.mts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue 3 composables for dserver client
|
|
3
|
+
*
|
|
4
|
+
* These composables provide reactive wrappers around the DServerClient
|
|
5
|
+
* for easy integration with Vue applications.
|
|
6
|
+
*/
|
|
7
|
+
import { A as UploadCompleteResponse, N as UploadOptions, _ as ManifestItem, c as DServerClientConfig, d as DatasetSignedURLsResponse, f as DownloadOptions, g as Manifest, n as AdminMetadata, p as FileToUpload, t as DServerClient } from "./client.mjs";
|
|
8
|
+
import { Ref } from "vue";
|
|
9
|
+
/**
|
|
10
|
+
* Composable for managing a DServerClient instance
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDServerClient(config: Ref<DServerClientConfig> | DServerClientConfig): {
|
|
13
|
+
client: import("vue").ComputedRef<DServerClient>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Composable for downloading dataset items
|
|
17
|
+
*/
|
|
18
|
+
export declare function useDatasetDownload(client: Ref<DServerClient>): {
|
|
19
|
+
loading: Ref<boolean, boolean>;
|
|
20
|
+
error: import("vue").ShallowRef<Error | null, Error | null>;
|
|
21
|
+
urls: import("vue").ShallowRef<DatasetSignedURLsResponse | null, DatasetSignedURLsResponse | null>;
|
|
22
|
+
manifest: import("vue").ShallowRef<Manifest | null, Manifest | null>;
|
|
23
|
+
adminMetadata: import("vue").ShallowRef<AdminMetadata | null, AdminMetadata | null>;
|
|
24
|
+
readme: Ref<string | null, string | null>;
|
|
25
|
+
progress: Ref<{
|
|
26
|
+
loaded: number;
|
|
27
|
+
total: number;
|
|
28
|
+
item?: string | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
loaded: number;
|
|
31
|
+
total: number;
|
|
32
|
+
item?: string;
|
|
33
|
+
} | {
|
|
34
|
+
loaded: number;
|
|
35
|
+
total: number;
|
|
36
|
+
item?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
items: import("vue").ComputedRef<{
|
|
39
|
+
hash: string;
|
|
40
|
+
relpath: string;
|
|
41
|
+
size_in_bytes: number;
|
|
42
|
+
utc_timestamp: number;
|
|
43
|
+
identifier: string;
|
|
44
|
+
}[]>;
|
|
45
|
+
loadDataset: (uri: string) => Promise<void>;
|
|
46
|
+
loadManifest: () => Promise<Manifest | null>;
|
|
47
|
+
loadAdminMetadata: () => Promise<AdminMetadata | null>;
|
|
48
|
+
loadReadme: () => Promise<string | null>;
|
|
49
|
+
downloadItem: (identifier: string, options?: DownloadOptions) => Promise<ArrayBuffer>;
|
|
50
|
+
downloadItemAsBlob: (identifier: string, mimeType?: string, options?: DownloadOptions) => Promise<Blob>;
|
|
51
|
+
downloadItemToFile: (identifier: string, filename: string, mimeType?: string, options?: DownloadOptions) => Promise<void>;
|
|
52
|
+
getItemDetails: (identifier: string) => ManifestItem | null;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Composable for uploading datasets
|
|
56
|
+
*/
|
|
57
|
+
export declare function useDatasetUpload(client: Ref<DServerClient>): {
|
|
58
|
+
loading: Ref<boolean, boolean>;
|
|
59
|
+
error: import("vue").ShallowRef<Error | null, Error | null>;
|
|
60
|
+
progress: Ref<{
|
|
61
|
+
uploaded: number;
|
|
62
|
+
total: number;
|
|
63
|
+
currentFile?: string | undefined;
|
|
64
|
+
phase: "preparing" | "uploading" | "finalizing" | "complete" | "error";
|
|
65
|
+
}, {
|
|
66
|
+
uploaded: number;
|
|
67
|
+
total: number;
|
|
68
|
+
currentFile?: string;
|
|
69
|
+
phase: "preparing" | "uploading" | "finalizing" | "complete" | "error";
|
|
70
|
+
} | {
|
|
71
|
+
uploaded: number;
|
|
72
|
+
total: number;
|
|
73
|
+
currentFile?: string | undefined;
|
|
74
|
+
phase: "preparing" | "uploading" | "finalizing" | "complete" | "error";
|
|
75
|
+
}>;
|
|
76
|
+
progressPercent: import("vue").ComputedRef<number>;
|
|
77
|
+
result: import("vue").ShallowRef<UploadCompleteResponse | null, UploadCompleteResponse | null>;
|
|
78
|
+
uploadDataset: (baseUri: string, name: string, files: FileToUpload[], options?: UploadOptions) => Promise<UploadCompleteResponse>;
|
|
79
|
+
uploadFromFileList: (baseUri: string, name: string, fileList: FileList, basePath?: string, options?: UploadOptions) => Promise<UploadCompleteResponse>;
|
|
80
|
+
uploadFromDataTransfer: (baseUri: string, name: string, dataTransfer: DataTransfer, options?: UploadOptions) => Promise<UploadCompleteResponse>;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=vue.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.mts","names":["_$__types0.ManifestItem"],"sources":["../src/vue.ts"],"mappings":";;;;;;;;;;;wBAuBgB,iBAAiB,QAAQ,IAAI,uBAAuB;;;;;;wBAYpD,mBAAmB,QAAQ,IAAI;;;;;;;;IAQd;IAAe;IAAe;;IAA9B;IAAe;IAAe;;IAA9B;IAAe;IAAe;;;;;;;;;EAQ7B,cAAA,gBAAS;EAiBV,oBAAA,QAAQ;EAsBH,yBAAA,QAAQ;EAsBf,kBAAA;EAuBf,eAAA,oBAAM,UACR,oBACT,QAAQ;EA8BG,qBAAA,oBAAM,mBACD,UACP,oBACT,QAAQ;EASG,qBAAA,oBAAM,kBACF,mBACC,UACP,oBACT;EAeiC,iBAAA,uBAfjCA;;;;;wBAyDW,iBAAiB,QAAQ,IAAI;;;;IAI/B;IACH;IACO;IACP;;IAHG;IACH;IACO;IACP;;IAHG;IACH;IACO;IACP;;;;EAaE,gBAAA,iBAAM,cACH,OACL,gBAAc,UACX,kBACT,QAAQ;EA2CA,qBAAA,iBAAM,cACH,UACF,UAAQ,mBACF,UACN,kBACT,QAAQ;EAcA,yBAAA,iBAAM,cACH,cACE,cAAY,UAChB,kBACT,QAAQ"}
|
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue 3 composables for dserver client
|
|
3
|
+
*
|
|
4
|
+
* These composables provide reactive wrappers around the DServerClient
|
|
5
|
+
* for easy integration with Vue applications.
|
|
6
|
+
*/
|
|
7
|
+
import { A as UploadCompleteResponse, N as UploadOptions, _ as ManifestItem, c as DServerClientConfig, d as DatasetSignedURLsResponse, f as DownloadOptions, g as Manifest, n as AdminMetadata, p as FileToUpload, t as DServerClient } from "./client.js";
|
|
8
|
+
import { Ref } from "vue";
|
|
9
|
+
/**
|
|
10
|
+
* Composable for managing a DServerClient instance
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDServerClient(config: Ref<DServerClientConfig> | DServerClientConfig): {
|
|
13
|
+
client: import("vue").ComputedRef<DServerClient>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Composable for downloading dataset items
|
|
17
|
+
*/
|
|
18
|
+
export declare function useDatasetDownload(client: Ref<DServerClient>): {
|
|
19
|
+
loading: Ref<boolean, boolean>;
|
|
20
|
+
error: import("vue").ShallowRef<Error | null, Error | null>;
|
|
21
|
+
urls: import("vue").ShallowRef<DatasetSignedURLsResponse | null, DatasetSignedURLsResponse | null>;
|
|
22
|
+
manifest: import("vue").ShallowRef<Manifest | null, Manifest | null>;
|
|
23
|
+
adminMetadata: import("vue").ShallowRef<AdminMetadata | null, AdminMetadata | null>;
|
|
24
|
+
readme: Ref<string | null, string | null>;
|
|
25
|
+
progress: Ref<{
|
|
26
|
+
loaded: number;
|
|
27
|
+
total: number;
|
|
28
|
+
item?: string | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
loaded: number;
|
|
31
|
+
total: number;
|
|
32
|
+
item?: string;
|
|
33
|
+
} | {
|
|
34
|
+
loaded: number;
|
|
35
|
+
total: number;
|
|
36
|
+
item?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
items: import("vue").ComputedRef<{
|
|
39
|
+
hash: string;
|
|
40
|
+
relpath: string;
|
|
41
|
+
size_in_bytes: number;
|
|
42
|
+
utc_timestamp: number;
|
|
43
|
+
identifier: string;
|
|
44
|
+
}[]>;
|
|
45
|
+
loadDataset: (uri: string) => Promise<void>;
|
|
46
|
+
loadManifest: () => Promise<Manifest | null>;
|
|
47
|
+
loadAdminMetadata: () => Promise<AdminMetadata | null>;
|
|
48
|
+
loadReadme: () => Promise<string | null>;
|
|
49
|
+
downloadItem: (identifier: string, options?: DownloadOptions) => Promise<ArrayBuffer>;
|
|
50
|
+
downloadItemAsBlob: (identifier: string, mimeType?: string, options?: DownloadOptions) => Promise<Blob>;
|
|
51
|
+
downloadItemToFile: (identifier: string, filename: string, mimeType?: string, options?: DownloadOptions) => Promise<void>;
|
|
52
|
+
getItemDetails: (identifier: string) => ManifestItem | null;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Composable for uploading datasets
|
|
56
|
+
*/
|
|
57
|
+
export declare function useDatasetUpload(client: Ref<DServerClient>): {
|
|
58
|
+
loading: Ref<boolean, boolean>;
|
|
59
|
+
error: import("vue").ShallowRef<Error | null, Error | null>;
|
|
60
|
+
progress: Ref<{
|
|
61
|
+
uploaded: number;
|
|
62
|
+
total: number;
|
|
63
|
+
currentFile?: string | undefined;
|
|
64
|
+
phase: "preparing" | "uploading" | "finalizing" | "complete" | "error";
|
|
65
|
+
}, {
|
|
66
|
+
uploaded: number;
|
|
67
|
+
total: number;
|
|
68
|
+
currentFile?: string;
|
|
69
|
+
phase: "preparing" | "uploading" | "finalizing" | "complete" | "error";
|
|
70
|
+
} | {
|
|
71
|
+
uploaded: number;
|
|
72
|
+
total: number;
|
|
73
|
+
currentFile?: string | undefined;
|
|
74
|
+
phase: "preparing" | "uploading" | "finalizing" | "complete" | "error";
|
|
75
|
+
}>;
|
|
76
|
+
progressPercent: import("vue").ComputedRef<number>;
|
|
77
|
+
result: import("vue").ShallowRef<UploadCompleteResponse | null, UploadCompleteResponse | null>;
|
|
78
|
+
uploadDataset: (baseUri: string, name: string, files: FileToUpload[], options?: UploadOptions) => Promise<UploadCompleteResponse>;
|
|
79
|
+
uploadFromFileList: (baseUri: string, name: string, fileList: FileList, basePath?: string, options?: UploadOptions) => Promise<UploadCompleteResponse>;
|
|
80
|
+
uploadFromDataTransfer: (baseUri: string, name: string, dataTransfer: DataTransfer, options?: UploadOptions) => Promise<UploadCompleteResponse>;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.ts","names":["_$__types0.ManifestItem"],"sources":["../src/vue.ts"],"mappings":";;;;;;;;;;;wBAuBgB,iBAAiB,QAAQ,IAAI,uBAAuB;;;;;;wBAYpD,mBAAmB,QAAQ,IAAI;;;;;;;;IAQd;IAAe;IAAe;;IAA9B;IAAe;IAAe;;IAA9B;IAAe;IAAe;;;;;;;;;EAQ7B,cAAA,gBAAS;EAiBV,oBAAA,QAAQ;EAsBH,yBAAA,QAAQ;EAsBf,kBAAA;EAuBf,eAAA,oBAAM,UACR,oBACT,QAAQ;EA8BG,qBAAA,oBAAM,mBACD,UACP,oBACT,QAAQ;EASG,qBAAA,oBAAM,kBACF,mBACC,UACP,oBACT;EAeiC,iBAAA,uBAfjCA;;;;;wBAyDW,iBAAiB,QAAQ,IAAI;;;;IAI/B;IACH;IACO;IACP;;IAHG;IACH;IACO;IACP;;IAHG;IACH;IACO;IACP;;;;EAaE,gBAAA,iBAAM,cACH,OACL,gBAAc,UACX,kBACT,QAAQ;EA2CA,qBAAA,iBAAM,cACH,UACF,UAAQ,mBACF,UACN,kBACT,QAAQ;EAcA,yBAAA,iBAAM,cACH,cACE,cAAY,UAChB,kBACT,QAAQ"}
|