@knime/product-features 6.4.0 → 7.0.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 +24 -0
- package/README.md +0 -1
- package/dist/ai.css +21 -21
- package/dist/ai.js +1 -1
- package/dist/ai.js.map +1 -1
- package/dist/{core-CIwP11Fc.js → core-n-n9OaZY.js} +2 -2
- package/dist/{core-CIwP11Fc.js.map → core-n-n9OaZY.js.map} +1 -1
- package/dist/dataTransfer/core.js +1 -1
- package/dist/dataTransfer.js +3 -31
- package/dist/dataTransfer.js.map +1 -1
- package/dist/{dist-htLRPkoq.js → dist-D193M-Gt.js} +27 -11
- package/dist/{dist-htLRPkoq.js.map → dist-D193M-Gt.js.map} +1 -1
- package/dist/embedding.js +30 -6
- package/dist/embedding.js.map +1 -1
- package/dist/embeddingSDK.js +1 -1
- package/dist/{rfcErrors-CNWg8BiD.js → rfcErrors-DdxFC4Hg.js} +2 -2
- package/dist/{rfcErrors-CNWg8BiD.js.map → rfcErrors-DdxFC4Hg.js.map} +1 -1
- package/dist/rfcErrors.js +1 -1
- package/dist/src/dataTransfer/upload/useFileUpload.d.ts.map +1 -1
- package/dist/src/embedding/index.d.ts +1 -1
- package/dist/src/embedding/index.d.ts.map +1 -1
- package/dist/src/embedding/outlets/index.d.ts +6 -1
- package/dist/src/embedding/outlets/index.d.ts.map +1 -1
- package/dist/src/embedding/outlets/versions.d.ts +93 -0
- package/dist/src/embedding/outlets/versions.d.ts.map +1 -0
- package/dist/toasts.js +1 -1
- package/package.json +7 -11
- package/dist/src/versions/CreateVersionForm/CreateVersionForm.vue.d.ts +0 -17
- package/dist/src/versions/CreateVersionForm/CreateVersionForm.vue.d.ts.map +0 -1
- package/dist/src/versions/CreateVersionForm/index.d.ts +0 -3
- package/dist/src/versions/CreateVersionForm/index.d.ts.map +0 -1
- package/dist/src/versions/CreateVersionForm/types.d.ts +0 -5
- package/dist/src/versions/CreateVersionForm/types.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/CurrentState.vue.d.ts +0 -21
- package/dist/src/versions/VersionHistory/CurrentState.vue.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/HistoryEvent.vue.d.ts +0 -19
- package/dist/src/versions/VersionHistory/HistoryEvent.vue.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/HistoryEventAuthor.vue.d.ts +0 -8
- package/dist/src/versions/VersionHistory/HistoryEventAuthor.vue.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/HistoryEventFooter.vue.d.ts +0 -9
- package/dist/src/versions/VersionHistory/HistoryEventFooter.vue.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/VersionHistory.vue.d.ts +0 -21
- package/dist/src/versions/VersionHistory/VersionHistory.vue.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/VersionItem.vue.d.ts +0 -22
- package/dist/src/versions/VersionHistory/VersionItem.vue.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/VersionLabel.vue.d.ts +0 -17
- package/dist/src/versions/VersionHistory/VersionLabel.vue.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/VersionLimitInfo.vue.d.ts +0 -10
- package/dist/src/versions/VersionHistory/VersionLimitInfo.vue.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/constants.d.ts +0 -4
- package/dist/src/versions/VersionHistory/constants.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/index.d.ts +0 -4
- package/dist/src/versions/VersionHistory/index.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/mock-data/index.d.ts +0 -11
- package/dist/src/versions/VersionHistory/mock-data/index.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/mock-data/savepoints.d.ts +0 -5
- package/dist/src/versions/VersionHistory/mock-data/savepoints.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/mock-data/versionHistory.d.ts +0 -7
- package/dist/src/versions/VersionHistory/mock-data/versionHistory.d.ts.map +0 -1
- package/dist/src/versions/VersionHistory/types.d.ts +0 -105
- package/dist/src/versions/VersionHistory/types.d.ts.map +0 -1
- package/dist/src/versions/index.d.ts +0 -5
- package/dist/src/versions/index.d.ts.map +0 -1
- package/dist/versions.css +0 -108
- package/dist/versions.js +0 -584
- package/dist/versions.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-CIwP11Fc.js","names":["#length","#chunks"],"sources":["../../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/object/merge.mjs","../src/dataTransfer/shared/httpClient/constants.ts","../src/dataTransfer/shared/httpClient/createHttpClient.ts","../src/dataTransfer/upload/core/uploadManager/config.ts","../src/dataTransfer/upload/core/uploadManager/state.ts","../src/dataTransfer/upload/core/uploadManager/uploadPartBytes.ts","../src/dataTransfer/upload/core/uploadManager/chunkedUploadManager.ts","../src/dataTransfer/upload/core/uploadManager/streamingUploadManager.ts","../src/dataTransfer/upload/core/uploadManager/types.ts","../src/dataTransfer/upload/core/uploadClient/uploadClient.ts","../../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/array/chunk.mjs","../src/dataTransfer/upload/core/uploadClient/createUploadStatusPoller.ts"],"sourcesContent":["//#region src/predicate/isPlainObject.ts\n/**\n* Checks if a given value is a plain object.\n*\n* @param value - The value to check.\n* @returns True if the value is a plain object, otherwise false.\n*\n* @example\n* ```typescript\n* // ✅👇 True\n*\n* isPlainObject({ }); // ✅\n* isPlainObject({ key: 'value' }); // ✅\n* isPlainObject({ key: new Date() }); // ✅\n* isPlainObject(new Object()); // ✅\n* isPlainObject(Object.create(null)); // ✅\n* isPlainObject({ nested: { key: true} }); // ✅\n* isPlainObject(new Proxy({}, {})); // ✅\n* isPlainObject({ [Symbol('tag')]: 'A' }); // ✅\n*\n* // ✅👇 (cross-realms, node context, workers, ...)\n* const runInNewContext = await import('node:vm').then(\n* (mod) => mod.runInNewContext\n* );\n* isPlainObject(runInNewContext('({})')); // ✅\n*\n* // ❌👇 False\n*\n* class Test { };\n* isPlainObject(new Test()) // ❌\n* isPlainObject(10); // ❌\n* isPlainObject(null); // ❌\n* isPlainObject('hello'); // ❌\n* isPlainObject([]); // ❌\n* isPlainObject(new Date()); // ❌\n* isPlainObject(new Uint8Array([1])); // ❌\n* isPlainObject(Buffer.from('ABC')); // ❌\n* isPlainObject(Promise.resolve({})); // ❌\n* isPlainObject(Object.create({})); // ❌\n* isPlainObject(new (class Cls {})); // ❌\n* isPlainObject(globalThis); // ❌,\n* ```\n*/\nfunction isPlainObject(value) {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst proto = Object.getPrototypeOf(value);\n\tif (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;\n\treturn Object.prototype.toString.call(value) === \"[object Object]\";\n}\n//#endregion\nexport { isPlainObject };\n","//#region src/_internal/isUnsafeProperty.ts\n/**\n* Checks if a property key is unsafe to modify directly.\n*\n* This function is used in functions like `merge` to prevent prototype pollution attacks\n* by identifying property keys that could modify the object's prototype chain or constructor.\n*\n* @param key - The property key to check\n* @returns `true` if the property is unsafe to modify directly, `false` otherwise\n* @internal\n*/\nfunction isUnsafeProperty(key) {\n\treturn key === \"__proto__\";\n}\n//#endregion\nexport { isUnsafeProperty };\n","import { isPlainObject } from \"../predicate/isPlainObject.mjs\";\nimport { isUnsafeProperty } from \"../_internal/isUnsafeProperty.mjs\";\n//#region src/object/merge.ts\n/**\n* Merges the properties of the source object into the target object.\n*\n* This function performs a deep merge, meaning nested objects and arrays are merged recursively.\n* If a property in the source object is an array or an object and the corresponding property in the target object is also an array or object, they will be merged.\n* If a property in the source object is undefined, it will not overwrite a defined property in the target object.\n*\n* Note that this function mutates the target object.\n*\n* @param target - The target object into which the source object properties will be merged. This object is modified in place.\n* @param source - The source object whose properties will be merged into the target object.\n* @returns The updated target object with properties from the source object merged in.\n*\n* @template T - Type of the target object.\n* @template S - Type of the source object.\n*\n* @example\n* const target = { a: 1, b: { x: 1, y: 2 } };\n* const source = { b: { y: 3, z: 4 }, c: 5 };\n*\n* const result = merge(target, source);\n* console.log(result);\n* // Output: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 5 }\n*\n* @example\n* const target = { a: [1, 2], b: { x: 1 } };\n* const source = { a: [3], b: { y: 2 } };\n*\n* const result = merge(target, source);\n* console.log(result);\n* // Output: { a: [3, 2], b: { x: 1, y: 2 } }\n*\n* @example\n* const target = { a: null };\n* const source = { a: [1, 2, 3] };\n*\n* const result = merge(target, source);\n* console.log(result);\n* // Output: { a: [1, 2, 3] }\n*/\nfunction merge(target, source) {\n\tconst sourceKeys = Object.keys(source);\n\tfor (let i = 0; i < sourceKeys.length; i++) {\n\t\tconst key = sourceKeys[i];\n\t\tif (isUnsafeProperty(key)) continue;\n\t\tconst sourceValue = source[key];\n\t\tconst targetValue = target[key];\n\t\tif (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) target[key] = merge(targetValue, sourceValue);\n\t\telse if (Array.isArray(sourceValue)) target[key] = merge([], sourceValue);\n\t\telse if (isPlainObject(sourceValue)) target[key] = merge({}, sourceValue);\n\t\telse if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;\n\t}\n\treturn target;\n}\nfunction isMergeableValue(value) {\n\treturn isPlainObject(value) || Array.isArray(value);\n}\n//#endregion\nexport { merge };\n","export const API_BASE_URL = \"/_/api\";\n","import { merge } from \"es-toolkit/object\";\nimport { type FetchOptions, ofetch } from \"ofetch\";\n\nimport { API_BASE_URL } from \"./constants\";\n\nconst defaultConfig: FetchOptions = {\n baseURL: API_BASE_URL,\n headers: {\n \"Content-Type\": \"application/json\",\n\n // see: https://knime-com.atlassian.net/wiki/spaces/SPECS/pages/4126769212/API+Errors#Client-Request-Headers\n Accept: \"application/json; application/problem+json\",\n },\n} as const;\n\nconst createHttpClient = (customOptions?: FetchOptions) => {\n return ofetch.create(\n merge(structuredClone(defaultConfig), customOptions ?? {}),\n );\n};\n\nexport { type FetchOptions, defaultConfig, createHttpClient };\n","/**\n * Configuration constants shared by the upload managers\n */\nexport const CONFIG = Object.freeze({\n /** Size, in bytes, of each uploaded file part. */\n CHUNK_SIZE: 50 * 1024 * 1024, // 50 MB per chunk\n /** Max number of retries for a failed request (part-url resolution or the chunk upload itself). */\n DEFAULT_RETRY_COUNT: 5,\n /** Delay, in ms, between retries. */\n DEFAULT_RETRY_DELAY_MS: 50,\n});\n","import { promise as promiseUtils } from \"@knime/utils\";\n\nimport type { UploadStateName } from \"./types\";\n\ntype UploadState = {\n uploadId: string;\n fileDescriptor?: { name: string; type: string };\n completedChunkCount: number;\n uploadedByteCount: number;\n state: UploadStateName;\n abortController: AbortController;\n};\n\nexport const createStateManager = () => {\n const uploadStateMap = new Map<string, UploadState>();\n\n const completedUploads = new Set<string>();\n const cancelledUploads = new Set<string>();\n const failedUploads = new Set<string>();\n\n const assertState = (uploadId: string, state: UploadStateName) =>\n uploadStateMap.has(uploadId) &&\n uploadStateMap.get(uploadId)!.state === state;\n\n const getUploadState = (uploadId: string) => uploadStateMap.get(uploadId);\n const setUploadState = (uploadId: string, state: Partial<UploadState>) => {\n uploadStateMap.set(uploadId, {\n ...uploadStateMap.get(uploadId)!,\n ...state,\n });\n };\n\n const isFailed = (uploadId: string) => assertState(uploadId, \"failed\");\n const isCancelled = (uploadId: string) => assertState(uploadId, \"cancelled\");\n\n const abortInFlightUpload = (uploadId: string, reason: string) => {\n const currentState = uploadStateMap.get(uploadId);\n\n if (!currentState) {\n return;\n }\n\n const message = currentState.fileDescriptor\n ? `Upload (${currentState.uploadId}) for file \"${currentState.fileDescriptor.name}\" aborted. Reason: \"${reason}\"`\n : `Upload (${currentState.uploadId}) aborted. Reason: \"${reason}\"`;\n\n currentState.abortController.abort(new promiseUtils.AbortError(message));\n };\n\n const cancel = (uploadId: string) => {\n if (!uploadStateMap.has(uploadId)) {\n consola.error(\"cancel:: Invalid upload id\");\n return;\n }\n\n setUploadState(uploadId, { state: \"cancelled\" });\n\n abortInFlightUpload(uploadId, \"upload cancelled\");\n cancelledUploads.add(uploadId);\n };\n\n const cancelAll = () => {\n for (const [id, upload] of uploadStateMap.entries()) {\n if (upload.state === \"inprogress\") {\n cancel(id);\n }\n }\n };\n\n const setCompleted = (uploadId: string, completedChunkCount: number) => {\n setUploadState(uploadId, {\n completedChunkCount,\n state: \"complete\",\n });\n completedUploads.add(uploadId);\n };\n\n const setFailed = (uploadId: string) => {\n if (!uploadStateMap.has(uploadId)) {\n consola.error(\"failed:: Invalid upload id\");\n return;\n }\n\n setUploadState(uploadId, { state: \"failed\" });\n failedUploads.add(uploadId);\n\n if (completedUploads.has(uploadId)) {\n completedUploads.delete(uploadId);\n }\n };\n\n const flush = () => {\n // state cleanup\n const completed = [...completedUploads.values()];\n const cancelled = [...cancelledUploads.values()];\n const failed = [...failedUploads.values()];\n\n [...completed, ...cancelled, ...failed].forEach((uploadId) =>\n uploadStateMap.delete(uploadId),\n );\n\n completedUploads.clear();\n cancelledUploads.clear();\n failedUploads.clear();\n\n return {\n completed,\n cancelled,\n failed,\n };\n };\n\n return {\n get: getUploadState,\n set: setUploadState,\n isFailed,\n isCancelled,\n cancel,\n cancelAll,\n setCompleted,\n setFailed,\n abortInFlightUpload,\n flush,\n };\n};\n","export type PartUploadResponse = {\n partId: string;\n};\n\n/**\n * Uploads a single file part via XHR, reporting upload progress and\n * resolving with the part's identifying ETag (or an empty string if the\n * backend doesn't return one).\n */\nexport const uploadPartBytesWithProgress = (params: {\n method: string;\n url: string;\n partBytes: Blob;\n partIndex: number;\n onProgress: (progress: number) => void;\n abortSignal: AbortSignal;\n}): Promise<PartUploadResponse> => {\n const { method, url, partBytes, partIndex, onProgress, abortSignal } = params;\n\n const OK = 200;\n const CREATED = 201;\n\n return new Promise<PartUploadResponse>((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n\n xhr.open(method, url, true);\n\n abortSignal.addEventListener(\"abort\", () => xhr.abort());\n\n // Track the upload progress of the current part\n xhr.upload.onprogress = (event) => {\n if (event.lengthComputable) {\n onProgress(event.loaded);\n }\n };\n\n xhr.onload = () => {\n if (xhr.status === OK || xhr.status === CREATED) {\n const etag = xhr.getResponseHeader(\"ETag\");\n\n // 1. note that some backends don't return the etag header, then we just set an empty string\n // 2. remove possible doublequotes (\") around the etag and/or weak identifier (if either is present)\n // https://datatracker.ietf.org/doc/html/rfc7232#section-2.3\n resolve({ partId: etag?.replace(/^(?:W\\/)?\"|\"$/g, \"\") ?? \"\" });\n } else {\n consola.error(\"Failed or unexpected XHR response\", {\n xhrStatus: xhr.status,\n xhrResponse: xhr.response,\n partIndex,\n });\n reject(new Error(\"Failed to upload file\"));\n }\n };\n\n xhr.onerror = (event) => {\n consola.error(\"Failed to upload part\", {\n xhrErrorEvent: event,\n partIndex,\n });\n reject(new Error(\"Failed to upload file\"));\n };\n\n xhr.send(partBytes);\n });\n};\n","import { promise as promiseUtils } from \"@knime/utils\";\n\nimport { CONFIG } from \"./config\";\nimport { createStateManager } from \"./state\";\nimport type { BaseUploadManagerConfig } from \"./types\";\nimport { uploadPartBytesWithProgress } from \"./uploadPartBytes\";\n\nexport type ChunkUploadManagerConfig = BaseUploadManagerConfig & {\n /**\n * Callback that gets triggered when the progress of a file part upload\n * for a specific upload id is updated\n * @param uploadId\n * @param progress\n * @returns\n */\n onProgress?: (uploadId: string, progress: number) => void;\n};\n\n/**\n * Creates and returns an `uploadManager`, a comprehensive multi-file, multi-part upload handler.\n *\n * The `uploadManager` offers functionality for handling file uploads in parts and provides\n * several built-in mechanisms to ensure the process is reliable and adaptable.\n *\n * Key features include:\n *\n * - **Chunked File Uploads**: Splits provided files into manageable chunks and initiates the upload\n * for each part using the `resolveFilePartUploadURL` function provided in the configuration.\n *\n * - **Retry Mechanism**: Automatically retries failed upload attempts up to a maximum of 5 times\n * per failed request.\n *\n * - **Upload Cancellation**: Allows cancellation of ongoing uploads, giving users control over the process.\n *\n * - **Progress Tracking**: Monitors the progress of each file part upload and triggers the `onProgress`\n * callback to provide updates.\n *\n * - **Error Handling**: The returned `uploadFiles` function does not throw errors directly. Instead,\n * it manages retries and stops any failed uploads after the retry limit is reached, marking them as failed.\n * This ensures that the promise it returns completes gracefully without uncaught exceptions.\n *\n * This is the \"slice-based\" manager: it needs each file's complete bytes to already be\n * available (as a real `File`/`Blob` with a known `.size`), since it produces each part via\n * `file.slice()`. For uploading from a source whose total size isn't known upfront (e.g. a\n * stream of compressed output), see `createStreamingUploadManager` instead.\n */\nexport const createUploadManager = (config: ChunkUploadManagerConfig) => {\n const {\n resolveFilePartUploadURL: getUploadFilePartUrl,\n onFileUploadComplete,\n onFileUploadFailed,\n } = config;\n const state = createStateManager();\n\n const getTotalFileParts = (file: File) =>\n Math.ceil(file.size / CONFIG.CHUNK_SIZE);\n\n const uploadFileFromChunkIndex = async (uploadId: string, file: File) => {\n const totalChunks = getTotalFileParts(file);\n const totalBytes = file.size;\n const completedPartIds: Record<number, string> = {};\n\n const { abortController, runAbortablePromise } =\n promiseUtils.createAbortablePromise();\n\n state.set(uploadId, {\n uploadId,\n fileDescriptor: { name: file.name, type: file.type },\n state: \"inprogress\",\n uploadedByteCount: state.get(uploadId)?.uploadedByteCount ?? 0,\n completedChunkCount: state.get(uploadId)?.completedChunkCount ?? 0,\n abortController,\n });\n\n let chunkIndex = 0;\n let uploadedBytes = state.get(uploadId)?.uploadedByteCount;\n\n while (chunkIndex < totalChunks) {\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n break;\n }\n\n const start = chunkIndex * CONFIG.CHUNK_SIZE;\n const end = Math.min(start + CONFIG.CHUNK_SIZE, file.size);\n\n const chunk = file.slice(start, end);\n\n try {\n const { method, url } = await promiseUtils.retryPromise({\n fn: () => getUploadFilePartUrl(uploadId, chunkIndex + 1),\n retryCount: CONFIG.DEFAULT_RETRY_COUNT,\n retryDelayMS: CONFIG.DEFAULT_RETRY_DELAY_MS,\n });\n\n consola.trace(\"File part upload url resolved\", { method, url });\n\n const onChunkUploadProgress = (uploadedChunkBytes: number) => {\n uploadedBytes = uploadedChunkBytes + start;\n state.set(uploadId, { uploadedByteCount: uploadedBytes });\n\n const progress = Math.round((uploadedBytes / totalBytes) * 100);\n\n config.onProgress?.(uploadId, progress);\n };\n\n const filePartResponse = await runAbortablePromise(() =>\n promiseUtils.retryPromise({\n fn: () =>\n uploadPartBytesWithProgress({\n method,\n url,\n partBytes: chunk,\n partIndex: chunkIndex,\n onProgress: onChunkUploadProgress,\n abortSignal: abortController.signal,\n }),\n retryCount: CONFIG.DEFAULT_RETRY_COUNT,\n retryDelayMS: CONFIG.DEFAULT_RETRY_DELAY_MS,\n }),\n );\n\n consola.trace(\n `${file.name}: Chunk ${chunkIndex + 1} of ${totalChunks} uploaded successfully`,\n );\n\n completedPartIds[chunkIndex + 1] = filePartResponse.partId;\n\n state.set(uploadId, {\n completedChunkCount: state.get(uploadId)!.completedChunkCount + 1,\n });\n } catch (_error) {\n if (_error instanceof promiseUtils.AbortError) {\n consola.info(\"Aborted::\", _error);\n return;\n }\n\n const error =\n _error instanceof Error ? _error : new Error(_error as string);\n\n state.setFailed(uploadId);\n\n onFileUploadFailed?.({ uploadId, error });\n return;\n }\n\n chunkIndex++;\n }\n\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n return;\n }\n\n state.setCompleted(uploadId, totalChunks);\n onFileUploadComplete?.({ uploadId, filePartIds: completedPartIds });\n };\n\n const uploadFiles = (files: Array<{ uploadId: string; file: File }>) => {\n const result: Array<Promise<unknown>> = [];\n\n for (const { uploadId, file } of files) {\n result.push(uploadFileFromChunkIndex(uploadId, file));\n }\n\n return Promise.allSettled(result).then(() => state.flush());\n };\n\n return {\n uploadFiles,\n\n getUploadState: state.get,\n isFailed: state.isFailed,\n isCancelled: state.isCancelled,\n cancel: state.cancel,\n cancelAll: state.cancelAll,\n setFailed: state.setFailed,\n };\n};\n","import { promise as promiseUtils } from \"@knime/utils\";\n\nimport { CONFIG } from \"./config\";\nimport { createStateManager } from \"./state\";\nimport type { BaseUploadManagerConfig } from \"./types\";\nimport { uploadPartBytesWithProgress } from \"./uploadPartBytes\";\n\nexport type StreamingUploadManagerConfig = BaseUploadManagerConfig & {\n /**\n * Callback triggered as bytes are uploaded. This reports an absolute byte count rather\n * than a percentage: the total size isn't known upfront for a stream.\n */\n onProgress?: (uploadId: string, uploadedBytes: number) => void;\n};\n\n/**\n * A small FIFO byte buffer. Pushed chunks are stored by reference (no\n * copying on push).\n */\nclass ByteQueue {\n #chunks: Uint8Array[] = [];\n #length = 0;\n\n get length() {\n return this.#length;\n }\n\n push(chunk: Uint8Array) {\n if (chunk.length === 0) {\n return;\n }\n this.#chunks.push(chunk);\n this.#length += chunk.length;\n }\n\n /**\n * FIFO exactly `n` bytes from the buffer. If the first chunk has more bytes than needed,\n * it will be split and only the requested amount returned. This ensures each byte is copied\n * at most once, regardless of how many small chunks it took to accumulate them.\n * @param n\n * @returns\n */\n take(n: number): Uint8Array<ArrayBuffer> {\n const size = Math.min(n, this.#length);\n const result = new Uint8Array(size);\n let offset = 0;\n\n while (offset < size) {\n const chunk = this.#chunks[0];\n const needed = size - offset;\n\n if (chunk.length <= needed) {\n result.set(chunk, offset);\n offset += chunk.length;\n this.#chunks.shift();\n } else {\n result.set(chunk.subarray(0, needed), offset);\n this.#chunks[0] = chunk.subarray(needed);\n offset += needed;\n }\n }\n\n this.#length -= size;\n return result;\n }\n\n takeAll(): Uint8Array<ArrayBuffer> {\n return this.take(this.#length);\n }\n}\n\nconst readStreamAndUpload = async (\n state: ReturnType<typeof createStateManager>,\n uploadId: string,\n stream: ReadableStream<Uint8Array>,\n uploadPart: (bytes: Uint8Array<ArrayBuffer>) => Promise<void>,\n config: StreamingUploadManagerConfig,\n // eslint-disable-next-line max-params\n) => {\n const buffer = new ByteQueue();\n const reader = stream.getReader();\n\n const closeReader = async () => {\n try {\n await reader.cancel();\n } catch {\n // stream already closed/errored - nothing left to cancel\n } finally {\n reader.releaseLock();\n }\n };\n\n try {\n while (true) {\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n return;\n }\n\n const { value, done } = await reader.read();\n\n if (value) {\n buffer.push(value);\n }\n\n while (buffer.length >= CONFIG.CHUNK_SIZE) {\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n return;\n }\n\n await uploadPart(buffer.take(CONFIG.CHUNK_SIZE));\n }\n\n if (done) {\n // when stream is done, if there's still any content in the buffer\n // then take all remaining bytes and upload them\n if (\n buffer.length > 0 &&\n !state.isCancelled(uploadId) &&\n !state.isFailed(uploadId)\n ) {\n await uploadPart(buffer.takeAll());\n }\n break;\n }\n }\n } catch (_error) {\n if (_error instanceof promiseUtils.AbortError) {\n consola.info(\"Aborted::\", _error);\n return;\n }\n\n state.setFailed(uploadId);\n const error =\n _error instanceof Error ? _error : new Error(_error as string);\n\n config.onFileUploadFailed?.({ uploadId, error });\n } finally {\n await closeReader();\n }\n};\n\n/**\n * Creates and returns a `streamingUploadManager` - a multi-part upload handler\n * driven by a `ReadableStream<Uint8Array>` rather than a `File`/`Blob`.\n *\n * Unlike the chunkedUploadManager, this doesn't need to know the total size of the upload upfront.\n * Instead, it accumulates stream chunks into a buffer and uploadsa part every time\n * the buffer crosses the configured threshold for upload chunks, flushing whatever remains\n * as a final (possibly smaller) part once the stream ends.\n *\n * This bounds memory to roughly one chunk's worth of buffered bytes, plus\n * whatever the stream source itself buffers, regardless of the eventual\n * total size - useful for sources whose size can't be known in advance,\n * such as compressed output from a streaming zip encoder.\n *\n * Shares the same part-upload mechanics (retries, progress, abort) as\n * the chunkedUploadManager\n */\nexport const createStreamingUploadManager = (\n config: StreamingUploadManagerConfig,\n) => {\n const {\n resolveFilePartUploadURL: getUploadFilePartUrl,\n onFileUploadComplete,\n } = config;\n\n const state = createStateManager();\n\n const uploadStreamFromPartIndex = async (\n uploadId: string,\n stream: ReadableStream<Uint8Array>,\n ) => {\n const completedPartIds: Record<number, string> = {};\n\n const { abortController, runAbortablePromise } =\n promiseUtils.createAbortablePromise();\n\n state.set(uploadId, {\n uploadId,\n state: \"inprogress\",\n uploadedByteCount: state.get(uploadId)?.uploadedByteCount ?? 0,\n completedChunkCount: state.get(uploadId)?.completedChunkCount ?? 0,\n abortController,\n });\n\n let partIndex = 0;\n let uploadedBytes = state.get(uploadId)?.uploadedByteCount ?? 0;\n\n const uploadPart = async (bytes: Uint8Array<ArrayBuffer>) => {\n const chunk = new Blob([bytes]);\n\n const { method, url } = await promiseUtils.retryPromise({\n fn: () => getUploadFilePartUrl(uploadId, partIndex + 1),\n retryCount: CONFIG.DEFAULT_RETRY_COUNT,\n retryDelayMS: CONFIG.DEFAULT_RETRY_DELAY_MS,\n });\n\n const uploadedBeforeThisPart = uploadedBytes;\n const onChunkUploadProgress = (uploadedChunkBytes: number) => {\n uploadedBytes = uploadedBeforeThisPart + uploadedChunkBytes;\n state.set(uploadId, { uploadedByteCount: uploadedBytes });\n config.onProgress?.(uploadId, uploadedBytes);\n };\n\n const filePartResponse = await runAbortablePromise(() =>\n promiseUtils.retryPromise({\n fn: () =>\n uploadPartBytesWithProgress({\n method,\n url,\n partBytes: chunk,\n partIndex,\n onProgress: onChunkUploadProgress,\n abortSignal: abortController.signal,\n }),\n retryCount: CONFIG.DEFAULT_RETRY_COUNT,\n retryDelayMS: CONFIG.DEFAULT_RETRY_DELAY_MS,\n }),\n );\n\n completedPartIds[partIndex + 1] = filePartResponse.partId;\n uploadedBytes = uploadedBeforeThisPart + bytes.length;\n partIndex++;\n\n state.set(uploadId, {\n completedChunkCount: partIndex,\n uploadedByteCount: uploadedBytes,\n });\n };\n\n await readStreamAndUpload(state, uploadId, stream, uploadPart, config);\n\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n return;\n }\n\n state.setCompleted(uploadId, state.get(uploadId)!.completedChunkCount);\n onFileUploadComplete?.({ uploadId, filePartIds: completedPartIds });\n };\n\n const uploadStreams = (\n streams: Array<{ uploadId: string; stream: ReadableStream<Uint8Array> }>,\n ) => {\n const result: Array<Promise<unknown>> = [];\n\n for (const { uploadId, stream } of streams) {\n result.push(uploadStreamFromPartIndex(uploadId, stream));\n }\n\n return Promise.allSettled(result).then(() => state.flush());\n };\n\n return {\n uploadStreams,\n\n getUploadState: state.get,\n isFailed: state.isFailed,\n isCancelled: state.isCancelled,\n cancel: state.cancel,\n cancelAll: state.cancelAll,\n setFailed: state.setFailed,\n };\n};\n","export type BaseUploadManagerConfig = {\n /**\n * Function to resolve the metadata for a request to upload a file part\n * @param uploadId\n * @param partNumber\n * @returns\n */\n resolveFilePartUploadURL: (\n uploadId: string,\n partNumber: number,\n ) => Promise<{ method: string; url: string }>;\n\n /**\n * Callback that gets triggered when the whole file (or stream in streaming mode) is uploaded.\n * @param\n * @returns\n */\n onFileUploadComplete?: (payload: {\n /**\n * Identifier of the upload for this file (must be unique)\n */\n uploadId: string;\n /**\n * Ids of all the uploaded file parts\n */\n filePartIds: Record<number, string>;\n }) => void;\n\n /**\n * Callback that gets triggered when an upload has failed.\n * @param uploadId\n * @param error the error that cause the failure if it exists\n * @returns\n */\n onFileUploadFailed?: (payload: { uploadId: string; error: Error }) => void;\n};\n\nexport const UploadStates = {\n IDLE: \"idle\",\n IN_PROGRESS: \"inprogress\",\n CANCELLED: \"cancelled\",\n FAILED: \"failed\",\n COMPLETE: \"complete\",\n} as const;\n\nexport type UploadStateName = (typeof UploadStates)[keyof typeof UploadStates];\n","import type { FetchOptions } from \"ofetch\";\n\nimport { getFileMimeType } from \"@knime/utils\";\n\nimport { createHttpClient } from \"../../../shared/httpClient\";\n\n/**\n * What `prepareUpload` actually needs to build a\n * correct manifest request. Kept structural (rather than requiring a real\n * `File`) so callers that don't have a materialized file - e.g. a streaming\n * upload whose final size isn't known yet - can pass a plain metadata object\n * instead.\n */\ntype UploadCandidate = { name: string; size: number; type: string };\n\ntype PrepareUploadItem<T extends UploadCandidate> = {\n /**\n * The manifest key: the path (relative to `parentId`) this item should be\n * created at.\n */\n path: string;\n file: T;\n};\n\ntype CreateUploadClientOptions = {\n /**\n * Options to customize the fetch client used internally to make http requests.\n * e.g: headers, baseUrl, etc\n */\n customFetchClientOptions?: FetchOptions;\n\n /**\n * Whether the manifest endpoint is flat (`/manifest`) rather than nested\n * under a repository item (`/repository/{parentId}/manifest`). Used for\n * targets whose upload endpoint isn't scoped by a repository parent,\n * e.g. environment extension DB driver uploads.\n */\n shouldUseFlatManifestPath?: boolean;\n};\n\nexport type UploadClient = ReturnType<typeof createUploadClient>;\n\n/**\n * Creates the raw upload lifecycle client:\n *\n * (1) - prepare a batch of items for upload\n * (2) - resolve a presigned URL for a given file part\n * (3) - complete an upload once all its parts are uploaded, or cancel one in progress.\n */\nexport const createUploadClient = (options: CreateUploadClientOptions = {}) => {\n const $ofetch = createHttpClient(options.customFetchClientOptions);\n\n const prepareUpload = <T extends UploadCandidate>(\n parentId: string,\n items: Array<PrepareUploadItem<T>>,\n ): Promise<Array<{ uploadId: string; file: T; path: string }>> => {\n const fileByName = new Map(\n items.map(({ path: name, file }) => [name, file]),\n );\n\n const body: {\n items: Record<\n string,\n { itemContentType: string; itemContentSize: number }\n >;\n } = {\n items: Object.fromEntries(\n items.map(({ path: name, file }) => [\n name,\n {\n itemContentType: getFileMimeType(file),\n itemContentSize: file.size,\n },\n ]),\n ),\n };\n\n type PrepareUploadResponse = {\n items: Record<string, { uploadId: string }>;\n };\n\n const manifestPath = options.shouldUseFlatManifestPath\n ? \"/manifest\"\n : `/repository/${parentId}/manifest`;\n\n return $ofetch<PrepareUploadResponse>(manifestPath, {\n method: \"POST\",\n body,\n }).then(({ items: responseItems }) =>\n Object.keys(responseItems).map((name) => ({\n uploadId: responseItems[name].uploadId,\n file: fileByName.get(name)!,\n path: name,\n })),\n );\n };\n\n const resolveFilePartUploadURL = (uploadId: string, partNumber: number) => {\n type UploadURLResponse = {\n method: string;\n url: string;\n header: { Host: string };\n };\n\n return $ofetch<UploadURLResponse>(\n `/uploads/${uploadId}/parts?partNumber=${partNumber}`,\n { method: \"POST\" },\n );\n };\n\n const completeUpload = (\n uploadId: string,\n partIds: Record<number, string>,\n ) => {\n return $ofetch<void>(`/uploads/${uploadId}`, {\n method: \"POST\",\n body: partIds,\n });\n };\n\n const cancelUpload = (uploadId: string) => {\n return $ofetch(`/uploads/${uploadId}`, {\n method: \"DELETE\",\n });\n };\n\n const getUploadStatus = (uploadIds: string[]) => {\n type UploadStatusResponse = Array<{\n uploadId: string;\n status:\n \"PREPARED\" | \"ANALYSIS_PENDING\" | \"COMPLETED\" | \"ABORTED\" | \"FAILED\";\n statusMessage: string;\n }>;\n\n return $ofetch<UploadStatusResponse>(\"/uploads/status\", {\n method: \"GET\",\n query: {\n uploadIds: uploadIds.join(\",\"),\n },\n });\n };\n\n return {\n prepareUpload,\n resolveFilePartUploadURL,\n completeUpload,\n cancelUpload,\n getUploadStatus,\n };\n};\n","//#region src/array/chunk.ts\n/**\n* Splits an array into smaller arrays of a specified length.\n*\n* This function takes an input array and divides it into multiple smaller arrays,\n* each of a specified length. If the input array cannot be evenly divided,\n* the final sub-array will contain the remaining elements.\n*\n* @template T The type of elements in the array.\n* @param arr - The array to be chunked into smaller arrays.\n* @param size - The size of each smaller array. Must be a positive integer.\n* @returns A two-dimensional array where each sub-array has a maximum length of `size`.\n* @throws {Error} Throws an error if `size` is not a positive integer.\n*\n* @example\n* // Splits an array of numbers into sub-arrays of length 2\n* chunk([1, 2, 3, 4, 5], 2);\n* // Returns: [[1, 2], [3, 4], [5]]\n*\n* @example\n* // Splits an array of strings into sub-arrays of length 3\n* chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n* // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n*/\nfunction chunk(arr, size) {\n\tif (!Number.isInteger(size) || size <= 0) throw new Error(\"Size must be an integer greater than zero.\");\n\tconst chunkLength = Math.ceil(arr.length / size);\n\tconst result = Array(chunkLength);\n\tfor (let index = 0; index < chunkLength; index++) {\n\t\tconst start = index * size;\n\t\tconst end = start + size;\n\t\tresult[index] = arr.slice(start, end);\n\t}\n\treturn result;\n}\n//#endregion\nexport { chunk };\n","import { chunk } from \"es-toolkit/array\";\n\nimport { sleep } from \"@knime/utils\";\n\nimport type { UploadClient } from \"./uploadClient\";\n\nconst DEFAULT_POLL_INTERVAL_MS = 1500;\nconst DEFAULT_POLL_TIMEOUT = 5 * 60 * 1000; // 5 mins\nconst MAX_IDS_PER_REQUEST = 15;\n\nconst logger = () => consola.withTag(\"Upload status poller\");\n\ntype Options = {\n /** Called once a tracked upload's processing reaches a terminal, successful state. */\n onComplete: (uploadId: string) => void;\n /** Called once a tracked upload's processing reaches a terminal, failed/aborted state. */\n onFail: (uploadId: string, statusMessage: string) => void;\n /** Delay between polling requests. Defaults to 1500ms. */\n pollIntervalMs?: number;\n pollTimeout?: number;\n};\n\nexport function createUploadStatusPoller(\n uploadClient: UploadClient,\n options: Options,\n) {\n const pending = new Set<string>();\n const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n const pollTimeout = options.pollTimeout ?? DEFAULT_POLL_TIMEOUT;\n\n // Caches the currently-running poll session's promise, so a `track()` call\n // that joins an already-running session awaits the same promise as the\n // one that started it, rather than resolving as soon as it's called.\n let inFlight: Promise<void> | null = null;\n\n const poll = (): Promise<void> => {\n if (inFlight) {\n return inFlight;\n }\n\n inFlight = (async () => {\n const deadline = Date.now() + pollTimeout;\n\n while (pending.size > 0 && Date.now() < deadline) {\n try {\n const batches = chunk([...pending.values()], MAX_IDS_PER_REQUEST);\n const promises = batches.map((batch) =>\n uploadClient.getUploadStatus(batch),\n );\n\n const statuses = (await Promise.all(promises)).flat();\n\n for (const { uploadId, status, statusMessage } of statuses) {\n if (status === \"COMPLETED\") {\n pending.delete(uploadId);\n options.onComplete(uploadId);\n } else if (status === \"FAILED\" || status === \"ABORTED\") {\n pending.delete(uploadId);\n options.onFail(uploadId, statusMessage);\n }\n // PREPARED / ANALYSIS_PENDING: not yet terminal, keep polling.\n }\n\n if (pending.size === 0) {\n break;\n }\n\n await sleep(pollIntervalMs);\n } catch (error) {\n logger().error(\"Failed while polling for upload batch status\", {\n error,\n });\n\n await sleep(pollIntervalMs);\n continue;\n }\n }\n\n for (const uploadId of pending) {\n pending.delete(uploadId);\n options.onFail(\n uploadId,\n \"Timed out waiting for processing to complete\",\n );\n }\n })().finally(() => {\n inFlight = null;\n });\n\n return inFlight;\n };\n\n return {\n /**\n * Tracks an id for polling. Will start the polling requests immediately unless indicated otherwise\n * by the `startPolling` parameter.\n *\n * Adding newer ids to an already-running poller is not a problem, since new ids just\n * increase the poll batch size upon the next execution of the polling request\n *\n * @param uploadId\n * @param startPolling\n */\n track: (uploadId: string, startPolling = true) => {\n pending.add(uploadId);\n\n if (startPolling) {\n return poll();\n }\n\n return Promise.resolve();\n },\n\n stop: () => pending.clear(),\n };\n}\n"],"x_google_ignoreList":[0,1,2,12],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAS,cAAc,OAAO;CAC7B,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,IAAI,EAAE,UAAU,QAAQ,UAAU,OAAO,aAAa,OAAO,eAAe,KAAK,MAAM,OAAO,OAAO;CACrG,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AAClD;;;;;;;;;;;;;ACrCA,SAAS,iBAAiB,KAAK;CAC9B,OAAO,QAAQ;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC8BA,SAAS,MAAM,QAAQ,QAAQ;CAC9B,MAAM,aAAa,OAAO,KAAK,MAAM;CACrC,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EAC3C,MAAM,MAAM,WAAW;EACvB,IAAI,iBAAiB,GAAG,GAAG;EAC3B,MAAM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I,cACF,OAAO,KAAK;GAGd,OAAO,QAAQ,QAAQ;EACzB;EAEA,YAAY,QAAQ,MAAM;CAC5B;AACF"}
|
|
1
|
+
{"version":3,"file":"core-n-n9OaZY.js","names":["#length","#chunks"],"sources":["../../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/object/merge.mjs","../src/dataTransfer/shared/httpClient/constants.ts","../src/dataTransfer/shared/httpClient/createHttpClient.ts","../src/dataTransfer/upload/core/uploadManager/config.ts","../src/dataTransfer/upload/core/uploadManager/state.ts","../src/dataTransfer/upload/core/uploadManager/uploadPartBytes.ts","../src/dataTransfer/upload/core/uploadManager/chunkedUploadManager.ts","../src/dataTransfer/upload/core/uploadManager/streamingUploadManager.ts","../src/dataTransfer/upload/core/uploadManager/types.ts","../src/dataTransfer/upload/core/uploadClient/uploadClient.ts","../../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/array/chunk.mjs","../src/dataTransfer/upload/core/uploadClient/createUploadStatusPoller.ts"],"sourcesContent":["//#region src/predicate/isPlainObject.ts\n/**\n* Checks if a given value is a plain object.\n*\n* @param value - The value to check.\n* @returns True if the value is a plain object, otherwise false.\n*\n* @example\n* ```typescript\n* // ✅👇 True\n*\n* isPlainObject({ }); // ✅\n* isPlainObject({ key: 'value' }); // ✅\n* isPlainObject({ key: new Date() }); // ✅\n* isPlainObject(new Object()); // ✅\n* isPlainObject(Object.create(null)); // ✅\n* isPlainObject({ nested: { key: true} }); // ✅\n* isPlainObject(new Proxy({}, {})); // ✅\n* isPlainObject({ [Symbol('tag')]: 'A' }); // ✅\n*\n* // ✅👇 (cross-realms, node context, workers, ...)\n* const runInNewContext = await import('node:vm').then(\n* (mod) => mod.runInNewContext\n* );\n* isPlainObject(runInNewContext('({})')); // ✅\n*\n* // ❌👇 False\n*\n* class Test { };\n* isPlainObject(new Test()) // ❌\n* isPlainObject(10); // ❌\n* isPlainObject(null); // ❌\n* isPlainObject('hello'); // ❌\n* isPlainObject([]); // ❌\n* isPlainObject(new Date()); // ❌\n* isPlainObject(new Uint8Array([1])); // ❌\n* isPlainObject(Buffer.from('ABC')); // ❌\n* isPlainObject(Promise.resolve({})); // ❌\n* isPlainObject(Object.create({})); // ❌\n* isPlainObject(new (class Cls {})); // ❌\n* isPlainObject(globalThis); // ❌,\n* ```\n*/\nfunction isPlainObject(value) {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst proto = Object.getPrototypeOf(value);\n\tif (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;\n\treturn Object.prototype.toString.call(value) === \"[object Object]\";\n}\n//#endregion\nexport { isPlainObject };\n","//#region src/_internal/isUnsafeProperty.ts\n/**\n* Checks if a property key is unsafe to modify directly.\n*\n* This function is used in functions like `merge` to prevent prototype pollution attacks\n* by identifying property keys that could modify the object's prototype chain or constructor.\n*\n* @param key - The property key to check\n* @returns `true` if the property is unsafe to modify directly, `false` otherwise\n* @internal\n*/\nfunction isUnsafeProperty(key) {\n\treturn key === \"__proto__\";\n}\n//#endregion\nexport { isUnsafeProperty };\n","import { isPlainObject } from \"../predicate/isPlainObject.mjs\";\nimport { isUnsafeProperty } from \"../_internal/isUnsafeProperty.mjs\";\n//#region src/object/merge.ts\n/**\n* Merges the properties of the source object into the target object.\n*\n* This function performs a deep merge, meaning nested objects and arrays are merged recursively.\n* If a property in the source object is an array or an object and the corresponding property in the target object is also an array or object, they will be merged.\n* If a property in the source object is undefined, it will not overwrite a defined property in the target object.\n*\n* Note that this function mutates the target object.\n*\n* @param target - The target object into which the source object properties will be merged. This object is modified in place.\n* @param source - The source object whose properties will be merged into the target object.\n* @returns The updated target object with properties from the source object merged in.\n*\n* @template T - Type of the target object.\n* @template S - Type of the source object.\n*\n* @example\n* const target = { a: 1, b: { x: 1, y: 2 } };\n* const source = { b: { y: 3, z: 4 }, c: 5 };\n*\n* const result = merge(target, source);\n* console.log(result);\n* // Output: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 5 }\n*\n* @example\n* const target = { a: [1, 2], b: { x: 1 } };\n* const source = { a: [3], b: { y: 2 } };\n*\n* const result = merge(target, source);\n* console.log(result);\n* // Output: { a: [3, 2], b: { x: 1, y: 2 } }\n*\n* @example\n* const target = { a: null };\n* const source = { a: [1, 2, 3] };\n*\n* const result = merge(target, source);\n* console.log(result);\n* // Output: { a: [1, 2, 3] }\n*/\nfunction merge(target, source) {\n\tconst sourceKeys = Object.keys(source);\n\tfor (let i = 0; i < sourceKeys.length; i++) {\n\t\tconst key = sourceKeys[i];\n\t\tif (isUnsafeProperty(key)) continue;\n\t\tconst sourceValue = source[key];\n\t\tconst targetValue = target[key];\n\t\tif (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) target[key] = merge(targetValue, sourceValue);\n\t\telse if (Array.isArray(sourceValue)) target[key] = merge([], sourceValue);\n\t\telse if (isPlainObject(sourceValue)) target[key] = merge({}, sourceValue);\n\t\telse if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;\n\t}\n\treturn target;\n}\nfunction isMergeableValue(value) {\n\treturn isPlainObject(value) || Array.isArray(value);\n}\n//#endregion\nexport { merge };\n","export const API_BASE_URL = \"/_/api\";\n","import { merge } from \"es-toolkit/object\";\nimport { type FetchOptions, ofetch } from \"ofetch\";\n\nimport { API_BASE_URL } from \"./constants\";\n\nconst defaultConfig: FetchOptions = {\n baseURL: API_BASE_URL,\n headers: {\n \"Content-Type\": \"application/json\",\n\n // see: https://knime-com.atlassian.net/wiki/spaces/SPECS/pages/4126769212/API+Errors#Client-Request-Headers\n Accept: \"application/json; application/problem+json\",\n },\n} as const;\n\nconst createHttpClient = (customOptions?: FetchOptions) => {\n return ofetch.create(\n merge(structuredClone(defaultConfig), customOptions ?? {}),\n );\n};\n\nexport { type FetchOptions, defaultConfig, createHttpClient };\n","/**\n * Configuration constants shared by the upload managers\n */\nexport const CONFIG = Object.freeze({\n /** Size, in bytes, of each uploaded file part. */\n CHUNK_SIZE: 50 * 1024 * 1024, // 50 MB per chunk\n /** Max number of retries for a failed request (part-url resolution or the chunk upload itself). */\n DEFAULT_RETRY_COUNT: 5,\n /** Delay, in ms, between retries. */\n DEFAULT_RETRY_DELAY_MS: 50,\n});\n","import { promise as promiseUtils } from \"@knime/utils\";\n\nimport type { UploadStateName } from \"./types\";\n\ntype UploadState = {\n uploadId: string;\n fileDescriptor?: { name: string; type: string };\n completedChunkCount: number;\n uploadedByteCount: number;\n state: UploadStateName;\n abortController: AbortController;\n};\n\nexport const createStateManager = () => {\n const uploadStateMap = new Map<string, UploadState>();\n\n const completedUploads = new Set<string>();\n const cancelledUploads = new Set<string>();\n const failedUploads = new Set<string>();\n\n const assertState = (uploadId: string, state: UploadStateName) =>\n uploadStateMap.has(uploadId) &&\n uploadStateMap.get(uploadId)!.state === state;\n\n const getUploadState = (uploadId: string) => uploadStateMap.get(uploadId);\n const setUploadState = (uploadId: string, state: Partial<UploadState>) => {\n uploadStateMap.set(uploadId, {\n ...uploadStateMap.get(uploadId)!,\n ...state,\n });\n };\n\n const isFailed = (uploadId: string) => assertState(uploadId, \"failed\");\n const isCancelled = (uploadId: string) => assertState(uploadId, \"cancelled\");\n\n const abortInFlightUpload = (uploadId: string, reason: string) => {\n const currentState = uploadStateMap.get(uploadId);\n\n if (!currentState) {\n return;\n }\n\n const message = currentState.fileDescriptor\n ? `Upload (${currentState.uploadId}) for file \"${currentState.fileDescriptor.name}\" aborted. Reason: \"${reason}\"`\n : `Upload (${currentState.uploadId}) aborted. Reason: \"${reason}\"`;\n\n currentState.abortController.abort(new promiseUtils.AbortError(message));\n };\n\n const cancel = (uploadId: string) => {\n if (!uploadStateMap.has(uploadId)) {\n consola.error(\"cancel:: Invalid upload id\");\n return;\n }\n\n setUploadState(uploadId, { state: \"cancelled\" });\n\n abortInFlightUpload(uploadId, \"upload cancelled\");\n cancelledUploads.add(uploadId);\n };\n\n const cancelAll = () => {\n for (const [id, upload] of uploadStateMap.entries()) {\n if (upload.state === \"inprogress\") {\n cancel(id);\n }\n }\n };\n\n const setCompleted = (uploadId: string, completedChunkCount: number) => {\n setUploadState(uploadId, {\n completedChunkCount,\n state: \"complete\",\n });\n completedUploads.add(uploadId);\n };\n\n const setFailed = (uploadId: string) => {\n if (!uploadStateMap.has(uploadId)) {\n consola.error(\"failed:: Invalid upload id\");\n return;\n }\n\n setUploadState(uploadId, { state: \"failed\" });\n failedUploads.add(uploadId);\n\n if (completedUploads.has(uploadId)) {\n completedUploads.delete(uploadId);\n }\n };\n\n const flush = () => {\n // state cleanup\n const completed = [...completedUploads.values()];\n const cancelled = [...cancelledUploads.values()];\n const failed = [...failedUploads.values()];\n\n [...completed, ...cancelled, ...failed].forEach((uploadId) =>\n uploadStateMap.delete(uploadId),\n );\n\n completedUploads.clear();\n cancelledUploads.clear();\n failedUploads.clear();\n\n return {\n completed,\n cancelled,\n failed,\n };\n };\n\n return {\n get: getUploadState,\n set: setUploadState,\n isFailed,\n isCancelled,\n cancel,\n cancelAll,\n setCompleted,\n setFailed,\n abortInFlightUpload,\n flush,\n };\n};\n","export type PartUploadResponse = {\n partId: string;\n};\n\n/**\n * Uploads a single file part via XHR, reporting upload progress and\n * resolving with the part's identifying ETag (or an empty string if the\n * backend doesn't return one).\n */\nexport const uploadPartBytesWithProgress = (params: {\n method: string;\n url: string;\n partBytes: Blob;\n partIndex: number;\n onProgress: (progress: number) => void;\n abortSignal: AbortSignal;\n}): Promise<PartUploadResponse> => {\n const { method, url, partBytes, partIndex, onProgress, abortSignal } = params;\n\n const OK = 200;\n const CREATED = 201;\n\n return new Promise<PartUploadResponse>((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n\n xhr.open(method, url, true);\n\n abortSignal.addEventListener(\"abort\", () => xhr.abort());\n\n // Track the upload progress of the current part\n xhr.upload.onprogress = (event) => {\n if (event.lengthComputable) {\n onProgress(event.loaded);\n }\n };\n\n xhr.onload = () => {\n if (xhr.status === OK || xhr.status === CREATED) {\n const etag = xhr.getResponseHeader(\"ETag\");\n\n // 1. note that some backends don't return the etag header, then we just set an empty string\n // 2. remove possible doublequotes (\") around the etag and/or weak identifier (if either is present)\n // https://datatracker.ietf.org/doc/html/rfc7232#section-2.3\n resolve({ partId: etag?.replace(/^(?:W\\/)?\"|\"$/g, \"\") ?? \"\" });\n } else {\n consola.error(\"Failed or unexpected XHR response\", {\n xhrStatus: xhr.status,\n xhrResponse: xhr.response,\n partIndex,\n });\n reject(new Error(\"Failed to upload file\"));\n }\n };\n\n xhr.onerror = (event) => {\n consola.error(\"Failed to upload part\", {\n xhrErrorEvent: event,\n partIndex,\n });\n reject(new Error(\"Failed to upload file\"));\n };\n\n xhr.send(partBytes);\n });\n};\n","import { promise as promiseUtils } from \"@knime/utils\";\n\nimport { CONFIG } from \"./config\";\nimport { createStateManager } from \"./state\";\nimport type { BaseUploadManagerConfig } from \"./types\";\nimport { uploadPartBytesWithProgress } from \"./uploadPartBytes\";\n\nexport type ChunkUploadManagerConfig = BaseUploadManagerConfig & {\n /**\n * Callback that gets triggered when the progress of a file part upload\n * for a specific upload id is updated\n * @param uploadId\n * @param progress\n * @returns\n */\n onProgress?: (uploadId: string, progress: number) => void;\n};\n\n/**\n * Creates and returns an `uploadManager`, a comprehensive multi-file, multi-part upload handler.\n *\n * The `uploadManager` offers functionality for handling file uploads in parts and provides\n * several built-in mechanisms to ensure the process is reliable and adaptable.\n *\n * Key features include:\n *\n * - **Chunked File Uploads**: Splits provided files into manageable chunks and initiates the upload\n * for each part using the `resolveFilePartUploadURL` function provided in the configuration.\n *\n * - **Retry Mechanism**: Automatically retries failed upload attempts up to a maximum of 5 times\n * per failed request.\n *\n * - **Upload Cancellation**: Allows cancellation of ongoing uploads, giving users control over the process.\n *\n * - **Progress Tracking**: Monitors the progress of each file part upload and triggers the `onProgress`\n * callback to provide updates.\n *\n * - **Error Handling**: The returned `uploadFiles` function does not throw errors directly. Instead,\n * it manages retries and stops any failed uploads after the retry limit is reached, marking them as failed.\n * This ensures that the promise it returns completes gracefully without uncaught exceptions.\n *\n * This is the \"slice-based\" manager: it needs each file's complete bytes to already be\n * available (as a real `File`/`Blob` with a known `.size`), since it produces each part via\n * `file.slice()`. For uploading from a source whose total size isn't known upfront (e.g. a\n * stream of compressed output), see `createStreamingUploadManager` instead.\n */\nexport const createUploadManager = (config: ChunkUploadManagerConfig) => {\n const {\n resolveFilePartUploadURL: getUploadFilePartUrl,\n onFileUploadComplete,\n onFileUploadFailed,\n } = config;\n const state = createStateManager();\n\n const getTotalFileParts = (file: File) =>\n Math.ceil(file.size / CONFIG.CHUNK_SIZE);\n\n const uploadFileFromChunkIndex = async (uploadId: string, file: File) => {\n const totalChunks = getTotalFileParts(file);\n const totalBytes = file.size;\n const completedPartIds: Record<number, string> = {};\n\n const { abortController, runAbortablePromise } =\n promiseUtils.createAbortablePromise();\n\n state.set(uploadId, {\n uploadId,\n fileDescriptor: { name: file.name, type: file.type },\n state: \"inprogress\",\n uploadedByteCount: state.get(uploadId)?.uploadedByteCount ?? 0,\n completedChunkCount: state.get(uploadId)?.completedChunkCount ?? 0,\n abortController,\n });\n\n let chunkIndex = 0;\n let uploadedBytes = state.get(uploadId)?.uploadedByteCount;\n\n while (chunkIndex < totalChunks) {\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n break;\n }\n\n const start = chunkIndex * CONFIG.CHUNK_SIZE;\n const end = Math.min(start + CONFIG.CHUNK_SIZE, file.size);\n\n const chunk = file.slice(start, end);\n\n try {\n const { method, url } = await promiseUtils.retryPromise({\n fn: () => getUploadFilePartUrl(uploadId, chunkIndex + 1),\n retryCount: CONFIG.DEFAULT_RETRY_COUNT,\n retryDelayMS: CONFIG.DEFAULT_RETRY_DELAY_MS,\n });\n\n consola.trace(\"File part upload url resolved\", { method, url });\n\n const onChunkUploadProgress = (uploadedChunkBytes: number) => {\n uploadedBytes = uploadedChunkBytes + start;\n state.set(uploadId, { uploadedByteCount: uploadedBytes });\n\n const progress = Math.round((uploadedBytes / totalBytes) * 100);\n\n config.onProgress?.(uploadId, progress);\n };\n\n const filePartResponse = await runAbortablePromise(() =>\n promiseUtils.retryPromise({\n fn: () =>\n uploadPartBytesWithProgress({\n method,\n url,\n partBytes: chunk,\n partIndex: chunkIndex,\n onProgress: onChunkUploadProgress,\n abortSignal: abortController.signal,\n }),\n retryCount: CONFIG.DEFAULT_RETRY_COUNT,\n retryDelayMS: CONFIG.DEFAULT_RETRY_DELAY_MS,\n }),\n );\n\n consola.trace(\n `${file.name}: Chunk ${chunkIndex + 1} of ${totalChunks} uploaded successfully`,\n );\n\n completedPartIds[chunkIndex + 1] = filePartResponse.partId;\n\n state.set(uploadId, {\n completedChunkCount: state.get(uploadId)!.completedChunkCount + 1,\n });\n } catch (_error) {\n if (_error instanceof promiseUtils.AbortError) {\n consola.info(\"Aborted::\", _error);\n return;\n }\n\n const error =\n _error instanceof Error ? _error : new Error(_error as string);\n\n state.setFailed(uploadId);\n\n onFileUploadFailed?.({ uploadId, error });\n return;\n }\n\n chunkIndex++;\n }\n\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n return;\n }\n\n state.setCompleted(uploadId, totalChunks);\n onFileUploadComplete?.({ uploadId, filePartIds: completedPartIds });\n };\n\n const uploadFiles = (files: Array<{ uploadId: string; file: File }>) => {\n const result: Array<Promise<unknown>> = [];\n\n for (const { uploadId, file } of files) {\n result.push(uploadFileFromChunkIndex(uploadId, file));\n }\n\n return Promise.allSettled(result).then(() => state.flush());\n };\n\n return {\n uploadFiles,\n\n getUploadState: state.get,\n isFailed: state.isFailed,\n isCancelled: state.isCancelled,\n cancel: state.cancel,\n cancelAll: state.cancelAll,\n setFailed: state.setFailed,\n };\n};\n","import { promise as promiseUtils } from \"@knime/utils\";\n\nimport { CONFIG } from \"./config\";\nimport { createStateManager } from \"./state\";\nimport type { BaseUploadManagerConfig } from \"./types\";\nimport { uploadPartBytesWithProgress } from \"./uploadPartBytes\";\n\nexport type StreamingUploadManagerConfig = BaseUploadManagerConfig & {\n /**\n * Callback triggered as bytes are uploaded. This reports an absolute byte count rather\n * than a percentage: the total size isn't known upfront for a stream.\n */\n onProgress?: (uploadId: string, uploadedBytes: number) => void;\n};\n\n/**\n * A small FIFO byte buffer. Pushed chunks are stored by reference (no\n * copying on push).\n */\nclass ByteQueue {\n #chunks: Uint8Array[] = [];\n #length = 0;\n\n get length() {\n return this.#length;\n }\n\n push(chunk: Uint8Array) {\n if (chunk.length === 0) {\n return;\n }\n this.#chunks.push(chunk);\n this.#length += chunk.length;\n }\n\n /**\n * FIFO exactly `n` bytes from the buffer. If the first chunk has more bytes than needed,\n * it will be split and only the requested amount returned. This ensures each byte is copied\n * at most once, regardless of how many small chunks it took to accumulate them.\n * @param n\n * @returns\n */\n take(n: number): Uint8Array<ArrayBuffer> {\n const size = Math.min(n, this.#length);\n const result = new Uint8Array(size);\n let offset = 0;\n\n while (offset < size) {\n const chunk = this.#chunks[0];\n const needed = size - offset;\n\n if (chunk.length <= needed) {\n result.set(chunk, offset);\n offset += chunk.length;\n this.#chunks.shift();\n } else {\n result.set(chunk.subarray(0, needed), offset);\n this.#chunks[0] = chunk.subarray(needed);\n offset += needed;\n }\n }\n\n this.#length -= size;\n return result;\n }\n\n takeAll(): Uint8Array<ArrayBuffer> {\n return this.take(this.#length);\n }\n}\n\nconst readStreamAndUpload = async (\n state: ReturnType<typeof createStateManager>,\n uploadId: string,\n stream: ReadableStream<Uint8Array>,\n uploadPart: (bytes: Uint8Array<ArrayBuffer>) => Promise<void>,\n config: StreamingUploadManagerConfig,\n // eslint-disable-next-line max-params\n) => {\n const buffer = new ByteQueue();\n const reader = stream.getReader();\n\n const closeReader = async () => {\n try {\n await reader.cancel();\n } catch {\n // stream already closed/errored - nothing left to cancel\n } finally {\n reader.releaseLock();\n }\n };\n\n try {\n while (true) {\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n return;\n }\n\n const { value, done } = await reader.read();\n\n if (value) {\n buffer.push(value);\n }\n\n while (buffer.length >= CONFIG.CHUNK_SIZE) {\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n return;\n }\n\n await uploadPart(buffer.take(CONFIG.CHUNK_SIZE));\n }\n\n if (done) {\n // when stream is done, if there's still any content in the buffer\n // then take all remaining bytes and upload them\n if (\n buffer.length > 0 &&\n !state.isCancelled(uploadId) &&\n !state.isFailed(uploadId)\n ) {\n await uploadPart(buffer.takeAll());\n }\n break;\n }\n }\n } catch (_error) {\n if (_error instanceof promiseUtils.AbortError) {\n consola.info(\"Aborted::\", _error);\n return;\n }\n\n state.setFailed(uploadId);\n const error =\n _error instanceof Error ? _error : new Error(_error as string);\n\n config.onFileUploadFailed?.({ uploadId, error });\n } finally {\n await closeReader();\n }\n};\n\n/**\n * Creates and returns a `streamingUploadManager` - a multi-part upload handler\n * driven by a `ReadableStream<Uint8Array>` rather than a `File`/`Blob`.\n *\n * Unlike the chunkedUploadManager, this doesn't need to know the total size of the upload upfront.\n * Instead, it accumulates stream chunks into a buffer and uploadsa part every time\n * the buffer crosses the configured threshold for upload chunks, flushing whatever remains\n * as a final (possibly smaller) part once the stream ends.\n *\n * This bounds memory to roughly one chunk's worth of buffered bytes, plus\n * whatever the stream source itself buffers, regardless of the eventual\n * total size - useful for sources whose size can't be known in advance,\n * such as compressed output from a streaming zip encoder.\n *\n * Shares the same part-upload mechanics (retries, progress, abort) as\n * the chunkedUploadManager\n */\nexport const createStreamingUploadManager = (\n config: StreamingUploadManagerConfig,\n) => {\n const {\n resolveFilePartUploadURL: getUploadFilePartUrl,\n onFileUploadComplete,\n } = config;\n\n const state = createStateManager();\n\n const uploadStreamFromPartIndex = async (\n uploadId: string,\n stream: ReadableStream<Uint8Array>,\n ) => {\n const completedPartIds: Record<number, string> = {};\n\n const { abortController, runAbortablePromise } =\n promiseUtils.createAbortablePromise();\n\n state.set(uploadId, {\n uploadId,\n state: \"inprogress\",\n uploadedByteCount: state.get(uploadId)?.uploadedByteCount ?? 0,\n completedChunkCount: state.get(uploadId)?.completedChunkCount ?? 0,\n abortController,\n });\n\n let partIndex = 0;\n let uploadedBytes = state.get(uploadId)?.uploadedByteCount ?? 0;\n\n const uploadPart = async (bytes: Uint8Array<ArrayBuffer>) => {\n const chunk = new Blob([bytes]);\n\n const { method, url } = await promiseUtils.retryPromise({\n fn: () => getUploadFilePartUrl(uploadId, partIndex + 1),\n retryCount: CONFIG.DEFAULT_RETRY_COUNT,\n retryDelayMS: CONFIG.DEFAULT_RETRY_DELAY_MS,\n });\n\n const uploadedBeforeThisPart = uploadedBytes;\n const onChunkUploadProgress = (uploadedChunkBytes: number) => {\n uploadedBytes = uploadedBeforeThisPart + uploadedChunkBytes;\n state.set(uploadId, { uploadedByteCount: uploadedBytes });\n config.onProgress?.(uploadId, uploadedBytes);\n };\n\n const filePartResponse = await runAbortablePromise(() =>\n promiseUtils.retryPromise({\n fn: () =>\n uploadPartBytesWithProgress({\n method,\n url,\n partBytes: chunk,\n partIndex,\n onProgress: onChunkUploadProgress,\n abortSignal: abortController.signal,\n }),\n retryCount: CONFIG.DEFAULT_RETRY_COUNT,\n retryDelayMS: CONFIG.DEFAULT_RETRY_DELAY_MS,\n }),\n );\n\n completedPartIds[partIndex + 1] = filePartResponse.partId;\n uploadedBytes = uploadedBeforeThisPart + bytes.length;\n partIndex++;\n\n state.set(uploadId, {\n completedChunkCount: partIndex,\n uploadedByteCount: uploadedBytes,\n });\n };\n\n await readStreamAndUpload(state, uploadId, stream, uploadPart, config);\n\n if (state.isCancelled(uploadId) || state.isFailed(uploadId)) {\n return;\n }\n\n state.setCompleted(uploadId, state.get(uploadId)!.completedChunkCount);\n onFileUploadComplete?.({ uploadId, filePartIds: completedPartIds });\n };\n\n const uploadStreams = (\n streams: Array<{ uploadId: string; stream: ReadableStream<Uint8Array> }>,\n ) => {\n const result: Array<Promise<unknown>> = [];\n\n for (const { uploadId, stream } of streams) {\n result.push(uploadStreamFromPartIndex(uploadId, stream));\n }\n\n return Promise.allSettled(result).then(() => state.flush());\n };\n\n return {\n uploadStreams,\n\n getUploadState: state.get,\n isFailed: state.isFailed,\n isCancelled: state.isCancelled,\n cancel: state.cancel,\n cancelAll: state.cancelAll,\n setFailed: state.setFailed,\n };\n};\n","export type BaseUploadManagerConfig = {\n /**\n * Function to resolve the metadata for a request to upload a file part\n * @param uploadId\n * @param partNumber\n * @returns\n */\n resolveFilePartUploadURL: (\n uploadId: string,\n partNumber: number,\n ) => Promise<{ method: string; url: string }>;\n\n /**\n * Callback that gets triggered when the whole file (or stream in streaming mode) is uploaded.\n * @param\n * @returns\n */\n onFileUploadComplete?: (payload: {\n /**\n * Identifier of the upload for this file (must be unique)\n */\n uploadId: string;\n /**\n * Ids of all the uploaded file parts\n */\n filePartIds: Record<number, string>;\n }) => void;\n\n /**\n * Callback that gets triggered when an upload has failed.\n * @param uploadId\n * @param error the error that cause the failure if it exists\n * @returns\n */\n onFileUploadFailed?: (payload: { uploadId: string; error: Error }) => void;\n};\n\nexport const UploadStates = {\n IDLE: \"idle\",\n IN_PROGRESS: \"inprogress\",\n CANCELLED: \"cancelled\",\n FAILED: \"failed\",\n COMPLETE: \"complete\",\n} as const;\n\nexport type UploadStateName = (typeof UploadStates)[keyof typeof UploadStates];\n","import type { FetchOptions } from \"ofetch\";\n\nimport { getFileMimeType } from \"@knime/utils\";\n\nimport { createHttpClient } from \"../../../shared/httpClient\";\n\n/**\n * What `prepareUpload` actually needs to build a\n * correct manifest request. Kept structural (rather than requiring a real\n * `File`) so callers that don't have a materialized file - e.g. a streaming\n * upload whose final size isn't known yet - can pass a plain metadata object\n * instead.\n */\ntype UploadCandidate = { name: string; size: number; type: string };\n\ntype PrepareUploadItem<T extends UploadCandidate> = {\n /**\n * The manifest key: the path (relative to `parentId`) this item should be\n * created at.\n */\n path: string;\n file: T;\n};\n\ntype CreateUploadClientOptions = {\n /**\n * Options to customize the fetch client used internally to make http requests.\n * e.g: headers, baseUrl, etc\n */\n customFetchClientOptions?: FetchOptions;\n\n /**\n * Whether the manifest endpoint is flat (`/manifest`) rather than nested\n * under a repository item (`/repository/{parentId}/manifest`). Used for\n * targets whose upload endpoint isn't scoped by a repository parent,\n * e.g. environment extension DB driver uploads.\n */\n shouldUseFlatManifestPath?: boolean;\n};\n\nexport type UploadClient = ReturnType<typeof createUploadClient>;\n\n/**\n * Creates the raw upload lifecycle client:\n *\n * (1) - prepare a batch of items for upload\n * (2) - resolve a presigned URL for a given file part\n * (3) - complete an upload once all its parts are uploaded, or cancel one in progress.\n */\nexport const createUploadClient = (options: CreateUploadClientOptions = {}) => {\n const $ofetch = createHttpClient(options.customFetchClientOptions);\n\n const prepareUpload = <T extends UploadCandidate>(\n parentId: string,\n items: Array<PrepareUploadItem<T>>,\n ): Promise<Array<{ uploadId: string; file: T; path: string }>> => {\n const fileByName = new Map(\n items.map(({ path: name, file }) => [name, file]),\n );\n\n const body: {\n items: Record<\n string,\n { itemContentType: string; itemContentSize: number }\n >;\n } = {\n items: Object.fromEntries(\n items.map(({ path: name, file }) => [\n name,\n {\n itemContentType: getFileMimeType(file),\n itemContentSize: file.size,\n },\n ]),\n ),\n };\n\n type PrepareUploadResponse = {\n items: Record<string, { uploadId: string }>;\n };\n\n const manifestPath = options.shouldUseFlatManifestPath\n ? \"/manifest\"\n : `/repository/${parentId}/manifest`;\n\n return $ofetch<PrepareUploadResponse>(manifestPath, {\n method: \"POST\",\n body,\n }).then(({ items: responseItems }) =>\n Object.keys(responseItems).map((name) => ({\n uploadId: responseItems[name].uploadId,\n file: fileByName.get(name)!,\n path: name,\n })),\n );\n };\n\n const resolveFilePartUploadURL = (uploadId: string, partNumber: number) => {\n type UploadURLResponse = {\n method: string;\n url: string;\n header: { Host: string };\n };\n\n return $ofetch<UploadURLResponse>(\n `/uploads/${uploadId}/parts?partNumber=${partNumber}`,\n { method: \"POST\" },\n );\n };\n\n const completeUpload = (\n uploadId: string,\n partIds: Record<number, string>,\n ) => {\n return $ofetch<void>(`/uploads/${uploadId}`, {\n method: \"POST\",\n body: partIds,\n });\n };\n\n const cancelUpload = (uploadId: string) => {\n return $ofetch(`/uploads/${uploadId}`, {\n method: \"DELETE\",\n });\n };\n\n const getUploadStatus = (uploadIds: string[]) => {\n type UploadStatusResponse = Array<{\n uploadId: string;\n status:\n \"PREPARED\" | \"ANALYSIS_PENDING\" | \"COMPLETED\" | \"ABORTED\" | \"FAILED\";\n statusMessage: string;\n }>;\n\n return $ofetch<UploadStatusResponse>(\"/uploads/status\", {\n method: \"GET\",\n query: {\n uploadIds: uploadIds.join(\",\"),\n },\n });\n };\n\n return {\n prepareUpload,\n resolveFilePartUploadURL,\n completeUpload,\n cancelUpload,\n getUploadStatus,\n };\n};\n","//#region src/array/chunk.ts\n/**\n* Splits an array into smaller arrays of a specified length.\n*\n* This function takes an input array and divides it into multiple smaller arrays,\n* each of a specified length. If the input array cannot be evenly divided,\n* the final sub-array will contain the remaining elements.\n*\n* @template T The type of elements in the array.\n* @param arr - The array to be chunked into smaller arrays.\n* @param size - The size of each smaller array. Must be a positive integer.\n* @returns A two-dimensional array where each sub-array has a maximum length of `size`.\n* @throws {Error} Throws an error if `size` is not a positive integer.\n*\n* @example\n* // Splits an array of numbers into sub-arrays of length 2\n* chunk([1, 2, 3, 4, 5], 2);\n* // Returns: [[1, 2], [3, 4], [5]]\n*\n* @example\n* // Splits an array of strings into sub-arrays of length 3\n* chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n* // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n*/\nfunction chunk(arr, size) {\n\tif (!Number.isInteger(size) || size <= 0) throw new Error(\"Size must be an integer greater than zero.\");\n\tconst chunkLength = Math.ceil(arr.length / size);\n\tconst result = Array(chunkLength);\n\tfor (let index = 0; index < chunkLength; index++) {\n\t\tconst start = index * size;\n\t\tconst end = start + size;\n\t\tresult[index] = arr.slice(start, end);\n\t}\n\treturn result;\n}\n//#endregion\nexport { chunk };\n","import { chunk } from \"es-toolkit/array\";\n\nimport { sleep } from \"@knime/utils\";\n\nimport type { UploadClient } from \"./uploadClient\";\n\nconst DEFAULT_POLL_INTERVAL_MS = 1500;\nconst DEFAULT_POLL_TIMEOUT = 5 * 60 * 1000; // 5 mins\nconst MAX_IDS_PER_REQUEST = 15;\n\nconst logger = () => consola.withTag(\"Upload status poller\");\n\ntype Options = {\n /** Called once a tracked upload's processing reaches a terminal, successful state. */\n onComplete: (uploadId: string) => void;\n /** Called once a tracked upload's processing reaches a terminal, failed/aborted state. */\n onFail: (uploadId: string, statusMessage: string) => void;\n /** Delay between polling requests. Defaults to 1500ms. */\n pollIntervalMs?: number;\n pollTimeout?: number;\n};\n\nexport function createUploadStatusPoller(\n uploadClient: UploadClient,\n options: Options,\n) {\n const pending = new Set<string>();\n const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n const pollTimeout = options.pollTimeout ?? DEFAULT_POLL_TIMEOUT;\n\n // Caches the currently-running poll session's promise, so a `track()` call\n // that joins an already-running session awaits the same promise as the\n // one that started it, rather than resolving as soon as it's called.\n let inFlight: Promise<void> | null = null;\n\n const poll = (): Promise<void> => {\n if (inFlight) {\n return inFlight;\n }\n\n inFlight = (async () => {\n const deadline = Date.now() + pollTimeout;\n\n while (pending.size > 0 && Date.now() < deadline) {\n try {\n const batches = chunk([...pending.values()], MAX_IDS_PER_REQUEST);\n const promises = batches.map((batch) =>\n uploadClient.getUploadStatus(batch),\n );\n\n const statuses = (await Promise.all(promises)).flat();\n\n for (const { uploadId, status, statusMessage } of statuses) {\n if (status === \"COMPLETED\") {\n pending.delete(uploadId);\n options.onComplete(uploadId);\n } else if (status === \"FAILED\" || status === \"ABORTED\") {\n pending.delete(uploadId);\n options.onFail(uploadId, statusMessage);\n }\n // PREPARED / ANALYSIS_PENDING: not yet terminal, keep polling.\n }\n\n if (pending.size === 0) {\n break;\n }\n\n await sleep(pollIntervalMs);\n } catch (error) {\n logger().error(\"Failed while polling for upload batch status\", {\n error,\n });\n\n await sleep(pollIntervalMs);\n continue;\n }\n }\n\n for (const uploadId of pending) {\n pending.delete(uploadId);\n options.onFail(\n uploadId,\n \"Timed out waiting for processing to complete\",\n );\n }\n })().finally(() => {\n inFlight = null;\n });\n\n return inFlight;\n };\n\n return {\n /**\n * Tracks an id for polling. Will start the polling requests immediately unless indicated otherwise\n * by the `startPolling` parameter.\n *\n * Adding newer ids to an already-running poller is not a problem, since new ids just\n * increase the poll batch size upon the next execution of the polling request\n *\n * @param uploadId\n * @param startPolling\n */\n track: (uploadId: string, startPolling = true) => {\n pending.add(uploadId);\n\n if (startPolling) {\n return poll();\n }\n\n return Promise.resolve();\n },\n\n stop: () => pending.clear(),\n };\n}\n"],"x_google_ignoreList":[0,1,2,12],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAS,cAAc,OAAO;CAC7B,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,IAAI,EAAE,UAAU,QAAQ,UAAU,OAAO,aAAa,OAAO,eAAe,KAAK,MAAM,OAAO,OAAO;CACrG,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AAClD;;;;;;;;;;;;;ACrCA,SAAS,iBAAiB,KAAK;CAC9B,OAAO,QAAQ;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC8BA,SAAS,MAAM,QAAQ,QAAQ;CAC9B,MAAM,aAAa,OAAO,KAAK,MAAM;CACrC,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EAC3C,MAAM,MAAM,WAAW;EACvB,IAAI,iBAAiB,GAAG,GAAG;EAC3B,MAAM,cAAc,OAAO;EAC3B,MAAM,cAAc,OAAO;EAC3B,IAAI,iBAAiB,WAAW,KAAK,iBAAiB,WAAW,GAAG,OAAO,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 -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createUploadManager, i as createStreamingUploadManager, n as createUploadClient, r as UploadStates, t as createUploadStatusPoller } from "../core-
|
|
1
|
+
import { a as createUploadManager, i as createStreamingUploadManager, n as createUploadClient, r as UploadStates, t as createUploadStatusPoller } from "../core-n-n9OaZY.js";
|
|
2
2
|
export { UploadStates, createStreamingUploadManager, createUploadClient, createUploadManager, createUploadStatusPoller };
|
package/dist/dataTransfer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BOaGB7Aw.js";
|
|
2
|
-
import { a as getFileExtension, c as promise_exports, l as sleep,
|
|
3
|
-
import { n as rfcErrors } from "./rfcErrors-
|
|
4
|
-
import { a as createUploadManager, c as API_BASE_URL, n as createUploadClient, o as createHttpClient, s as defaultConfig, t as createUploadStatusPoller } from "./core-
|
|
2
|
+
import { a as getFileExtension, c as promise_exports, i as formatFileSize, l as sleep, n as disambiguateFiles, s as knimeFileFormats } from "./dist-D193M-Gt.js";
|
|
3
|
+
import { n as rfcErrors } from "./rfcErrors-DdxFC4Hg.js";
|
|
4
|
+
import { a as createUploadManager, c as API_BASE_URL, n as createUploadClient, o as createHttpClient, s as defaultConfig, t as createUploadStatusPoller } from "./core-n-n9OaZY.js";
|
|
5
5
|
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, normalizeClass, normalizeStyle, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, vShow, watch, withCtx, withDirectives } from "vue";
|
|
6
6
|
import { KdsBadge, KdsButton, KdsIcon, KdsLoadingSkeleton, KdsProgressBar, vKdsTooltip } from "@knime/kds-components";
|
|
7
7
|
import { FetchError } from "ofetch";
|
|
@@ -795,34 +795,6 @@ var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 5 * 1024 * 1024 * 1024;
|
|
|
795
795
|
var DEFAULT_RETRY_DELAY_MS = 50;
|
|
796
796
|
var getUploadSizeLimitBytes = () => DEFAULT_UPLOAD_SIZE_LIMIT_BYTES;
|
|
797
797
|
/**
|
|
798
|
-
* Renames any File whose name repeats an earlier one in the list, appending
|
|
799
|
-
* a " (n)" suffix (before the extension, if any) - including a name produced
|
|
800
|
-
* by this same disambiguation, so a literal "name (1).ext" already in the
|
|
801
|
-
* list can't collide with a generated one
|
|
802
|
-
*/
|
|
803
|
-
var disambiguateFiles = (files) => {
|
|
804
|
-
const usedNames = /* @__PURE__ */ new Set();
|
|
805
|
-
return files.map((file) => {
|
|
806
|
-
if (!usedNames.has(file.name)) {
|
|
807
|
-
usedNames.add(file.name);
|
|
808
|
-
return file;
|
|
809
|
-
}
|
|
810
|
-
const extension = getFileExtension(file.name);
|
|
811
|
-
const base = extension ? file.name.slice(0, -(extension.length + 1)) : file.name;
|
|
812
|
-
let counter = 1;
|
|
813
|
-
let candidate = extension ? `${base} (${counter}).${extension}` : `${base} (${counter})`;
|
|
814
|
-
while (usedNames.has(candidate)) {
|
|
815
|
-
counter += 1;
|
|
816
|
-
candidate = extension ? `${base} (${counter}).${extension}` : `${base} (${counter})`;
|
|
817
|
-
}
|
|
818
|
-
usedNames.add(candidate);
|
|
819
|
-
return new File([file], candidate, {
|
|
820
|
-
type: file.type,
|
|
821
|
-
lastModified: file.lastModified
|
|
822
|
-
});
|
|
823
|
-
});
|
|
824
|
-
};
|
|
825
|
-
/**
|
|
826
798
|
* This composable handles uploads of data to a hub repository item (space or workflow group).
|
|
827
799
|
* It is a multi-step process which is described as follows:
|
|
828
800
|
*
|