@uploadista/vue 0.0.20-beta.9 → 0.1.0-beta.5
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/components/index.d.mts +3 -3
- package/dist/components/index.mjs +1 -1
- package/dist/{components-CskPs6sR.css → components-B_L33hsM.css} +33 -33
- package/dist/{components-CskPs6sR.css.map → components-B_L33hsM.css.map} +1 -1
- package/dist/components-MZ9ETx9c.mjs +2 -0
- package/dist/components-MZ9ETx9c.mjs.map +1 -0
- package/dist/composables/index.d.mts +1 -1
- package/dist/composables/index.mjs +1 -1
- package/dist/composables-Dny_9Zrg.mjs +2 -0
- package/dist/composables-Dny_9Zrg.mjs.map +1 -0
- package/dist/index-6Scxoy1b.d.mts +1289 -0
- package/dist/index-6Scxoy1b.d.mts.map +1 -0
- package/dist/{index-B2fUTjNP.d.mts → index-BpCRFLJ5.d.mts} +4 -4
- package/dist/index-BpCRFLJ5.d.mts.map +1 -0
- package/dist/{index-DiRR_Ua6.d.mts → index-RY4FPqAk.d.mts} +431 -432
- package/dist/index-RY4FPqAk.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/providers/index.d.mts +1 -1
- package/dist/providers/index.mjs +1 -1
- package/dist/{providers-fqmOwF71.mjs → providers-CjhEBaQV.mjs} +2 -2
- package/dist/providers-CjhEBaQV.mjs.map +1 -0
- package/dist/useUploadistaClient-WVuo8jYH.mjs.map +1 -1
- package/dist/utils/index.d.mts +62 -2
- package/dist/utils/index.d.mts.map +1 -0
- package/package.json +11 -9
- package/src/__tests__/setup.ts +154 -0
- package/src/components/FlowUploadList.vue +25 -24
- package/src/components/UploadList.vue +3 -6
- package/src/components/UploadZone.vue +2 -5
- package/src/components/flow/Flow.vue +16 -4
- package/src/components/flow/FlowDropZone.vue +4 -2
- package/src/components/flow/FlowInput.vue +14 -8
- package/src/components/flow/FlowInputDropZone.vue +4 -2
- package/src/components/flow/FlowInputPreview.vue +3 -1
- package/src/components/flow/FlowProgress.vue +1 -1
- package/src/components/flow/FlowStatus.vue +1 -1
- package/src/components/flow/useFlowContext.ts +7 -5
- package/src/components/index.ts +4 -2
- package/src/components/upload/Upload.vue +146 -0
- package/src/components/upload/UploadCancel.vue +22 -0
- package/src/components/upload/UploadClearCompleted.vue +24 -0
- package/src/components/upload/UploadDropZone.vue +96 -0
- package/src/components/upload/UploadError.vue +42 -0
- package/src/components/upload/UploadItem.vue +54 -0
- package/src/components/upload/UploadItems.vue +33 -0
- package/src/components/upload/UploadProgress.vue +35 -0
- package/src/components/upload/UploadReset.vue +20 -0
- package/src/components/upload/UploadRetry.vue +22 -0
- package/src/components/upload/UploadStartAll.vue +30 -0
- package/src/components/upload/UploadStatus.vue +65 -0
- package/src/components/upload/index.ts +98 -0
- package/src/components/upload/useUploadContext.ts +67 -0
- package/src/composables/eventUtils.test.ts +267 -0
- package/src/composables/eventUtils.ts +5 -4
- package/src/composables/index.ts +1 -1
- package/src/composables/useDragDrop.test.ts +304 -0
- package/src/composables/useFlow.ts +6 -2
- package/src/composables/useFlowManagerContext.ts +5 -1
- package/src/composables/useUploadEvents.ts +1 -4
- package/src/composables/useUploadistaClient.test.ts +152 -0
- package/src/index.ts +65 -4
- package/src/providers/FlowManagerProvider.vue +5 -2
- package/src/utils/index.test.ts +396 -0
- package/src/utils/is-browser-file.test.ts +45 -0
- package/vitest.config.ts +25 -0
- package/dist/components-BxBz_7tS.mjs +0 -2
- package/dist/components-BxBz_7tS.mjs.map +0 -1
- package/dist/composables-BZ2c_WgI.mjs +0 -2
- package/dist/composables-BZ2c_WgI.mjs.map +0 -1
- package/dist/index-B2fUTjNP.d.mts.map +0 -1
- package/dist/index-BLNNvTVx.d.mts +0 -62
- package/dist/index-BLNNvTVx.d.mts.map +0 -1
- package/dist/index-D3PNaPGh.d.mts +0 -787
- package/dist/index-D3PNaPGh.d.mts.map +0 -1
- package/dist/index-DiRR_Ua6.d.mts.map +0 -1
- package/dist/providers-fqmOwF71.mjs.map +0 -1
|
@@ -1,305 +1,213 @@
|
|
|
1
1
|
import * as vue1 from "vue";
|
|
2
2
|
import { App, InjectionKey, Ref } from "vue";
|
|
3
|
-
import { FlowEvent, FlowEventFlowCancel, FlowEventFlowEnd, FlowEventFlowError, FlowEventFlowPause, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodePause, FlowEventNodeResume, FlowEventNodeStart } from "@uploadista/core/flow";
|
|
4
|
-
import { UploadEvent, UploadFile } from "@uploadista/core/types";
|
|
5
3
|
import * as _uploadista_client_browser0 from "@uploadista/client-browser";
|
|
6
4
|
import { BrowserUploadInput, ChunkMetrics, ChunkMetrics as ChunkMetrics$1, FlowUploadOptions, MultiFlowUploadOptions, PerformanceInsights, PerformanceInsights as PerformanceInsights$1, UploadOptions, UploadSessionMetrics, UploadSessionMetrics as UploadSessionMetrics$1, UploadistaClientOptions, UploadistaEvent, createUploadistaClient } from "@uploadista/client-browser";
|
|
5
|
+
import { FlowEvent, FlowEventFlowCancel, FlowEventFlowEnd, FlowEventFlowError, FlowEventFlowPause, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodePause, FlowEventNodeResume, FlowEventNodeStart } from "@uploadista/core/flow";
|
|
6
|
+
import { UploadEvent, UploadFile } from "@uploadista/core/types";
|
|
7
7
|
import * as _uploadista_client_core0 from "@uploadista/client-core";
|
|
8
8
|
import { FlowUploadState, FlowUploadStatus as FlowUploadStatus$1, InputExecutionState, UploadMetrics, UploadOptions as UploadOptions$1, UploadState, UploadStatus } from "@uploadista/client-core";
|
|
9
9
|
import * as _uploadista_core0 from "@uploadista/core";
|
|
10
10
|
|
|
11
|
-
//#region src/composables/
|
|
11
|
+
//#region src/composables/useFlow.d.ts
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Input metadata discovered from the flow
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
interface FlowInputMetadata {
|
|
16
|
+
/** Input node ID */
|
|
17
|
+
nodeId: string;
|
|
18
|
+
/** Human-readable node name */
|
|
19
|
+
nodeName: string;
|
|
20
|
+
/** Node description explaining what input is needed */
|
|
21
|
+
nodeDescription: string;
|
|
22
|
+
/** Input type ID from inputTypeRegistry - describes how clients interact with this node */
|
|
23
|
+
inputTypeId?: string;
|
|
24
|
+
/** Whether this input is required */
|
|
25
|
+
required: boolean;
|
|
26
|
+
}
|
|
16
27
|
/**
|
|
17
|
-
*
|
|
28
|
+
* Return value from the useFlow composable with upload control methods and state.
|
|
29
|
+
*
|
|
30
|
+
* @property state - Complete flow upload state with progress and outputs
|
|
31
|
+
* @property inputMetadata - Metadata about discovered input nodes (null until discovered)
|
|
32
|
+
* @property inputStates - Per-input execution state for multi-input flows
|
|
33
|
+
* @property inputs - Current input values set via setInput()
|
|
34
|
+
* @property setInput - Set an input value for a specific node (for progressive provision)
|
|
35
|
+
* @property execute - Execute the flow with current inputs (auto-detects types)
|
|
36
|
+
* @property upload - Convenience method for single-file upload (same as execute with one file input)
|
|
37
|
+
* @property abort - Cancel the current upload and flow execution
|
|
38
|
+
* @property pause - Pause the current upload
|
|
39
|
+
* @property reset - Reset state to idle (clears all data)
|
|
40
|
+
* @property isUploading - True when upload or processing is active
|
|
41
|
+
* @property isUploadingFile - True only during file upload phase
|
|
42
|
+
* @property isProcessing - True only during flow processing phase
|
|
43
|
+
* @property isDiscoveringInputs - True while discovering flow inputs
|
|
18
44
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
45
|
+
interface UseFlowReturn {
|
|
46
|
+
/**
|
|
47
|
+
* Current upload state
|
|
48
|
+
*/
|
|
49
|
+
state: Readonly<Ref<FlowUploadState>>;
|
|
50
|
+
/**
|
|
51
|
+
* Discovered input nodes metadata (null until discovery completes)
|
|
52
|
+
*/
|
|
53
|
+
inputMetadata: Readonly<Ref<FlowInputMetadata[] | null>>;
|
|
54
|
+
/**
|
|
55
|
+
* Per-input execution state for multi-input flows
|
|
56
|
+
*/
|
|
57
|
+
inputStates: Readonly<Ref<ReadonlyMap<string, InputExecutionState>>>;
|
|
58
|
+
/**
|
|
59
|
+
* Current inputs set via setInput()
|
|
60
|
+
*/
|
|
61
|
+
inputs: Readonly<Ref<Record<string, unknown>>>;
|
|
62
|
+
/**
|
|
63
|
+
* Set an input value for a specific node.
|
|
64
|
+
* For progressive input provision before calling execute().
|
|
65
|
+
*
|
|
66
|
+
* @param nodeId - The input node ID
|
|
67
|
+
* @param value - The input value (File, URL string, or structured data)
|
|
68
|
+
*/
|
|
69
|
+
setInput: (nodeId: string, value: unknown) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Execute the flow with current inputs.
|
|
72
|
+
* Automatically detects input types and routes appropriately.
|
|
73
|
+
* For single input, uses standard upload path.
|
|
74
|
+
* For multiple inputs, requires multiInputUploadFn.
|
|
75
|
+
*/
|
|
76
|
+
execute: () => Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Upload a single file through the flow (convenience method).
|
|
79
|
+
* Equivalent to setInput(firstNodeId, file) + execute().
|
|
80
|
+
*
|
|
81
|
+
* @param file - File or Blob to upload
|
|
82
|
+
*/
|
|
83
|
+
upload: (file: File | Blob) => Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Abort the current upload
|
|
86
|
+
*/
|
|
87
|
+
abort: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* Pause the current upload
|
|
90
|
+
*/
|
|
91
|
+
pause: () => void;
|
|
92
|
+
/**
|
|
93
|
+
* Reset the upload state and clear all inputs
|
|
94
|
+
*/
|
|
95
|
+
reset: () => void;
|
|
96
|
+
/**
|
|
97
|
+
* Whether an upload or flow execution is in progress (uploading OR processing)
|
|
98
|
+
*/
|
|
99
|
+
isUploading: Readonly<Ref<boolean>>;
|
|
100
|
+
/**
|
|
101
|
+
* Whether the file is currently being uploaded (chunks being sent)
|
|
102
|
+
*/
|
|
103
|
+
isUploadingFile: Readonly<Ref<boolean>>;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the flow is currently processing (after upload completes)
|
|
106
|
+
*/
|
|
107
|
+
isProcessing: Readonly<Ref<boolean>>;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the hook is discovering flow inputs
|
|
110
|
+
*/
|
|
111
|
+
isDiscoveringInputs: Readonly<Ref<boolean>>;
|
|
112
|
+
}
|
|
22
113
|
/**
|
|
23
|
-
*
|
|
114
|
+
* Vue composable for executing flows with single or multiple inputs.
|
|
115
|
+
* Automatically discovers input nodes and detects input types (File, URL, structured data).
|
|
116
|
+
* Supports progressive input provision via setInput() and execute().
|
|
24
117
|
*
|
|
25
|
-
* This is
|
|
26
|
-
*
|
|
118
|
+
* This is the unified flow composable that replaces useFlowUpload for advanced use cases.
|
|
119
|
+
* It provides:
|
|
120
|
+
* - Auto-discovery of flow input nodes
|
|
121
|
+
* - Automatic input type detection (file -> upload, string -> URL, object -> data)
|
|
122
|
+
* - Progressive input provision via setInput()
|
|
123
|
+
* - Multi-input support with parallel coordination
|
|
124
|
+
* - Per-input state tracking
|
|
27
125
|
*
|
|
28
|
-
* Must be used within UploadistaProvider.
|
|
126
|
+
* Must be used within FlowManagerProvider (which must be within UploadistaProvider).
|
|
127
|
+
* Flow events are automatically routed by the provider to the appropriate manager.
|
|
29
128
|
*
|
|
30
|
-
* @param
|
|
129
|
+
* @param options - Flow upload configuration including flow ID and event handlers
|
|
130
|
+
* @returns Flow upload state and control methods
|
|
31
131
|
*
|
|
32
132
|
* @example
|
|
33
133
|
* ```vue
|
|
34
134
|
* <script setup lang="ts">
|
|
35
|
-
* import {
|
|
135
|
+
* import { useFlow } from '@uploadista/vue';
|
|
36
136
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* }
|
|
137
|
+
* // Single file upload (simple case)
|
|
138
|
+
* const flow = useFlow({
|
|
139
|
+
* flowConfig: {
|
|
140
|
+
* flowId: "image-optimization",
|
|
141
|
+
* storageId: "s3-images",
|
|
142
|
+
* },
|
|
143
|
+
* onSuccess: (outputs) => {
|
|
144
|
+
* console.log("Flow outputs:", outputs);
|
|
145
|
+
* },
|
|
43
146
|
* });
|
|
147
|
+
*
|
|
148
|
+
* const handleFileChange = (event: Event) => {
|
|
149
|
+
* const file = (event.target as HTMLInputElement).files?.[0];
|
|
150
|
+
* if (file) flow.upload(file);
|
|
151
|
+
* };
|
|
44
152
|
* </script>
|
|
45
153
|
*
|
|
46
154
|
* <template>
|
|
47
|
-
* <div>
|
|
155
|
+
* <div>
|
|
156
|
+
* <input type="file" @change="handleFileChange" />
|
|
157
|
+
* <div v-if="flow.isUploading.value">Progress: {{ flow.state.value.progress }}%</div>
|
|
158
|
+
* </div>
|
|
48
159
|
* </template>
|
|
49
160
|
* ```
|
|
50
|
-
*/
|
|
51
|
-
declare function useUploadistaEvents(callback: (event: UploadistaEvent) => void): void;
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/composables/useFlowEvents.d.ts
|
|
54
|
-
/**
|
|
55
|
-
* Options for handling flow execution events.
|
|
56
|
-
*
|
|
57
|
-
* All callbacks are optional - only provide handlers for events you care about.
|
|
58
|
-
*/
|
|
59
|
-
interface UseFlowEventsOptions {
|
|
60
|
-
/** Called when a job starts execution */
|
|
61
|
-
onJobStart?: (event: FlowEventJobStart) => void;
|
|
62
|
-
/** Called when a job completes (success or failure) */
|
|
63
|
-
onJobEnd?: (event: FlowEventJobEnd) => void;
|
|
64
|
-
/** Called when a flow begins execution */
|
|
65
|
-
onFlowStart?: (event: FlowEventFlowStart) => void;
|
|
66
|
-
/** Called when a flow completes successfully */
|
|
67
|
-
onFlowEnd?: (event: FlowEventFlowEnd) => void;
|
|
68
|
-
/** Called when a flow encounters an error */
|
|
69
|
-
onFlowError?: (event: FlowEventFlowError) => void;
|
|
70
|
-
/** Called when a flow is paused by user request */
|
|
71
|
-
onFlowPause?: (event: FlowEventFlowPause) => void;
|
|
72
|
-
/** Called when a flow is cancelled by user request */
|
|
73
|
-
onFlowCancel?: (event: FlowEventFlowCancel) => void;
|
|
74
|
-
/** Called when a node starts processing */
|
|
75
|
-
onNodeStart?: (event: FlowEventNodeStart) => void;
|
|
76
|
-
/** Called when a node completes successfully */
|
|
77
|
-
onNodeEnd?: (event: FlowEventNodeEnd) => void;
|
|
78
|
-
/** Called when a node pauses (waiting for additional data) */
|
|
79
|
-
onNodePause?: (event: FlowEventNodePause) => void;
|
|
80
|
-
/** Called when a paused node resumes execution */
|
|
81
|
-
onNodeResume?: (event: FlowEventNodeResume) => void;
|
|
82
|
-
/** Called when a node encounters an error */
|
|
83
|
-
onNodeError?: (event: FlowEventNodeError) => void;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Structured composable for handling flow execution events with type-safe callbacks.
|
|
87
|
-
*
|
|
88
|
-
* This composable provides a clean API for listening to specific flow events without
|
|
89
|
-
* needing to manually filter events or use type guards.
|
|
90
|
-
*
|
|
91
|
-
* Must be used within UploadistaProvider.
|
|
92
|
-
*
|
|
93
|
-
* @param options - Object with optional callbacks for each flow event type
|
|
94
161
|
*
|
|
95
162
|
* @example
|
|
96
163
|
* ```vue
|
|
97
164
|
* <script setup lang="ts">
|
|
98
|
-
* import {
|
|
165
|
+
* import { useFlow } from '@uploadista/vue';
|
|
99
166
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* console.log('Node started:', event.nodeName);
|
|
106
|
-
* },
|
|
107
|
-
* onNodeEnd: (event) => {
|
|
108
|
-
* console.log('Node completed:', event.nodeName, event.result);
|
|
109
|
-
* },
|
|
110
|
-
* onFlowEnd: (event) => {
|
|
111
|
-
* console.log('Flow completed with outputs:', event.outputs);
|
|
112
|
-
* },
|
|
113
|
-
* onFlowError: (event) => {
|
|
114
|
-
* console.error('Flow failed:', event.error);
|
|
167
|
+
* // Multi-input with progressive provision
|
|
168
|
+
* const flow = useFlow({
|
|
169
|
+
* flowConfig: {
|
|
170
|
+
* flowId: "multi-source-processing",
|
|
171
|
+
* storageId: "default",
|
|
115
172
|
* },
|
|
116
173
|
* });
|
|
174
|
+
*
|
|
175
|
+
* const handleInputChange = (nodeId: string, event: Event) => {
|
|
176
|
+
* const target = event.target as HTMLInputElement;
|
|
177
|
+
* if (target.type === 'file') {
|
|
178
|
+
* const file = target.files?.[0];
|
|
179
|
+
* if (file) flow.setInput(nodeId, file);
|
|
180
|
+
* } else {
|
|
181
|
+
* flow.setInput(nodeId, target.value);
|
|
182
|
+
* }
|
|
183
|
+
* };
|
|
117
184
|
* </script>
|
|
118
185
|
*
|
|
119
186
|
* <template>
|
|
120
|
-
* <div
|
|
187
|
+
* <div v-if="flow.inputMetadata.value">
|
|
188
|
+
* <div v-for="input in flow.inputMetadata.value" :key="input.nodeId">
|
|
189
|
+
* <label>{{ input.nodeName }}</label>
|
|
190
|
+
* <input
|
|
191
|
+
* v-if="input.inputTypeId === 'streaming-input-v1'"
|
|
192
|
+
* type="file"
|
|
193
|
+
* @change="(e) => handleInputChange(input.nodeId, e)"
|
|
194
|
+
* />
|
|
195
|
+
* <input
|
|
196
|
+
* v-else
|
|
197
|
+
* type="url"
|
|
198
|
+
* @change="(e) => handleInputChange(input.nodeId, e)"
|
|
199
|
+
* />
|
|
200
|
+
* </div>
|
|
201
|
+
* <button @click="flow.execute" :disabled="flow.isUploading.value">
|
|
202
|
+
* Execute Flow
|
|
203
|
+
* </button>
|
|
204
|
+
* </div>
|
|
121
205
|
* </template>
|
|
122
206
|
* ```
|
|
207
|
+
*
|
|
208
|
+
* @see {@link useFlowUpload} for a simpler file-only upload composable
|
|
123
209
|
*/
|
|
124
|
-
declare function
|
|
125
|
-
//#endregion
|
|
126
|
-
//#region src/composables/useUploadEvents.d.ts
|
|
127
|
-
/**
|
|
128
|
-
* Upload progress event data
|
|
129
|
-
*/
|
|
130
|
-
interface UploadProgressEventData {
|
|
131
|
-
id: string;
|
|
132
|
-
progress: number;
|
|
133
|
-
total: number;
|
|
134
|
-
flow?: {
|
|
135
|
-
flowId: string;
|
|
136
|
-
nodeId: string;
|
|
137
|
-
jobId: string;
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Upload started/complete event data (contains full UploadFile)
|
|
142
|
-
*/
|
|
143
|
-
interface UploadFileEventData {
|
|
144
|
-
[key: string]: unknown;
|
|
145
|
-
flow?: {
|
|
146
|
-
flowId: string;
|
|
147
|
-
nodeId: string;
|
|
148
|
-
jobId: string;
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Upload failed event data
|
|
153
|
-
*/
|
|
154
|
-
interface UploadFailedEventData {
|
|
155
|
-
id: string;
|
|
156
|
-
error: string;
|
|
157
|
-
flow?: {
|
|
158
|
-
flowId: string;
|
|
159
|
-
nodeId: string;
|
|
160
|
-
jobId: string;
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Upload validation success event data
|
|
165
|
-
*/
|
|
166
|
-
interface UploadValidationSuccessEventData {
|
|
167
|
-
id: string;
|
|
168
|
-
validationType: "checksum" | "mimetype";
|
|
169
|
-
algorithm?: string;
|
|
170
|
-
flow?: {
|
|
171
|
-
flowId: string;
|
|
172
|
-
nodeId: string;
|
|
173
|
-
jobId: string;
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Upload validation failed event data
|
|
178
|
-
*/
|
|
179
|
-
interface UploadValidationFailedEventData {
|
|
180
|
-
id: string;
|
|
181
|
-
reason: string;
|
|
182
|
-
expected: string;
|
|
183
|
-
actual: string;
|
|
184
|
-
flow?: {
|
|
185
|
-
flowId: string;
|
|
186
|
-
nodeId: string;
|
|
187
|
-
jobId: string;
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Upload validation warning event data
|
|
192
|
-
*/
|
|
193
|
-
interface UploadValidationWarningEventData {
|
|
194
|
-
id: string;
|
|
195
|
-
message: string;
|
|
196
|
-
flow?: {
|
|
197
|
-
flowId: string;
|
|
198
|
-
nodeId: string;
|
|
199
|
-
jobId: string;
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Options for handling upload events.
|
|
204
|
-
*
|
|
205
|
-
* All callbacks are optional - only provide handlers for events you care about.
|
|
206
|
-
*/
|
|
207
|
-
interface UseUploadEventsOptions {
|
|
208
|
-
/** Called when an upload starts */
|
|
209
|
-
onUploadStarted?: (data: UploadFileEventData) => void;
|
|
210
|
-
/** Called with upload progress updates */
|
|
211
|
-
onUploadProgress?: (data: UploadProgressEventData) => void;
|
|
212
|
-
/** Called when an upload completes successfully */
|
|
213
|
-
onUploadComplete?: (data: UploadFileEventData) => void;
|
|
214
|
-
/** Called when an upload fails */
|
|
215
|
-
onUploadFailed?: (data: UploadFailedEventData) => void;
|
|
216
|
-
/** Called when upload validation succeeds */
|
|
217
|
-
onUploadValidationSuccess?: (data: UploadValidationSuccessEventData) => void;
|
|
218
|
-
/** Called when upload validation fails */
|
|
219
|
-
onUploadValidationFailed?: (data: UploadValidationFailedEventData) => void;
|
|
220
|
-
/** Called when upload validation produces a warning */
|
|
221
|
-
onUploadValidationWarning?: (data: UploadValidationWarningEventData) => void;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Structured composable for handling upload events with type-safe callbacks.
|
|
225
|
-
*
|
|
226
|
-
* This composable provides a clean API for listening to specific upload events without
|
|
227
|
-
* needing to manually filter events or use type guards.
|
|
228
|
-
*
|
|
229
|
-
* Must be used within UploadistaProvider.
|
|
230
|
-
*
|
|
231
|
-
* @param options - Object with optional callbacks for each upload event type
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```vue
|
|
235
|
-
* <script setup lang="ts">
|
|
236
|
-
* import { useUploadEvents } from '@uploadista/vue';
|
|
237
|
-
*
|
|
238
|
-
* useUploadEvents({
|
|
239
|
-
* onUploadStarted: (data) => {
|
|
240
|
-
* console.log('Upload started:', data.id);
|
|
241
|
-
* },
|
|
242
|
-
* onUploadProgress: (data) => {
|
|
243
|
-
* const percent = (data.progress / data.total) * 100;
|
|
244
|
-
* console.log(`Upload progress: ${percent}%`);
|
|
245
|
-
* },
|
|
246
|
-
* onUploadComplete: (data) => {
|
|
247
|
-
* console.log('Upload completed:', data);
|
|
248
|
-
* },
|
|
249
|
-
* onUploadFailed: (data) => {
|
|
250
|
-
* console.error('Upload failed:', data.error);
|
|
251
|
-
* },
|
|
252
|
-
* });
|
|
253
|
-
* </script>
|
|
254
|
-
*
|
|
255
|
-
* <template>
|
|
256
|
-
* <div>Monitoring uploads...</div>
|
|
257
|
-
* </template>
|
|
258
|
-
* ```
|
|
259
|
-
*/
|
|
260
|
-
declare function useUploadEvents(options: UseUploadEventsOptions): void;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/composables/plugin.d.ts
|
|
263
|
-
interface UploadistaPluginOptions extends UploadistaClientOptions {
|
|
264
|
-
/**
|
|
265
|
-
* Global event handler for all upload and flow events from this client
|
|
266
|
-
*/
|
|
267
|
-
onEvent?: UploadistaClientOptions["onEvent"];
|
|
268
|
-
}
|
|
269
|
-
declare const UPLOADISTA_CLIENT_KEY: InjectionKey<ReturnType<typeof createUploadistaClient>>;
|
|
270
|
-
declare const UPLOADISTA_EVENT_SUBSCRIBERS_KEY: InjectionKey<Ref<Set<(event: UploadistaEvent) => void>>>;
|
|
271
|
-
/**
|
|
272
|
-
* Vue plugin for providing Uploadista client instance globally.
|
|
273
|
-
* Uses Vue's provide/inject pattern to make the client available
|
|
274
|
-
* throughout the component tree.
|
|
275
|
-
*
|
|
276
|
-
* @param options - Uploadista client configuration options
|
|
277
|
-
* @returns Vue plugin object
|
|
278
|
-
*
|
|
279
|
-
* @example
|
|
280
|
-
* ```typescript
|
|
281
|
-
* import { createApp } from 'vue';
|
|
282
|
-
* import { createUploadistaPlugin } from '@uploadista/vue';
|
|
283
|
-
* import App from './App.vue';
|
|
284
|
-
*
|
|
285
|
-
* const app = createApp(App);
|
|
286
|
-
*
|
|
287
|
-
* app.use(createUploadistaPlugin({
|
|
288
|
-
* baseUrl: 'https://api.example.com',
|
|
289
|
-
* storageId: 'my-storage',
|
|
290
|
-
* chunkSize: 1024 * 1024, // 1MB
|
|
291
|
-
* storeFingerprintForResuming: true,
|
|
292
|
-
* onEvent: (event) => {
|
|
293
|
-
* console.log('Upload event:', event);
|
|
294
|
-
* }
|
|
295
|
-
* }));
|
|
296
|
-
*
|
|
297
|
-
* app.mount('#app');
|
|
298
|
-
* ```
|
|
299
|
-
*/
|
|
300
|
-
declare function createUploadistaPlugin(options: UploadistaPluginOptions): {
|
|
301
|
-
install(app: App): void;
|
|
302
|
-
};
|
|
210
|
+
declare function useFlow(options: FlowUploadOptions): UseFlowReturn;
|
|
303
211
|
//#endregion
|
|
304
212
|
//#region src/composables/useDragDrop.d.ts
|
|
305
213
|
interface DragDropOptions {
|
|
@@ -450,206 +358,297 @@ declare function useDragDrop(options?: DragDropOptions): {
|
|
|
450
358
|
reset: () => void;
|
|
451
359
|
};
|
|
452
360
|
//#endregion
|
|
453
|
-
//#region src/composables/
|
|
361
|
+
//#region src/composables/eventUtils.d.ts
|
|
454
362
|
/**
|
|
455
|
-
*
|
|
363
|
+
* Type guard to check if an event is a flow event
|
|
456
364
|
*/
|
|
457
|
-
|
|
458
|
-
/** Input node ID */
|
|
459
|
-
nodeId: string;
|
|
460
|
-
/** Human-readable node name */
|
|
461
|
-
nodeName: string;
|
|
462
|
-
/** Node description explaining what input is needed */
|
|
463
|
-
nodeDescription: string;
|
|
464
|
-
/** Input type ID from inputTypeRegistry - describes how clients interact with this node */
|
|
465
|
-
inputTypeId?: string;
|
|
466
|
-
/** Whether this input is required */
|
|
467
|
-
required: boolean;
|
|
468
|
-
}
|
|
365
|
+
declare function isFlowEvent(event: unknown): event is FlowEvent;
|
|
469
366
|
/**
|
|
470
|
-
*
|
|
367
|
+
* Type guard to check if an event is an upload event
|
|
368
|
+
*/
|
|
369
|
+
declare function isUploadEvent(event: unknown): event is UploadEvent;
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/composables/useFlowEvents.d.ts
|
|
372
|
+
/**
|
|
373
|
+
* Options for handling flow execution events.
|
|
471
374
|
*
|
|
472
|
-
*
|
|
473
|
-
* @property inputMetadata - Metadata about discovered input nodes (null until discovered)
|
|
474
|
-
* @property inputStates - Per-input execution state for multi-input flows
|
|
475
|
-
* @property inputs - Current input values set via setInput()
|
|
476
|
-
* @property setInput - Set an input value for a specific node (for progressive provision)
|
|
477
|
-
* @property execute - Execute the flow with current inputs (auto-detects types)
|
|
478
|
-
* @property upload - Convenience method for single-file upload (same as execute with one file input)
|
|
479
|
-
* @property abort - Cancel the current upload and flow execution
|
|
480
|
-
* @property pause - Pause the current upload
|
|
481
|
-
* @property reset - Reset state to idle (clears all data)
|
|
482
|
-
* @property isUploading - True when upload or processing is active
|
|
483
|
-
* @property isUploadingFile - True only during file upload phase
|
|
484
|
-
* @property isProcessing - True only during flow processing phase
|
|
485
|
-
* @property isDiscoveringInputs - True while discovering flow inputs
|
|
375
|
+
* All callbacks are optional - only provide handlers for events you care about.
|
|
486
376
|
*/
|
|
487
|
-
interface
|
|
488
|
-
/**
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Execute the flow with current inputs.
|
|
514
|
-
* Automatically detects input types and routes appropriately.
|
|
515
|
-
* For single input, uses standard upload path.
|
|
516
|
-
* For multiple inputs, requires multiInputUploadFn.
|
|
517
|
-
*/
|
|
518
|
-
execute: () => Promise<void>;
|
|
519
|
-
/**
|
|
520
|
-
* Upload a single file through the flow (convenience method).
|
|
521
|
-
* Equivalent to setInput(firstNodeId, file) + execute().
|
|
522
|
-
*
|
|
523
|
-
* @param file - File or Blob to upload
|
|
524
|
-
*/
|
|
525
|
-
upload: (file: File | Blob) => Promise<void>;
|
|
526
|
-
/**
|
|
527
|
-
* Abort the current upload
|
|
528
|
-
*/
|
|
529
|
-
abort: () => void;
|
|
530
|
-
/**
|
|
531
|
-
* Pause the current upload
|
|
532
|
-
*/
|
|
533
|
-
pause: () => void;
|
|
534
|
-
/**
|
|
535
|
-
* Reset the upload state and clear all inputs
|
|
536
|
-
*/
|
|
537
|
-
reset: () => void;
|
|
538
|
-
/**
|
|
539
|
-
* Whether an upload or flow execution is in progress (uploading OR processing)
|
|
540
|
-
*/
|
|
541
|
-
isUploading: Readonly<Ref<boolean>>;
|
|
542
|
-
/**
|
|
543
|
-
* Whether the file is currently being uploaded (chunks being sent)
|
|
544
|
-
*/
|
|
545
|
-
isUploadingFile: Readonly<Ref<boolean>>;
|
|
546
|
-
/**
|
|
547
|
-
* Whether the flow is currently processing (after upload completes)
|
|
548
|
-
*/
|
|
549
|
-
isProcessing: Readonly<Ref<boolean>>;
|
|
550
|
-
/**
|
|
551
|
-
* Whether the hook is discovering flow inputs
|
|
552
|
-
*/
|
|
553
|
-
isDiscoveringInputs: Readonly<Ref<boolean>>;
|
|
377
|
+
interface UseFlowEventsOptions {
|
|
378
|
+
/** Called when a job starts execution */
|
|
379
|
+
onJobStart?: (event: FlowEventJobStart) => void;
|
|
380
|
+
/** Called when a job completes (success or failure) */
|
|
381
|
+
onJobEnd?: (event: FlowEventJobEnd) => void;
|
|
382
|
+
/** Called when a flow begins execution */
|
|
383
|
+
onFlowStart?: (event: FlowEventFlowStart) => void;
|
|
384
|
+
/** Called when a flow completes successfully */
|
|
385
|
+
onFlowEnd?: (event: FlowEventFlowEnd) => void;
|
|
386
|
+
/** Called when a flow encounters an error */
|
|
387
|
+
onFlowError?: (event: FlowEventFlowError) => void;
|
|
388
|
+
/** Called when a flow is paused by user request */
|
|
389
|
+
onFlowPause?: (event: FlowEventFlowPause) => void;
|
|
390
|
+
/** Called when a flow is cancelled by user request */
|
|
391
|
+
onFlowCancel?: (event: FlowEventFlowCancel) => void;
|
|
392
|
+
/** Called when a node starts processing */
|
|
393
|
+
onNodeStart?: (event: FlowEventNodeStart) => void;
|
|
394
|
+
/** Called when a node completes successfully */
|
|
395
|
+
onNodeEnd?: (event: FlowEventNodeEnd) => void;
|
|
396
|
+
/** Called when a node pauses (waiting for additional data) */
|
|
397
|
+
onNodePause?: (event: FlowEventNodePause) => void;
|
|
398
|
+
/** Called when a paused node resumes execution */
|
|
399
|
+
onNodeResume?: (event: FlowEventNodeResume) => void;
|
|
400
|
+
/** Called when a node encounters an error */
|
|
401
|
+
onNodeError?: (event: FlowEventNodeError) => void;
|
|
554
402
|
}
|
|
555
403
|
/**
|
|
556
|
-
*
|
|
557
|
-
* Automatically discovers input nodes and detects input types (File, URL, structured data).
|
|
558
|
-
* Supports progressive input provision via setInput() and execute().
|
|
404
|
+
* Structured composable for handling flow execution events with type-safe callbacks.
|
|
559
405
|
*
|
|
560
|
-
* This
|
|
561
|
-
*
|
|
562
|
-
* - Auto-discovery of flow input nodes
|
|
563
|
-
* - Automatic input type detection (file -> upload, string -> URL, object -> data)
|
|
564
|
-
* - Progressive input provision via setInput()
|
|
565
|
-
* - Multi-input support with parallel coordination
|
|
566
|
-
* - Per-input state tracking
|
|
406
|
+
* This composable provides a clean API for listening to specific flow events without
|
|
407
|
+
* needing to manually filter events or use type guards.
|
|
567
408
|
*
|
|
568
|
-
* Must be used within
|
|
569
|
-
* Flow events are automatically routed by the provider to the appropriate manager.
|
|
409
|
+
* Must be used within UploadistaProvider.
|
|
570
410
|
*
|
|
571
|
-
* @param options -
|
|
572
|
-
* @returns Flow upload state and control methods
|
|
411
|
+
* @param options - Object with optional callbacks for each flow event type
|
|
573
412
|
*
|
|
574
413
|
* @example
|
|
575
414
|
* ```vue
|
|
576
415
|
* <script setup lang="ts">
|
|
577
|
-
* import {
|
|
416
|
+
* import { useFlowEvents } from '@uploadista/vue';
|
|
578
417
|
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
* flowId: "image-optimization",
|
|
583
|
-
* storageId: "s3-images",
|
|
418
|
+
* useFlowEvents({
|
|
419
|
+
* onFlowStart: (event) => {
|
|
420
|
+
* console.log('Flow started:', event.flowId);
|
|
584
421
|
* },
|
|
585
|
-
*
|
|
586
|
-
* console.log(
|
|
422
|
+
* onNodeStart: (event) => {
|
|
423
|
+
* console.log('Node started:', event.nodeName);
|
|
424
|
+
* },
|
|
425
|
+
* onNodeEnd: (event) => {
|
|
426
|
+
* console.log('Node completed:', event.nodeName, event.result);
|
|
427
|
+
* },
|
|
428
|
+
* onFlowEnd: (event) => {
|
|
429
|
+
* console.log('Flow completed with outputs:', event.outputs);
|
|
430
|
+
* },
|
|
431
|
+
* onFlowError: (event) => {
|
|
432
|
+
* console.error('Flow failed:', event.error);
|
|
587
433
|
* },
|
|
588
434
|
* });
|
|
589
|
-
*
|
|
590
|
-
* const handleFileChange = (event: Event) => {
|
|
591
|
-
* const file = (event.target as HTMLInputElement).files?.[0];
|
|
592
|
-
* if (file) flow.upload(file);
|
|
593
|
-
* };
|
|
594
435
|
* </script>
|
|
595
436
|
*
|
|
596
437
|
* <template>
|
|
597
|
-
* <div>
|
|
598
|
-
* <input type="file" @change="handleFileChange" />
|
|
599
|
-
* <div v-if="flow.isUploading.value">Progress: {{ flow.state.value.progress }}%</div>
|
|
600
|
-
* </div>
|
|
438
|
+
* <div>Monitoring flow execution...</div>
|
|
601
439
|
* </template>
|
|
602
440
|
* ```
|
|
441
|
+
*/
|
|
442
|
+
declare function useFlowEvents(options: UseFlowEventsOptions): void;
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/composables/useUploadEvents.d.ts
|
|
445
|
+
/**
|
|
446
|
+
* Upload progress event data
|
|
447
|
+
*/
|
|
448
|
+
interface UploadProgressEventData {
|
|
449
|
+
id: string;
|
|
450
|
+
progress: number;
|
|
451
|
+
total: number;
|
|
452
|
+
flow?: {
|
|
453
|
+
flowId: string;
|
|
454
|
+
nodeId: string;
|
|
455
|
+
jobId: string;
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Upload started/complete event data (contains full UploadFile)
|
|
460
|
+
*/
|
|
461
|
+
interface UploadFileEventData {
|
|
462
|
+
[key: string]: unknown;
|
|
463
|
+
flow?: {
|
|
464
|
+
flowId: string;
|
|
465
|
+
nodeId: string;
|
|
466
|
+
jobId: string;
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Upload failed event data
|
|
471
|
+
*/
|
|
472
|
+
interface UploadFailedEventData {
|
|
473
|
+
id: string;
|
|
474
|
+
error: string;
|
|
475
|
+
flow?: {
|
|
476
|
+
flowId: string;
|
|
477
|
+
nodeId: string;
|
|
478
|
+
jobId: string;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Upload validation success event data
|
|
483
|
+
*/
|
|
484
|
+
interface UploadValidationSuccessEventData {
|
|
485
|
+
id: string;
|
|
486
|
+
validationType: "checksum" | "mimetype";
|
|
487
|
+
algorithm?: string;
|
|
488
|
+
flow?: {
|
|
489
|
+
flowId: string;
|
|
490
|
+
nodeId: string;
|
|
491
|
+
jobId: string;
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Upload validation failed event data
|
|
496
|
+
*/
|
|
497
|
+
interface UploadValidationFailedEventData {
|
|
498
|
+
id: string;
|
|
499
|
+
reason: string;
|
|
500
|
+
expected: string;
|
|
501
|
+
actual: string;
|
|
502
|
+
flow?: {
|
|
503
|
+
flowId: string;
|
|
504
|
+
nodeId: string;
|
|
505
|
+
jobId: string;
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Upload validation warning event data
|
|
510
|
+
*/
|
|
511
|
+
interface UploadValidationWarningEventData {
|
|
512
|
+
id: string;
|
|
513
|
+
message: string;
|
|
514
|
+
flow?: {
|
|
515
|
+
flowId: string;
|
|
516
|
+
nodeId: string;
|
|
517
|
+
jobId: string;
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Options for handling upload events.
|
|
522
|
+
*
|
|
523
|
+
* All callbacks are optional - only provide handlers for events you care about.
|
|
524
|
+
*/
|
|
525
|
+
interface UseUploadEventsOptions {
|
|
526
|
+
/** Called when an upload starts */
|
|
527
|
+
onUploadStarted?: (data: UploadFileEventData) => void;
|
|
528
|
+
/** Called with upload progress updates */
|
|
529
|
+
onUploadProgress?: (data: UploadProgressEventData) => void;
|
|
530
|
+
/** Called when an upload completes successfully */
|
|
531
|
+
onUploadComplete?: (data: UploadFileEventData) => void;
|
|
532
|
+
/** Called when an upload fails */
|
|
533
|
+
onUploadFailed?: (data: UploadFailedEventData) => void;
|
|
534
|
+
/** Called when upload validation succeeds */
|
|
535
|
+
onUploadValidationSuccess?: (data: UploadValidationSuccessEventData) => void;
|
|
536
|
+
/** Called when upload validation fails */
|
|
537
|
+
onUploadValidationFailed?: (data: UploadValidationFailedEventData) => void;
|
|
538
|
+
/** Called when upload validation produces a warning */
|
|
539
|
+
onUploadValidationWarning?: (data: UploadValidationWarningEventData) => void;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Structured composable for handling upload events with type-safe callbacks.
|
|
543
|
+
*
|
|
544
|
+
* This composable provides a clean API for listening to specific upload events without
|
|
545
|
+
* needing to manually filter events or use type guards.
|
|
546
|
+
*
|
|
547
|
+
* Must be used within UploadistaProvider.
|
|
548
|
+
*
|
|
549
|
+
* @param options - Object with optional callbacks for each upload event type
|
|
603
550
|
*
|
|
604
551
|
* @example
|
|
605
552
|
* ```vue
|
|
606
553
|
* <script setup lang="ts">
|
|
607
|
-
* import {
|
|
554
|
+
* import { useUploadEvents } from '@uploadista/vue';
|
|
608
555
|
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
556
|
+
* useUploadEvents({
|
|
557
|
+
* onUploadStarted: (data) => {
|
|
558
|
+
* console.log('Upload started:', data.id);
|
|
559
|
+
* },
|
|
560
|
+
* onUploadProgress: (data) => {
|
|
561
|
+
* const percent = (data.progress / data.total) * 100;
|
|
562
|
+
* console.log(`Upload progress: ${percent}%`);
|
|
563
|
+
* },
|
|
564
|
+
* onUploadComplete: (data) => {
|
|
565
|
+
* console.log('Upload completed:', data);
|
|
566
|
+
* },
|
|
567
|
+
* onUploadFailed: (data) => {
|
|
568
|
+
* console.error('Upload failed:', data.error);
|
|
614
569
|
* },
|
|
615
570
|
* });
|
|
571
|
+
* </script>
|
|
616
572
|
*
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
573
|
+
* <template>
|
|
574
|
+
* <div>Monitoring uploads...</div>
|
|
575
|
+
* </template>
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
578
|
+
declare function useUploadEvents(options: UseUploadEventsOptions): void;
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/composables/useUploadistaEvents.d.ts
|
|
581
|
+
/**
|
|
582
|
+
* Simple composable that subscribes to all Uploadista events (both flow and upload events).
|
|
583
|
+
*
|
|
584
|
+
* This is a low-level composable that provides access to all events. For more structured
|
|
585
|
+
* event handling, consider using `useFlowEvents` or `useUploadEvents` instead.
|
|
586
|
+
*
|
|
587
|
+
* Must be used within UploadistaProvider.
|
|
588
|
+
*
|
|
589
|
+
* @param callback - Function called for every event emitted by the Uploadista client
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* ```vue
|
|
593
|
+
* <script setup lang="ts">
|
|
594
|
+
* import { useUploadistaEvents, isFlowEvent, isUploadEvent } from '@uploadista/vue';
|
|
595
|
+
*
|
|
596
|
+
* useUploadistaEvents((event) => {
|
|
597
|
+
* if (isFlowEvent(event)) {
|
|
598
|
+
* console.log('Flow event:', event.eventType);
|
|
599
|
+
* } else if (isUploadEvent(event)) {
|
|
600
|
+
* console.log('Upload event:', event.type);
|
|
624
601
|
* }
|
|
625
|
-
* };
|
|
602
|
+
* });
|
|
626
603
|
* </script>
|
|
627
604
|
*
|
|
628
605
|
* <template>
|
|
629
|
-
* <div
|
|
630
|
-
* <div v-for="input in flow.inputMetadata.value" :key="input.nodeId">
|
|
631
|
-
* <label>{{ input.nodeName }}</label>
|
|
632
|
-
* <input
|
|
633
|
-
* v-if="input.inputTypeId === 'streaming-input-v1'"
|
|
634
|
-
* type="file"
|
|
635
|
-
* @change="(e) => handleInputChange(input.nodeId, e)"
|
|
636
|
-
* />
|
|
637
|
-
* <input
|
|
638
|
-
* v-else
|
|
639
|
-
* type="url"
|
|
640
|
-
* @change="(e) => handleInputChange(input.nodeId, e)"
|
|
641
|
-
* />
|
|
642
|
-
* </div>
|
|
643
|
-
* <button @click="flow.execute" :disabled="flow.isUploading.value">
|
|
644
|
-
* Execute Flow
|
|
645
|
-
* </button>
|
|
646
|
-
* </div>
|
|
606
|
+
* <div>Listening to all events...</div>
|
|
647
607
|
* </template>
|
|
648
608
|
* ```
|
|
609
|
+
*/
|
|
610
|
+
declare function useUploadistaEvents(callback: (event: UploadistaEvent) => void): void;
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region src/composables/plugin.d.ts
|
|
613
|
+
interface UploadistaPluginOptions extends UploadistaClientOptions {
|
|
614
|
+
/**
|
|
615
|
+
* Global event handler for all upload and flow events from this client
|
|
616
|
+
*/
|
|
617
|
+
onEvent?: UploadistaClientOptions["onEvent"];
|
|
618
|
+
}
|
|
619
|
+
declare const UPLOADISTA_CLIENT_KEY: InjectionKey<ReturnType<typeof createUploadistaClient>>;
|
|
620
|
+
/**
|
|
621
|
+
* Vue plugin for providing Uploadista client instance globally.
|
|
622
|
+
* Uses Vue's provide/inject pattern to make the client available
|
|
623
|
+
* throughout the component tree.
|
|
649
624
|
*
|
|
650
|
-
* @
|
|
625
|
+
* @param options - Uploadista client configuration options
|
|
626
|
+
* @returns Vue plugin object
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```typescript
|
|
630
|
+
* import { createApp } from 'vue';
|
|
631
|
+
* import { createUploadistaPlugin } from '@uploadista/vue';
|
|
632
|
+
* import App from './App.vue';
|
|
633
|
+
*
|
|
634
|
+
* const app = createApp(App);
|
|
635
|
+
*
|
|
636
|
+
* app.use(createUploadistaPlugin({
|
|
637
|
+
* baseUrl: 'https://api.example.com',
|
|
638
|
+
* storageId: 'my-storage',
|
|
639
|
+
* chunkSize: 1024 * 1024, // 1MB
|
|
640
|
+
* storeFingerprintForResuming: true,
|
|
641
|
+
* onEvent: (event) => {
|
|
642
|
+
* console.log('Upload event:', event);
|
|
643
|
+
* }
|
|
644
|
+
* }));
|
|
645
|
+
*
|
|
646
|
+
* app.mount('#app');
|
|
647
|
+
* ```
|
|
651
648
|
*/
|
|
652
|
-
declare function
|
|
649
|
+
declare function createUploadistaPlugin(options: UploadistaPluginOptions): {
|
|
650
|
+
install(app: App): void;
|
|
651
|
+
};
|
|
653
652
|
//#endregion
|
|
654
653
|
//#region src/composables/useMultiFlowUpload.d.ts
|
|
655
654
|
/**
|
|
@@ -752,7 +751,7 @@ declare function useMultiFlowUpload(options: MultiFlowUploadOptions<BrowserUploa
|
|
|
752
751
|
} | undefined;
|
|
753
752
|
readonly size?: number | undefined | undefined;
|
|
754
753
|
readonly metadata?: {
|
|
755
|
-
readonly [x: string]:
|
|
754
|
+
readonly [x: string]: any;
|
|
756
755
|
} | undefined;
|
|
757
756
|
readonly creationDate?: string | undefined | undefined;
|
|
758
757
|
readonly url?: string | undefined | undefined;
|
|
@@ -821,7 +820,7 @@ declare function useMultiFlowUpload(options: MultiFlowUploadOptions<BrowserUploa
|
|
|
821
820
|
} | undefined;
|
|
822
821
|
readonly size?: number | undefined | undefined;
|
|
823
822
|
readonly metadata?: {
|
|
824
|
-
readonly [x: string]:
|
|
823
|
+
readonly [x: string]: any;
|
|
825
824
|
} | undefined;
|
|
826
825
|
readonly creationDate?: string | undefined | undefined;
|
|
827
826
|
readonly url?: string | undefined | undefined;
|
|
@@ -918,7 +917,7 @@ declare function useUpload(options?: UploadOptions$1): {
|
|
|
918
917
|
jobId: string;
|
|
919
918
|
} | undefined;
|
|
920
919
|
size?: number | undefined | undefined;
|
|
921
|
-
metadata?: Record<string,
|
|
920
|
+
metadata?: Record<string, _uploadista_core0.JsonValue> | undefined;
|
|
922
921
|
creationDate?: string | undefined | undefined;
|
|
923
922
|
url?: string | undefined | undefined;
|
|
924
923
|
sizeIsDeferred?: boolean | undefined | undefined;
|
|
@@ -957,7 +956,7 @@ declare function useUpload(options?: UploadOptions$1): {
|
|
|
957
956
|
jobId: string;
|
|
958
957
|
} | undefined;
|
|
959
958
|
size?: number | undefined | undefined;
|
|
960
|
-
metadata?: Record<string,
|
|
959
|
+
metadata?: Record<string, _uploadista_core0.JsonValue> | undefined;
|
|
961
960
|
creationDate?: string | undefined | undefined;
|
|
962
961
|
url?: string | undefined | undefined;
|
|
963
962
|
sizeIsDeferred?: boolean | undefined | undefined;
|
|
@@ -1191,7 +1190,7 @@ declare function useMultiUpload(options?: MultiUploadOptions): {
|
|
|
1191
1190
|
} | undefined;
|
|
1192
1191
|
readonly size?: number | undefined | undefined;
|
|
1193
1192
|
readonly metadata?: {
|
|
1194
|
-
readonly [x: string]:
|
|
1193
|
+
readonly [x: string]: any;
|
|
1195
1194
|
} | undefined;
|
|
1196
1195
|
readonly creationDate?: string | undefined | undefined;
|
|
1197
1196
|
readonly url?: string | undefined | undefined;
|
|
@@ -1255,7 +1254,7 @@ declare function useMultiUpload(options?: MultiUploadOptions): {
|
|
|
1255
1254
|
} | undefined;
|
|
1256
1255
|
readonly size?: number | undefined | undefined;
|
|
1257
1256
|
readonly metadata?: {
|
|
1258
|
-
readonly [x: string]:
|
|
1257
|
+
readonly [x: string]: any;
|
|
1259
1258
|
} | undefined;
|
|
1260
1259
|
readonly creationDate?: string | undefined | undefined;
|
|
1261
1260
|
readonly url?: string | undefined | undefined;
|
|
@@ -1329,7 +1328,7 @@ declare function useMultiUpload(options?: MultiUploadOptions): {
|
|
|
1329
1328
|
jobId: string;
|
|
1330
1329
|
} | undefined;
|
|
1331
1330
|
size?: number | undefined | undefined;
|
|
1332
|
-
metadata?: Record<string,
|
|
1331
|
+
metadata?: Record<string, _uploadista_core0.JsonValue> | undefined;
|
|
1333
1332
|
creationDate?: string | undefined | undefined;
|
|
1334
1333
|
url?: string | undefined | undefined;
|
|
1335
1334
|
sizeIsDeferred?: boolean | undefined | undefined;
|
|
@@ -1898,5 +1897,5 @@ declare function useUploadMetrics(options?: UseUploadMetricsOptions): {
|
|
|
1898
1897
|
};
|
|
1899
1898
|
};
|
|
1900
1899
|
//#endregion
|
|
1901
|
-
export {
|
|
1902
|
-
//# sourceMappingURL=index-
|
|
1900
|
+
export { UseFlowEventsOptions as A, InputExecutionState as B, UploadFileEventData as C, UploadValidationWarningEventData as D, UploadValidationSuccessEventData as E, DragDropState as F, useFlow as H, useDragDrop as I, FlowInputMetadata as L, isFlowEvent as M, isUploadEvent as N, UseUploadEventsOptions as O, DragDropOptions as P, FlowUploadState as R, UploadFailedEventData as S, UploadValidationFailedEventData as T, UseFlowReturn as V, useMultiFlowUpload as _, useUploadistaClient as a, createUploadistaPlugin as b, UploadItem as c, PerformanceInsights$1 as d, UploadInput as f, useUpload as g, UploadStatus as h, UseUploadistaClientReturn as i, useFlowEvents as j, useUploadEvents as k, useMultiUpload as l, UploadState as m, UseUploadMetricsOptions as n, MultiUploadOptions as o, UploadSessionMetrics$1 as p, useUploadMetrics as r, MultiUploadState as s, FileUploadMetrics as t, ChunkMetrics$1 as u, UPLOADISTA_CLIENT_KEY as v, UploadProgressEventData as w, useUploadistaEvents as x, UploadistaPluginOptions as y, FlowUploadStatus$1 as z };
|
|
1901
|
+
//# sourceMappingURL=index-RY4FPqAk.d.mts.map
|