@uploadista/client-core 0.0.20-beta.5 → 0.0.20-beta.7
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 +909 -909
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/client/__tests__/flow-inputs.test.ts +43 -11
- package/src/client/create-uploadista-client.ts +27 -13
- package/src/index.ts +2 -2
- package/src/managers/__tests__/upload-manager.test.ts +557 -545
- package/src/testing/index.ts +14 -14
- package/src/testing/mock-service-container.ts +4 -5
- package/src/types/index.ts +2 -2
- package/src/upload/index.ts +1 -1
- package/src/utils/__tests__/flow-inputs-builder.test.ts +5 -8
- package/src/utils/__tests__/input-validation.test.ts +1 -1
- package/src/utils/flow-inputs-builder.ts +2 -1
- package/src/utils/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadista/client-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.20-beta.
|
|
4
|
+
"version": "0.0.20-beta.7",
|
|
5
5
|
"description": "Platform-agnostic core upload client logic for Uploadista",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Uploadista",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"js-base64": "3.7.8",
|
|
36
|
-
"@uploadista/core": "0.0.20-beta.
|
|
36
|
+
"@uploadista/core": "0.0.20-beta.7"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"zod": "^4.0.0"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"tsdown": "0.17.2",
|
|
43
43
|
"vitest": "4.0.15",
|
|
44
44
|
"zod": "4.1.13",
|
|
45
|
-
"@uploadista/typescript-config": "0.0.20-beta.
|
|
45
|
+
"@uploadista/typescript-config": "0.0.20-beta.7"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsdown",
|
|
@@ -9,7 +9,12 @@ describe("Flow Input Node Discovery", () => {
|
|
|
9
9
|
name: "Test Flow",
|
|
10
10
|
nodes: [
|
|
11
11
|
{ id: "input-1", name: "File Input", description: "", type: "input" },
|
|
12
|
-
{
|
|
12
|
+
{
|
|
13
|
+
id: "process-1",
|
|
14
|
+
name: "Process",
|
|
15
|
+
description: "",
|
|
16
|
+
type: "transform",
|
|
17
|
+
},
|
|
13
18
|
{ id: "output-1", name: "Output", description: "", type: "output" },
|
|
14
19
|
],
|
|
15
20
|
edges: [],
|
|
@@ -45,7 +50,12 @@ describe("Flow Input Node Discovery", () => {
|
|
|
45
50
|
nodes: [
|
|
46
51
|
{ id: "input-1", name: "File Input", description: "", type: "input" },
|
|
47
52
|
{ id: "input-2", name: "Data Input", description: "", type: "input" },
|
|
48
|
-
{
|
|
53
|
+
{
|
|
54
|
+
id: "process-1",
|
|
55
|
+
name: "Process",
|
|
56
|
+
description: "",
|
|
57
|
+
type: "transform",
|
|
58
|
+
},
|
|
49
59
|
],
|
|
50
60
|
edges: [],
|
|
51
61
|
};
|
|
@@ -74,7 +84,12 @@ describe("Flow Input Node Discovery", () => {
|
|
|
74
84
|
id: "no-input-flow",
|
|
75
85
|
name: "No Input Flow",
|
|
76
86
|
nodes: [
|
|
77
|
-
{
|
|
87
|
+
{
|
|
88
|
+
id: "process-1",
|
|
89
|
+
name: "Process",
|
|
90
|
+
description: "",
|
|
91
|
+
type: "transform",
|
|
92
|
+
},
|
|
78
93
|
{ id: "output-1", name: "Output", description: "", type: "output" },
|
|
79
94
|
],
|
|
80
95
|
edges: [],
|
|
@@ -101,9 +116,7 @@ describe("Flow Input Node Discovery", () => {
|
|
|
101
116
|
const mockFlow: FlowData = {
|
|
102
117
|
id: "test-flow",
|
|
103
118
|
name: "Test Flow",
|
|
104
|
-
nodes: [
|
|
105
|
-
{ id: "input-1", name: "", description: "", type: "input" },
|
|
106
|
-
],
|
|
119
|
+
nodes: [{ id: "input-1", name: "", description: "", type: "input" }],
|
|
107
120
|
edges: [],
|
|
108
121
|
};
|
|
109
122
|
|
|
@@ -125,10 +138,25 @@ describe("Flow Input Node Discovery", () => {
|
|
|
125
138
|
name: "Complex Flow",
|
|
126
139
|
nodes: [
|
|
127
140
|
{ id: "input-1", name: "Input", description: "", type: "input" },
|
|
128
|
-
{
|
|
129
|
-
|
|
141
|
+
{
|
|
142
|
+
id: "transform-1",
|
|
143
|
+
name: "Transform",
|
|
144
|
+
description: "",
|
|
145
|
+
type: "transform",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "conditional-1",
|
|
149
|
+
name: "Conditional",
|
|
150
|
+
description: "",
|
|
151
|
+
type: "conditional",
|
|
152
|
+
},
|
|
130
153
|
{ id: "output-1", name: "Output", description: "", type: "output" },
|
|
131
|
-
{
|
|
154
|
+
{
|
|
155
|
+
id: "utility-1",
|
|
156
|
+
name: "Utility",
|
|
157
|
+
description: "",
|
|
158
|
+
type: "utility",
|
|
159
|
+
},
|
|
132
160
|
],
|
|
133
161
|
edges: [],
|
|
134
162
|
};
|
|
@@ -158,7 +186,9 @@ describe("Flow Input Node Discovery", () => {
|
|
|
158
186
|
};
|
|
159
187
|
|
|
160
188
|
expect(flowInputs["input-node-1"].operation).toBe("url");
|
|
161
|
-
expect(flowInputs["input-node-1"].url).toBe(
|
|
189
|
+
expect(flowInputs["input-node-1"].url).toBe(
|
|
190
|
+
"https://example.com/file.jpg",
|
|
191
|
+
);
|
|
162
192
|
expect(flowInputs["input-node-1"].storageId).toBe("s3-production");
|
|
163
193
|
});
|
|
164
194
|
|
|
@@ -219,7 +249,9 @@ describe("Flow Input Node Discovery", () => {
|
|
|
219
249
|
};
|
|
220
250
|
|
|
221
251
|
expect(flowInputsWithMetadata["input-node-1"].metadata).toBeDefined();
|
|
222
|
-
expect(
|
|
252
|
+
expect(
|
|
253
|
+
flowInputsWithoutMetadata["input-node-1"].metadata,
|
|
254
|
+
).toBeUndefined();
|
|
223
255
|
});
|
|
224
256
|
});
|
|
225
257
|
});
|
|
@@ -24,8 +24,6 @@ import type {
|
|
|
24
24
|
import { SmartChunker, type SmartChunkerConfig } from "../smart-chunker";
|
|
25
25
|
import type { ClientStorage } from "../storage/client-storage";
|
|
26
26
|
import type { FlowUploadConfig } from "../types/flow-upload-config";
|
|
27
|
-
import { detectInputType } from "../utils/input-detection";
|
|
28
|
-
|
|
29
27
|
import { performFlowUpload, startFlowUpload } from "../upload/flow-upload";
|
|
30
28
|
import {
|
|
31
29
|
finalizeFlowInput,
|
|
@@ -54,6 +52,7 @@ import {
|
|
|
54
52
|
validateConfiguration,
|
|
55
53
|
} from "../upload/upload-strategy";
|
|
56
54
|
import { calculateFileSize } from "../upload/upload-utils";
|
|
55
|
+
import { detectInputType } from "../utils/input-detection";
|
|
57
56
|
import { createUploadistaApi } from "./uploadista-api";
|
|
58
57
|
import {
|
|
59
58
|
type UploadistaWebSocketEventHandler,
|
|
@@ -830,7 +829,10 @@ export function createUploadistaClient<UploadInput>({
|
|
|
830
829
|
// Open flow WebSocket for flow events
|
|
831
830
|
await wsManager.openFlowWebSocket(jobId);
|
|
832
831
|
|
|
833
|
-
const abortControllers: Map<
|
|
832
|
+
const abortControllers: Map<
|
|
833
|
+
string,
|
|
834
|
+
ReturnType<typeof abortControllerFactory.create>
|
|
835
|
+
> = new Map();
|
|
834
836
|
const uploadIds: Map<string, string> = new Map();
|
|
835
837
|
const timeoutIds: Timeout[] = [];
|
|
836
838
|
|
|
@@ -864,7 +866,12 @@ export function createUploadistaClient<UploadInput>({
|
|
|
864
866
|
},
|
|
865
867
|
});
|
|
866
868
|
|
|
867
|
-
return {
|
|
869
|
+
return {
|
|
870
|
+
nodeId,
|
|
871
|
+
uploadFile: initResult.uploadFile,
|
|
872
|
+
source,
|
|
873
|
+
inputType,
|
|
874
|
+
};
|
|
868
875
|
} else if (inputType === "url") {
|
|
869
876
|
// URL input - send to server immediately
|
|
870
877
|
await uploadistaApi.resumeFlow(
|
|
@@ -881,12 +888,9 @@ export function createUploadistaClient<UploadInput>({
|
|
|
881
888
|
return { nodeId, uploadFile: null, source: null, inputType };
|
|
882
889
|
} else {
|
|
883
890
|
// Structured data input
|
|
884
|
-
await uploadistaApi.resumeFlow(
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
data,
|
|
888
|
-
{ contentType: "application/json" },
|
|
889
|
-
);
|
|
891
|
+
await uploadistaApi.resumeFlow(jobId, nodeId, data, {
|
|
892
|
+
contentType: "application/json",
|
|
893
|
+
});
|
|
890
894
|
|
|
891
895
|
return { nodeId, uploadFile: null, source: null, inputType };
|
|
892
896
|
}
|
|
@@ -897,7 +901,10 @@ export function createUploadistaClient<UploadInput>({
|
|
|
897
901
|
// Upload all file inputs in parallel
|
|
898
902
|
const initializedSmartChunker = await initializeSmartChunker();
|
|
899
903
|
const uploadPromises = initializedInputs
|
|
900
|
-
.filter(
|
|
904
|
+
.filter(
|
|
905
|
+
(input) =>
|
|
906
|
+
input.inputType === "file" && input.uploadFile && input.source,
|
|
907
|
+
)
|
|
901
908
|
.map(async ({ nodeId, uploadFile, source }) => {
|
|
902
909
|
const abortController = abortControllerFactory.create();
|
|
903
910
|
abortControllers.set(nodeId, abortController);
|
|
@@ -934,8 +941,15 @@ export function createUploadistaClient<UploadInput>({
|
|
|
934
941
|
onProgress?.(uploadId, bytesUploaded, totalBytes);
|
|
935
942
|
|
|
936
943
|
// Calculate progress percentage
|
|
937
|
-
const progress = totalBytes
|
|
938
|
-
|
|
944
|
+
const progress = totalBytes
|
|
945
|
+
? Math.round((bytesUploaded / totalBytes) * 100)
|
|
946
|
+
: 0;
|
|
947
|
+
onInputProgress?.(
|
|
948
|
+
nodeId,
|
|
949
|
+
progress,
|
|
950
|
+
bytesUploaded,
|
|
951
|
+
totalBytes,
|
|
952
|
+
);
|
|
939
953
|
},
|
|
940
954
|
onChunkComplete,
|
|
941
955
|
onShouldRetry,
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from "./chunk-buffer";
|
|
|
4
4
|
export * from "./client";
|
|
5
5
|
export * from "./error";
|
|
6
6
|
export * from "./logger";
|
|
7
|
+
// Managers
|
|
8
|
+
export * from "./managers";
|
|
7
9
|
// Utilities
|
|
8
10
|
export * from "./network-monitor";
|
|
9
11
|
export * from "./services";
|
|
@@ -11,5 +13,3 @@ export * from "./services";
|
|
|
11
13
|
export * from "./storage";
|
|
12
14
|
// Core types
|
|
13
15
|
export * from "./types";
|
|
14
|
-
// Managers
|
|
15
|
-
export * from "./managers";
|