@uploadista/client-core 0.1.2 → 0.1.3-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +157 -111
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/client/create-uploadista-client.ts +44 -6
- package/src/managers/flow-manager.ts +100 -9
- package/src/services/abort-controller-service.ts +106 -0
- package/src/upload/flow-upload.ts +25 -0
- package/src/upload/single-upload.ts +11 -0
package/dist/index.d.mts
CHANGED
|
@@ -228,6 +228,23 @@ declare class ChunkBuffer {
|
|
|
228
228
|
interface AbortControllerLike {
|
|
229
229
|
readonly signal: AbortSignalLike;
|
|
230
230
|
abort(reason?: unknown): void;
|
|
231
|
+
/**
|
|
232
|
+
* Pause the operation (optional, may not be supported by all implementations)
|
|
233
|
+
*/
|
|
234
|
+
pause?(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Resume a paused operation (optional, may not be supported by all implementations)
|
|
237
|
+
*/
|
|
238
|
+
resume?(): void;
|
|
239
|
+
/**
|
|
240
|
+
* Whether the operation is currently paused
|
|
241
|
+
*/
|
|
242
|
+
readonly isPaused?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Wait for resume to be called (returns immediately if not paused)
|
|
245
|
+
* Used by upload loops to pause between chunk uploads
|
|
246
|
+
*/
|
|
247
|
+
waitForResume?(): Promise<void>;
|
|
231
248
|
}
|
|
232
249
|
interface AbortSignalLike {
|
|
233
250
|
readonly aborted: boolean;
|
|
@@ -240,6 +257,47 @@ interface AbortControllerFactory {
|
|
|
240
257
|
*/
|
|
241
258
|
create(): AbortControllerLike;
|
|
242
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* A wrapper that adds pause/resume functionality to an AbortController.
|
|
262
|
+
* Used by FlowManager and upload loops to support pausing chunk uploads.
|
|
263
|
+
*
|
|
264
|
+
* IMPORTANT: This class requires an inner AbortController to be provided.
|
|
265
|
+
* The inner controller's signal is used directly, which ensures compatibility
|
|
266
|
+
* with browser's fetch API (which requires a real AbortSignal).
|
|
267
|
+
*/
|
|
268
|
+
declare class PausableAbortController implements AbortControllerLike {
|
|
269
|
+
private _isPaused;
|
|
270
|
+
private _resumeResolvers;
|
|
271
|
+
private readonly _innerController;
|
|
272
|
+
/**
|
|
273
|
+
* Create a PausableAbortController that wraps an inner AbortController.
|
|
274
|
+
*
|
|
275
|
+
* @param innerController - The inner AbortController to wrap. This should be
|
|
276
|
+
* a real AbortController (from the browser or platform) so that its signal
|
|
277
|
+
* is compatible with fetch API.
|
|
278
|
+
*/
|
|
279
|
+
constructor(innerController: AbortControllerLike);
|
|
280
|
+
/**
|
|
281
|
+
* Returns the inner controller's signal directly.
|
|
282
|
+
* This ensures compatibility with browser's fetch API which requires a real AbortSignal.
|
|
283
|
+
*/
|
|
284
|
+
get signal(): AbortSignalLike;
|
|
285
|
+
get isPaused(): boolean;
|
|
286
|
+
abort(reason?: unknown): void;
|
|
287
|
+
pause(): void;
|
|
288
|
+
resume(): void;
|
|
289
|
+
/**
|
|
290
|
+
* Returns a promise that resolves when resume() is called.
|
|
291
|
+
* If not paused, resolves immediately.
|
|
292
|
+
* If aborted while waiting, resolves immediately (caller should check signal.aborted).
|
|
293
|
+
*/
|
|
294
|
+
waitForResume(): Promise<void>;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Helper function to wait for resume if the controller supports it.
|
|
298
|
+
* Returns immediately if the controller doesn't support pause or isn't paused.
|
|
299
|
+
*/
|
|
300
|
+
declare function waitForResumeIfPaused(controller: AbortControllerLike): Promise<void>;
|
|
243
301
|
//#endregion
|
|
244
302
|
//#region src/services/http-client.d.ts
|
|
245
303
|
/**
|
|
@@ -554,9 +612,7 @@ declare class BaseAuthManager {
|
|
|
554
612
|
* Supports headers and cookies for maximum flexibility.
|
|
555
613
|
*/
|
|
556
614
|
type RequestCredentials = {
|
|
557
|
-
/** HTTP headers to attach (e.g., Authorization, X-API-Key) */
|
|
558
|
-
headers?: Record<string, string>;
|
|
559
|
-
/** Cookies to attach (primarily for browser environments) */
|
|
615
|
+
/** HTTP headers to attach (e.g., Authorization, X-API-Key) */headers?: Record<string, string>; /** Cookies to attach (primarily for browser environments) */
|
|
560
616
|
cookies?: Record<string, string>;
|
|
561
617
|
};
|
|
562
618
|
/**
|
|
@@ -706,9 +762,7 @@ declare class NoAuthManager extends BaseAuthManager {
|
|
|
706
762
|
* Token response from the auth server
|
|
707
763
|
*/
|
|
708
764
|
type TokenResponse = {
|
|
709
|
-
/** JWT token to use for authentication */
|
|
710
|
-
token: string;
|
|
711
|
-
/** Token expiration time in seconds (optional) */
|
|
765
|
+
/** JWT token to use for authentication */token: string; /** Token expiration time in seconds (optional) */
|
|
712
766
|
expiresIn?: number;
|
|
713
767
|
};
|
|
714
768
|
/**
|
|
@@ -1076,11 +1130,11 @@ interface FileSource {
|
|
|
1076
1130
|
slice: (start: number, end: number) => Promise<SliceResult>;
|
|
1077
1131
|
close: () => void;
|
|
1078
1132
|
}
|
|
1079
|
-
interface FileReaderService<UploadInput
|
|
1133
|
+
interface FileReaderService<UploadInput> {
|
|
1080
1134
|
/**
|
|
1081
1135
|
* Open a file for reading
|
|
1082
1136
|
*/
|
|
1083
|
-
openFile(input: UploadInput
|
|
1137
|
+
openFile(input: UploadInput, chunkSize: number): Promise<FileSource>;
|
|
1084
1138
|
}
|
|
1085
1139
|
interface Base64Service {
|
|
1086
1140
|
/**
|
|
@@ -1094,8 +1148,8 @@ interface Base64Service {
|
|
|
1094
1148
|
}
|
|
1095
1149
|
//#endregion
|
|
1096
1150
|
//#region src/services/fingerprint-service.d.ts
|
|
1097
|
-
interface FingerprintService<UploadInput
|
|
1098
|
-
computeFingerprint(file: UploadInput
|
|
1151
|
+
interface FingerprintService<UploadInput> {
|
|
1152
|
+
computeFingerprint(file: UploadInput, endpoint: string): Promise<string | null>;
|
|
1099
1153
|
}
|
|
1100
1154
|
//#endregion
|
|
1101
1155
|
//#region src/services/id-generation-service.d.ts
|
|
@@ -1393,9 +1447,7 @@ declare function createClientStorage(storageService: StorageService): ClientStor
|
|
|
1393
1447
|
* ```
|
|
1394
1448
|
*/
|
|
1395
1449
|
type FlowUploadConfig = {
|
|
1396
|
-
/** Unique identifier of the flow to execute */
|
|
1397
|
-
flowId: string;
|
|
1398
|
-
/** Storage backend where flow outputs will be saved */
|
|
1450
|
+
/** Unique identifier of the flow to execute */flowId: string; /** Storage backend where flow outputs will be saved */
|
|
1399
1451
|
storageId: string;
|
|
1400
1452
|
/**
|
|
1401
1453
|
* Specify which output node to use for single-value callbacks like onSuccess.
|
|
@@ -1421,28 +1473,22 @@ type FlowUploadConfig = {
|
|
|
1421
1473
|
* Contains the upload metadata and HTTP status code.
|
|
1422
1474
|
*/
|
|
1423
1475
|
type UploadistaUploadResponse = {
|
|
1424
|
-
/** Upload file metadata, undefined if request failed */
|
|
1425
|
-
upload?: UploadFile;
|
|
1426
|
-
/** HTTP status code */
|
|
1476
|
+
/** Upload file metadata, undefined if request failed */upload?: UploadFile; /** HTTP status code */
|
|
1427
1477
|
status: number;
|
|
1428
1478
|
};
|
|
1429
1479
|
/**
|
|
1430
1480
|
* Response from delete upload API call.
|
|
1431
1481
|
*/
|
|
1432
1482
|
type UploadistaDeleteUploadResponse = {
|
|
1433
|
-
/** Successfully deleted (no content) */
|
|
1434
|
-
status: 204;
|
|
1483
|
+
/** Successfully deleted (no content) */status: 204;
|
|
1435
1484
|
} | {
|
|
1436
|
-
/** Other status codes (e.g., 404, 500) */
|
|
1437
|
-
status: number;
|
|
1485
|
+
/** Other status codes (e.g., 404, 500) */status: number;
|
|
1438
1486
|
};
|
|
1439
1487
|
/**
|
|
1440
1488
|
* Response from flow retrieval API call.
|
|
1441
1489
|
*/
|
|
1442
1490
|
type FlowResponse = {
|
|
1443
|
-
/** HTTP status code */
|
|
1444
|
-
status: number;
|
|
1445
|
-
/** Flow configuration and metadata */
|
|
1491
|
+
/** HTTP status code */status: number; /** Flow configuration and metadata */
|
|
1446
1492
|
flow: FlowData;
|
|
1447
1493
|
};
|
|
1448
1494
|
/**
|
|
@@ -1873,7 +1919,7 @@ declare class UploadistaError extends Error {
|
|
|
1873
1919
|
* };
|
|
1874
1920
|
* ```
|
|
1875
1921
|
*/
|
|
1876
|
-
interface ServiceContainer<UploadInput
|
|
1922
|
+
interface ServiceContainer<UploadInput> {
|
|
1877
1923
|
/**
|
|
1878
1924
|
* Storage service for persisting upload state and metadata.
|
|
1879
1925
|
*
|
|
@@ -1941,7 +1987,7 @@ interface ServiceContainer<UploadInput$1> {
|
|
|
1941
1987
|
*
|
|
1942
1988
|
* **Generic type**: Accepts platform-specific input types (File, Blob, path string)
|
|
1943
1989
|
*/
|
|
1944
|
-
fileReader: FileReaderService<UploadInput
|
|
1990
|
+
fileReader: FileReaderService<UploadInput>;
|
|
1945
1991
|
/**
|
|
1946
1992
|
* Base64 encoding/decoding service.
|
|
1947
1993
|
*
|
|
@@ -2048,7 +2094,7 @@ interface ServiceContainer<UploadInput$1> {
|
|
|
2048
2094
|
* **Note**: Fingerprints should be stable (same file = same fingerprint) but
|
|
2049
2095
|
* fast to compute (avoid reading entire file if possible)
|
|
2050
2096
|
*/
|
|
2051
|
-
fingerprintService: FingerprintService<UploadInput
|
|
2097
|
+
fingerprintService: FingerprintService<UploadInput>;
|
|
2052
2098
|
}
|
|
2053
2099
|
//#endregion
|
|
2054
2100
|
//#region src/types/upload-response.d.ts
|
|
@@ -2120,6 +2166,7 @@ type Callbacks = {
|
|
|
2120
2166
|
onChunkComplete?: (chunkSize: number, bytesAccepted: number, bytesTotal: number | null) => void;
|
|
2121
2167
|
onSuccess?: (payload: UploadFile) => void;
|
|
2122
2168
|
onError?: (error: Error | UploadistaError) => void;
|
|
2169
|
+
onAbort?: () => void;
|
|
2123
2170
|
onStart?: (file: {
|
|
2124
2171
|
uploadId: string;
|
|
2125
2172
|
size: number | null;
|
|
@@ -2323,54 +2370,30 @@ type UploadistaUploadOptions = {
|
|
|
2323
2370
|
*
|
|
2324
2371
|
* @template UploadInput - The platform-specific file/blob type (e.g., File, Blob, Buffer)
|
|
2325
2372
|
*/
|
|
2326
|
-
type UploadistaClientOptions<UploadInput
|
|
2327
|
-
/** Base URL of the Uploadista server (e.g., "https://upload.example.com") */
|
|
2328
|
-
|
|
2329
|
-
/**
|
|
2330
|
-
|
|
2331
|
-
/**
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
/**
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
/**
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
/**
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
/**
|
|
2348
|
-
|
|
2349
|
-
/**
|
|
2350
|
-
uploadMetrics?: UploadMetricsConfig;
|
|
2351
|
-
/** HTTP client with connection pooling support */
|
|
2352
|
-
httpClient: HttpClient;
|
|
2353
|
-
/** Service for generating unique IDs */
|
|
2354
|
-
generateId: IdGenerationService;
|
|
2355
|
-
/** Client-side storage for upload resumption data */
|
|
2356
|
-
clientStorage: ClientStorage;
|
|
2357
|
-
/** Platform-specific file reading service */
|
|
2358
|
-
fileReader: FileReaderService<UploadInput$1>;
|
|
2359
|
-
/** Logger for debugging and monitoring */
|
|
2360
|
-
logger: Logger;
|
|
2361
|
-
/** Service for computing file fingerprints for resumption */
|
|
2362
|
-
fingerprintService: FingerprintService<UploadInput$1>;
|
|
2363
|
-
/** Whether to store fingerprints for upload resumption. Defaults to true */
|
|
2364
|
-
storeFingerprintForResuming: boolean;
|
|
2365
|
-
/** Factory for creating WebSocket connections */
|
|
2366
|
-
webSocketFactory: WebSocketFactory;
|
|
2367
|
-
/** Factory for creating abort controllers */
|
|
2368
|
-
abortControllerFactory: AbortControllerFactory;
|
|
2369
|
-
/** Platform-specific service for timers and async operations */
|
|
2370
|
-
platformService: PlatformService;
|
|
2371
|
-
/** Global error handler for all upload operations */
|
|
2372
|
-
onError?: (error: Error) => void;
|
|
2373
|
-
/** WebSocket event handler for real-time upload/flow events */
|
|
2373
|
+
type UploadistaClientOptions<UploadInput> = {
|
|
2374
|
+
/** Base URL of the Uploadista server (e.g., "https://upload.example.com") */baseUrl: string; /** Base path for Uploadista endpoints. Defaults to "uploadista" */
|
|
2375
|
+
uploadistaBasePath?: string; /** Storage backend identifier configured on the server */
|
|
2376
|
+
storageId: string; /** Retry delay intervals in milliseconds. Defaults to [1000, 3000, 5000] */
|
|
2377
|
+
retryDelays?: number[]; /** Default chunk size in bytes for uploads */
|
|
2378
|
+
chunkSize: number; /** Number of parallel upload streams. Defaults to 1 (sequential) */
|
|
2379
|
+
parallelUploads?: number; /** Chunk size for parallel uploads. Required if parallelUploads > 1 */
|
|
2380
|
+
parallelChunkSize?: number; /** Service for computing checksums of uploaded chunks */
|
|
2381
|
+
checksumService: ChecksumService; /** Strategy configuration for determining upload approach (single/parallel/chunked) */
|
|
2382
|
+
uploadStrategy?: UploadStrategyConfig; /** Smart chunking configuration for adaptive chunk sizes based on network conditions */
|
|
2383
|
+
smartChunking?: SmartChunkerConfig; /** Network monitoring configuration for tracking upload performance */
|
|
2384
|
+
networkMonitoring?: NetworkMonitorConfig; /** Upload metrics configuration for performance insights */
|
|
2385
|
+
uploadMetrics?: UploadMetricsConfig; /** HTTP client with connection pooling support */
|
|
2386
|
+
httpClient: HttpClient; /** Service for generating unique IDs */
|
|
2387
|
+
generateId: IdGenerationService; /** Client-side storage for upload resumption data */
|
|
2388
|
+
clientStorage: ClientStorage; /** Platform-specific file reading service */
|
|
2389
|
+
fileReader: FileReaderService<UploadInput>; /** Logger for debugging and monitoring */
|
|
2390
|
+
logger: Logger; /** Service for computing file fingerprints for resumption */
|
|
2391
|
+
fingerprintService: FingerprintService<UploadInput>; /** Whether to store fingerprints for upload resumption. Defaults to true */
|
|
2392
|
+
storeFingerprintForResuming: boolean; /** Factory for creating WebSocket connections */
|
|
2393
|
+
webSocketFactory: WebSocketFactory; /** Factory for creating abort controllers */
|
|
2394
|
+
abortControllerFactory: AbortControllerFactory; /** Platform-specific service for timers and async operations */
|
|
2395
|
+
platformService: PlatformService; /** Global error handler for all upload operations */
|
|
2396
|
+
onError?: (error: Error) => void; /** WebSocket event handler for real-time upload/flow events */
|
|
2374
2397
|
onEvent?: UploadistaWebSocketEventHandler;
|
|
2375
2398
|
/**
|
|
2376
2399
|
* Optional authentication configuration.
|
|
@@ -2525,7 +2548,7 @@ declare const defaultConnectionPoolingConfig: ConnectionPoolConfig;
|
|
|
2525
2548
|
* @see {@link UploadistaClientOptions} for full configuration options
|
|
2526
2549
|
* @see {@link UploadistaUploadOptions} for per-upload options
|
|
2527
2550
|
*/
|
|
2528
|
-
declare function createUploadistaClient<UploadInput
|
|
2551
|
+
declare function createUploadistaClient<UploadInput>({
|
|
2529
2552
|
baseUrl: _baseUrl,
|
|
2530
2553
|
uploadistaBasePath,
|
|
2531
2554
|
storageId,
|
|
@@ -2550,8 +2573,8 @@ declare function createUploadistaClient<UploadInput$1>({
|
|
|
2550
2573
|
abortControllerFactory,
|
|
2551
2574
|
platformService,
|
|
2552
2575
|
auth
|
|
2553
|
-
}: UploadistaClientOptions<UploadInput
|
|
2554
|
-
upload: (file: UploadInput
|
|
2576
|
+
}: UploadistaClientOptions<UploadInput>): {
|
|
2577
|
+
upload: (file: UploadInput, {
|
|
2555
2578
|
uploadLengthDeferred,
|
|
2556
2579
|
uploadSize,
|
|
2557
2580
|
onProgress,
|
|
@@ -2562,16 +2585,20 @@ declare function createUploadistaClient<UploadInput$1>({
|
|
|
2562
2585
|
}?: UploadistaUploadOptions) => Promise<{
|
|
2563
2586
|
abort: () => void;
|
|
2564
2587
|
}>;
|
|
2565
|
-
uploadWithFlow: (file: UploadInput
|
|
2588
|
+
uploadWithFlow: (file: UploadInput, flowConfig: FlowUploadConfig, {
|
|
2566
2589
|
onProgress,
|
|
2567
2590
|
onChunkComplete,
|
|
2568
2591
|
onSuccess,
|
|
2569
2592
|
onShouldRetry,
|
|
2570
2593
|
onJobStart,
|
|
2571
|
-
onError
|
|
2572
|
-
|
|
2594
|
+
onError,
|
|
2595
|
+
onAbort
|
|
2596
|
+
}?: Omit<UploadistaUploadOptions, "uploadLengthDeferred" | "uploadSize" | "metadata"> & {
|
|
2597
|
+
onAbort?: () => void;
|
|
2598
|
+
}) => Promise<{
|
|
2573
2599
|
abort: () => Promise<void>;
|
|
2574
2600
|
pause: () => Promise<void>;
|
|
2601
|
+
resume: () => Promise<void>;
|
|
2575
2602
|
jobId: string;
|
|
2576
2603
|
}>;
|
|
2577
2604
|
multiInputFlowUpload: (inputs: Record<string, unknown>, flowConfig: FlowUploadConfig, {
|
|
@@ -2590,6 +2617,7 @@ declare function createUploadistaClient<UploadInput$1>({
|
|
|
2590
2617
|
}) => Promise<{
|
|
2591
2618
|
abort: () => Promise<void>;
|
|
2592
2619
|
pause: () => Promise<void>;
|
|
2620
|
+
resume: () => Promise<void>;
|
|
2593
2621
|
jobId: string;
|
|
2594
2622
|
}>;
|
|
2595
2623
|
abort: (params: Parameters<typeof abort>[0]) => Promise<void>;
|
|
@@ -2723,12 +2751,12 @@ declare function createUploadistaClient<UploadInput$1>({
|
|
|
2723
2751
|
connectionOverhead: number;
|
|
2724
2752
|
}>;
|
|
2725
2753
|
resetMetrics: () => Promise<void>;
|
|
2726
|
-
validateConfiguration: (options: UploadistaClientOptions<UploadInput
|
|
2754
|
+
validateConfiguration: (options: UploadistaClientOptions<UploadInput>) => {
|
|
2727
2755
|
valid: boolean;
|
|
2728
2756
|
errors: string[];
|
|
2729
2757
|
warnings: string[];
|
|
2730
2758
|
};
|
|
2731
|
-
validateConfigurationAsync: (options: UploadistaClientOptions<UploadInput
|
|
2759
|
+
validateConfigurationAsync: (options: UploadistaClientOptions<UploadInput>) => Promise<{
|
|
2732
2760
|
valid: boolean;
|
|
2733
2761
|
errors: string[];
|
|
2734
2762
|
warnings: string[];
|
|
@@ -3025,9 +3053,9 @@ interface FlowUploadOptions {
|
|
|
3025
3053
|
//#region src/managers/flow-manager.d.ts
|
|
3026
3054
|
/**
|
|
3027
3055
|
* Flow upload status representing the current state of a flow upload lifecycle.
|
|
3028
|
-
* Flow uploads progress through: idle → uploading → processing → success/error/aborted
|
|
3056
|
+
* Flow uploads progress through: idle → uploading → processing → success/error/aborted/paused
|
|
3029
3057
|
*/
|
|
3030
|
-
type FlowUploadStatus = "idle" | "uploading" | "processing" | "success" | "error" | "aborted";
|
|
3058
|
+
type FlowUploadStatus = "idle" | "uploading" | "processing" | "success" | "error" | "aborted" | "paused";
|
|
3031
3059
|
/**
|
|
3032
3060
|
* Complete state information for a flow upload operation.
|
|
3033
3061
|
* Tracks both the upload phase (file transfer) and processing phase (flow execution).
|
|
@@ -3057,6 +3085,8 @@ interface FlowUploadState {
|
|
|
3057
3085
|
* Available when status is "success".
|
|
3058
3086
|
*/
|
|
3059
3087
|
flowOutputs: TypedOutput[] | null;
|
|
3088
|
+
/** Node ID where the flow was paused (available when status is "paused") */
|
|
3089
|
+
pausedAtNodeId: string | null;
|
|
3060
3090
|
}
|
|
3061
3091
|
/**
|
|
3062
3092
|
* State for a single input in a multi-input flow.
|
|
@@ -3142,6 +3172,10 @@ interface FlowManagerCallbacks {
|
|
|
3142
3172
|
* Called when upload or flow is aborted
|
|
3143
3173
|
*/
|
|
3144
3174
|
onAbort?: () => void;
|
|
3175
|
+
/**
|
|
3176
|
+
* Called when flow is paused
|
|
3177
|
+
*/
|
|
3178
|
+
onPause?: () => void;
|
|
3145
3179
|
}
|
|
3146
3180
|
/**
|
|
3147
3181
|
* Generic flow execution input type - can be any value that the flow execution client accepts.
|
|
@@ -3169,6 +3203,7 @@ interface FlowConfig {
|
|
|
3169
3203
|
interface FlowUploadAbortController {
|
|
3170
3204
|
abort: () => void | Promise<void>;
|
|
3171
3205
|
pause: () => void | Promise<void>;
|
|
3206
|
+
resume: () => void | Promise<void>;
|
|
3172
3207
|
}
|
|
3173
3208
|
/**
|
|
3174
3209
|
* Internal upload options used by the flow upload function.
|
|
@@ -3307,10 +3342,18 @@ declare class FlowManager<TInput = FlowUploadInput> {
|
|
|
3307
3342
|
* Check if flow processing is in progress
|
|
3308
3343
|
*/
|
|
3309
3344
|
isProcessing(): boolean;
|
|
3345
|
+
/**
|
|
3346
|
+
* Check if flow is paused
|
|
3347
|
+
*/
|
|
3348
|
+
isPaused(): boolean;
|
|
3310
3349
|
/**
|
|
3311
3350
|
* Get the current job ID
|
|
3312
3351
|
*/
|
|
3313
3352
|
getJobId(): string | null;
|
|
3353
|
+
/**
|
|
3354
|
+
* Get the node ID where the flow is paused (if applicable)
|
|
3355
|
+
*/
|
|
3356
|
+
getPausedAtNodeId(): string | null;
|
|
3314
3357
|
/**
|
|
3315
3358
|
* Update the internal state and notify callbacks
|
|
3316
3359
|
*/
|
|
@@ -3352,13 +3395,24 @@ declare class FlowManager<TInput = FlowUploadInput> {
|
|
|
3352
3395
|
*/
|
|
3353
3396
|
upload(input: TInput): Promise<void>;
|
|
3354
3397
|
/**
|
|
3355
|
-
* Abort the current flow upload
|
|
3398
|
+
* Abort the current flow upload.
|
|
3399
|
+
* This will:
|
|
3400
|
+
* 1. Cancel the flow on the server
|
|
3401
|
+
* 2. Abort any in-progress chunk uploads
|
|
3402
|
+
* 3. Close WebSocket connections
|
|
3356
3403
|
*/
|
|
3357
|
-
abort(): void
|
|
3404
|
+
abort(): Promise<void>;
|
|
3358
3405
|
/**
|
|
3359
|
-
* Pause the current flow upload
|
|
3406
|
+
* Pause the current flow upload.
|
|
3407
|
+
* During upload phase: Pauses chunk uploads client-side.
|
|
3408
|
+
* During processing phase: Calls server to pause flow execution.
|
|
3360
3409
|
*/
|
|
3361
|
-
pause(): void
|
|
3410
|
+
pause(): Promise<void>;
|
|
3411
|
+
/**
|
|
3412
|
+
* Resume a paused flow upload.
|
|
3413
|
+
* Continues chunk uploads if paused during upload phase.
|
|
3414
|
+
*/
|
|
3415
|
+
resume(): Promise<void>;
|
|
3362
3416
|
/**
|
|
3363
3417
|
* Reset the flow upload state to idle
|
|
3364
3418
|
*/
|
|
@@ -3738,9 +3792,9 @@ type FlowResult<TOutput = UploadFile> = {
|
|
|
3738
3792
|
/**
|
|
3739
3793
|
* Flow upload item for multi-flow-upload tracking
|
|
3740
3794
|
*/
|
|
3741
|
-
interface FlowUploadItem<UploadInput
|
|
3795
|
+
interface FlowUploadItem<UploadInput> {
|
|
3742
3796
|
id: string;
|
|
3743
|
-
file: UploadInput
|
|
3797
|
+
file: UploadInput;
|
|
3744
3798
|
status: "pending" | "uploading" | "success" | "error" | "aborted";
|
|
3745
3799
|
progress: number;
|
|
3746
3800
|
bytesUploaded: number;
|
|
@@ -3751,7 +3805,7 @@ interface FlowUploadItem<UploadInput$1> {
|
|
|
3751
3805
|
}
|
|
3752
3806
|
//#endregion
|
|
3753
3807
|
//#region src/types/multi-flow-upload-options.d.ts
|
|
3754
|
-
interface MultiFlowUploadOptions<UploadInput
|
|
3808
|
+
interface MultiFlowUploadOptions<UploadInput> {
|
|
3755
3809
|
/**
|
|
3756
3810
|
* Flow configuration
|
|
3757
3811
|
*/
|
|
@@ -3763,19 +3817,19 @@ interface MultiFlowUploadOptions<UploadInput$1> {
|
|
|
3763
3817
|
/**
|
|
3764
3818
|
* Called when an individual upload progresses
|
|
3765
3819
|
*/
|
|
3766
|
-
onItemProgress?: (item: FlowUploadItem<UploadInput
|
|
3820
|
+
onItemProgress?: (item: FlowUploadItem<UploadInput>) => void;
|
|
3767
3821
|
/**
|
|
3768
3822
|
* Called when an individual upload succeeds
|
|
3769
3823
|
*/
|
|
3770
|
-
onItemSuccess?: (item: FlowUploadItem<UploadInput
|
|
3824
|
+
onItemSuccess?: (item: FlowUploadItem<UploadInput>) => void;
|
|
3771
3825
|
/**
|
|
3772
3826
|
* Called when an individual upload fails
|
|
3773
3827
|
*/
|
|
3774
|
-
onItemError?: (item: FlowUploadItem<UploadInput
|
|
3828
|
+
onItemError?: (item: FlowUploadItem<UploadInput>, error: Error) => void;
|
|
3775
3829
|
/**
|
|
3776
3830
|
* Called when all uploads complete
|
|
3777
3831
|
*/
|
|
3778
|
-
onComplete?: (items: FlowUploadItem<UploadInput
|
|
3832
|
+
onComplete?: (items: FlowUploadItem<UploadInput>[]) => void;
|
|
3779
3833
|
/**
|
|
3780
3834
|
* Custom retry logic
|
|
3781
3835
|
*/
|
|
@@ -3783,8 +3837,8 @@ interface MultiFlowUploadOptions<UploadInput$1> {
|
|
|
3783
3837
|
}
|
|
3784
3838
|
//#endregion
|
|
3785
3839
|
//#region src/types/multi-flow-upload-state.d.ts
|
|
3786
|
-
interface MultiFlowUploadState<UploadInput
|
|
3787
|
-
items: FlowUploadItem<UploadInput
|
|
3840
|
+
interface MultiFlowUploadState<UploadInput> {
|
|
3841
|
+
items: FlowUploadItem<UploadInput>[];
|
|
3788
3842
|
totalProgress: number;
|
|
3789
3843
|
activeUploads: number;
|
|
3790
3844
|
completedUploads: number;
|
|
@@ -3858,11 +3912,8 @@ interface UploadMetrics {
|
|
|
3858
3912
|
* ```
|
|
3859
3913
|
*/
|
|
3860
3914
|
exportMetrics: () => {
|
|
3861
|
-
/** Session-level aggregated metrics */
|
|
3862
|
-
|
|
3863
|
-
/** Per-chunk detailed metrics */
|
|
3864
|
-
chunks: ChunkMetrics[];
|
|
3865
|
-
/** Performance insights and recommendations */
|
|
3915
|
+
/** Session-level aggregated metrics */session: Partial<UploadSessionMetrics>; /** Per-chunk detailed metrics */
|
|
3916
|
+
chunks: ChunkMetrics[]; /** Performance insights and recommendations */
|
|
3866
3917
|
insights: PerformanceInsights;
|
|
3867
3918
|
};
|
|
3868
3919
|
/**
|
|
@@ -3957,19 +4008,14 @@ interface UploadMetrics {
|
|
|
3957
4008
|
* ```
|
|
3958
4009
|
*/
|
|
3959
4010
|
type UploadResult<TOutput = UploadFile$1> = {
|
|
3960
|
-
/** Indicates the upload completed successfully */
|
|
3961
|
-
type: "success";
|
|
3962
|
-
/** The successful result value (e.g., upload metadata or processed output) */
|
|
4011
|
+
/** Indicates the upload completed successfully */type: "success"; /** The successful result value (e.g., upload metadata or processed output) */
|
|
3963
4012
|
value: TOutput;
|
|
3964
4013
|
} | {
|
|
3965
|
-
/** Indicates the upload failed with an error */
|
|
3966
|
-
type: "error";
|
|
3967
|
-
/** The error that caused the upload to fail */
|
|
4014
|
+
/** Indicates the upload failed with an error */type: "error"; /** The error that caused the upload to fail */
|
|
3968
4015
|
error: Error;
|
|
3969
4016
|
} | {
|
|
3970
|
-
/** Indicates the upload was cancelled by the user or application */
|
|
3971
|
-
type: "cancelled";
|
|
4017
|
+
/** Indicates the upload was cancelled by the user or application */type: "cancelled";
|
|
3972
4018
|
};
|
|
3973
4019
|
//#endregion
|
|
3974
|
-
export { AbortControllerFactory, AbortControllerLike, AbortSignalLike, Base64Service, ChecksumService, ChunkBuffer, ChunkBufferConfig, ChunkMetrics, ClientStorage, ConnectionHealth, ConnectionMetrics, ConnectionPoolConfig, DetailedConnectionMetrics, type EventFilterOptions, type EventSource, EventSubscriptionManager, FileReaderService, FileSource, FingerprintService, type FlowConfig, FlowInputs, FlowManager, type FlowManagerCallbacks, FlowResponse, FlowResult, type FlowUploadAbortController, FlowUploadConfig, type FlowUploadFunction, type FlowUploadInput, FlowUploadItem, FlowUploadOptions, type FlowUploadState, type FlowUploadStatus, type GenericEvent, HeadersLike, Http2Info, HttpClient, HttpRequestOptions, HttpResponse, IdGenerationService, type InputExecutionState, InputNodeDiscovery, type InternalFlowUploadOptions, LogFunction, Logger, MultiFlowUploadOptions, MultiFlowUploadState, type MultiInputCallbacks, type MultiInputFlowUploadFunction, NetworkCondition, NetworkMetrics, NetworkMonitor, NetworkMonitorConfig, PerformanceInsights, PlatformService, PreviousUpload, RequestBody, ServiceContainer, SingleFlowInput, SliceResult, StorageService, type SubscriptionEventHandler, Timeout, type UnsubscribeFunction, type UploadAbortController, type UploadFunction, type UploadInput, UploadManager, type UploadManagerCallbacks, UploadMetrics, UploadOptions, UploadResponse, UploadResult, UploadSample, UploadSessionMetrics, type UploadState, type UploadStatus, UploadistaApi, UploadistaClient, UploadistaClientOptions, UploadistaDeleteUploadResponse, UploadistaError, UploadistaErrorName, UploadistaEvent, UploadistaUploadOptions, UploadistaUploadResponse, UploadistaWebSocketEventHandler, UploadistaWebSocketManager, UploadistaWebSocketMessage, WebSocketEventMap, WebSocketFactory, WebSocketLike, createClientStorage, createInMemoryStorageService, createLogger, createUploadistaApi, createUploadistaClient, defaultConnectionPoolingConfig, previousUploadSchema, wait };
|
|
4020
|
+
export { AbortControllerFactory, AbortControllerLike, AbortSignalLike, Base64Service, ChecksumService, ChunkBuffer, ChunkBufferConfig, ChunkMetrics, ClientStorage, ConnectionHealth, ConnectionMetrics, ConnectionPoolConfig, DetailedConnectionMetrics, type EventFilterOptions, type EventSource, EventSubscriptionManager, FileReaderService, FileSource, FingerprintService, type FlowConfig, FlowInputs, FlowManager, type FlowManagerCallbacks, FlowResponse, FlowResult, type FlowUploadAbortController, FlowUploadConfig, type FlowUploadFunction, type FlowUploadInput, FlowUploadItem, FlowUploadOptions, type FlowUploadState, type FlowUploadStatus, type GenericEvent, HeadersLike, Http2Info, HttpClient, HttpRequestOptions, HttpResponse, IdGenerationService, type InputExecutionState, InputNodeDiscovery, type InternalFlowUploadOptions, LogFunction, Logger, MultiFlowUploadOptions, MultiFlowUploadState, type MultiInputCallbacks, type MultiInputFlowUploadFunction, NetworkCondition, NetworkMetrics, NetworkMonitor, NetworkMonitorConfig, PausableAbortController, PerformanceInsights, PlatformService, PreviousUpload, RequestBody, ServiceContainer, SingleFlowInput, SliceResult, StorageService, type SubscriptionEventHandler, Timeout, type UnsubscribeFunction, type UploadAbortController, type UploadFunction, type UploadInput, UploadManager, type UploadManagerCallbacks, UploadMetrics, UploadOptions, UploadResponse, UploadResult, UploadSample, UploadSessionMetrics, type UploadState, type UploadStatus, UploadistaApi, UploadistaClient, UploadistaClientOptions, UploadistaDeleteUploadResponse, UploadistaError, UploadistaErrorName, UploadistaEvent, UploadistaUploadOptions, UploadistaUploadResponse, UploadistaWebSocketEventHandler, UploadistaWebSocketManager, UploadistaWebSocketMessage, WebSocketEventMap, WebSocketFactory, WebSocketLike, createClientStorage, createInMemoryStorageService, createLogger, createUploadistaApi, createUploadistaClient, defaultConnectionPoolingConfig, previousUploadSchema, wait, waitForResumeIfPaused };
|
|
3975
4021
|
//# sourceMappingURL=index.d.mts.map
|