@transloadit/convex 0.0.1
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/README.md +235 -0
- package/dist/client/index.d.ts +244 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +196 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +24 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/component/_generated/api.d.ts +20 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +15 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +101 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +16 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +31 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +18 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/apiUtils.d.ts +31 -0
- package/dist/component/apiUtils.d.ts.map +1 -0
- package/dist/component/apiUtils.js +94 -0
- package/dist/component/apiUtils.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +3 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/lib.d.ts +226 -0
- package/dist/component/lib.d.ts.map +1 -0
- package/dist/component/lib.js +383 -0
- package/dist/component/lib.js.map +1 -0
- package/dist/component/schema.d.ts +67 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +45 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/package.json +3 -0
- package/dist/react/index.d.ts +85 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +163 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +86 -0
- package/src/client/index.ts +260 -0
- package/src/client/types.ts +64 -0
- package/src/component/_generated/api.ts +32 -0
- package/src/component/_generated/component.ts +122 -0
- package/src/component/_generated/dataModel.ts +30 -0
- package/src/component/_generated/server.ts +72 -0
- package/src/component/apiUtils.test.ts +48 -0
- package/src/component/apiUtils.ts +156 -0
- package/src/component/convex.config.ts +3 -0
- package/src/component/lib.test.ts +63 -0
- package/src/component/lib.ts +466 -0
- package/src/component/schema.ts +48 -0
- package/src/component/setup.test.ts +6 -0
- package/src/react/index.tsx +292 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const assemblyStatusValues: readonly ["ASSEMBLY_UPLOADING", "ASSEMBLY_EXECUTING", "ASSEMBLY_COMPLETED", "ASSEMBLY_CANCELED", "ASSEMBLY_FAILED"];
|
|
2
|
+
export type AssemblyStatus = (typeof assemblyStatusValues)[number];
|
|
3
|
+
declare const _default: import("convex/server").SchemaDefinition<{
|
|
4
|
+
assemblies: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
5
|
+
status?: string | undefined;
|
|
6
|
+
ok?: string | undefined;
|
|
7
|
+
message?: string | undefined;
|
|
8
|
+
templateId?: string | undefined;
|
|
9
|
+
notifyUrl?: string | undefined;
|
|
10
|
+
numExpectedUploadFiles?: number | undefined;
|
|
11
|
+
fields?: any;
|
|
12
|
+
uploads?: any;
|
|
13
|
+
results?: any;
|
|
14
|
+
error?: any;
|
|
15
|
+
raw?: any;
|
|
16
|
+
userId?: string | undefined;
|
|
17
|
+
assemblyId: string;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
}, {
|
|
21
|
+
assemblyId: import("convex/values").VString<string, "required">;
|
|
22
|
+
status: import("convex/values").VString<string | undefined, "optional">;
|
|
23
|
+
ok: import("convex/values").VString<string | undefined, "optional">;
|
|
24
|
+
message: import("convex/values").VString<string | undefined, "optional">;
|
|
25
|
+
templateId: import("convex/values").VString<string | undefined, "optional">;
|
|
26
|
+
notifyUrl: import("convex/values").VString<string | undefined, "optional">;
|
|
27
|
+
numExpectedUploadFiles: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
28
|
+
fields: import("convex/values").VAny<any, "optional", string>;
|
|
29
|
+
uploads: import("convex/values").VAny<any, "optional", string>;
|
|
30
|
+
results: import("convex/values").VAny<any, "optional", string>;
|
|
31
|
+
error: import("convex/values").VAny<any, "optional", string>;
|
|
32
|
+
raw: import("convex/values").VAny<any, "optional", string>;
|
|
33
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
34
|
+
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
35
|
+
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
36
|
+
}, "required", "assemblyId" | "status" | "ok" | "message" | "templateId" | "notifyUrl" | "numExpectedUploadFiles" | "fields" | "uploads" | "results" | "error" | "raw" | "userId" | "createdAt" | "updatedAt" | `fields.${string}` | `uploads.${string}` | `results.${string}` | `error.${string}` | `raw.${string}`>, {
|
|
37
|
+
by_assemblyId: ["assemblyId", "_creationTime"];
|
|
38
|
+
by_status: ["status", "_creationTime"];
|
|
39
|
+
by_userId: ["userId", "_creationTime"];
|
|
40
|
+
}, {}, {}>;
|
|
41
|
+
results: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
42
|
+
resultId?: string | undefined;
|
|
43
|
+
sslUrl?: string | undefined;
|
|
44
|
+
name?: string | undefined;
|
|
45
|
+
size?: number | undefined;
|
|
46
|
+
mime?: string | undefined;
|
|
47
|
+
assemblyId: string;
|
|
48
|
+
raw: any;
|
|
49
|
+
stepName: string;
|
|
50
|
+
createdAt: number;
|
|
51
|
+
}, {
|
|
52
|
+
assemblyId: import("convex/values").VString<string, "required">;
|
|
53
|
+
stepName: import("convex/values").VString<string, "required">;
|
|
54
|
+
resultId: import("convex/values").VString<string | undefined, "optional">;
|
|
55
|
+
sslUrl: import("convex/values").VString<string | undefined, "optional">;
|
|
56
|
+
name: import("convex/values").VString<string | undefined, "optional">;
|
|
57
|
+
size: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
58
|
+
mime: import("convex/values").VString<string | undefined, "optional">;
|
|
59
|
+
raw: import("convex/values").VAny<any, "required", string>;
|
|
60
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
61
|
+
}, "required", "assemblyId" | "raw" | "stepName" | "createdAt" | `raw.${string}` | "resultId" | "sslUrl" | "name" | "size" | "mime">, {
|
|
62
|
+
by_assemblyId: ["assemblyId", "_creationTime"];
|
|
63
|
+
by_assemblyId_and_step: ["assemblyId", "stepName", "_creationTime"];
|
|
64
|
+
}, {}, {}>;
|
|
65
|
+
}, true>;
|
|
66
|
+
export default _default;
|
|
67
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,qHAMvB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEnE,wBAkCG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineSchema, defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
export const assemblyStatusValues = [
|
|
4
|
+
"ASSEMBLY_UPLOADING",
|
|
5
|
+
"ASSEMBLY_EXECUTING",
|
|
6
|
+
"ASSEMBLY_COMPLETED",
|
|
7
|
+
"ASSEMBLY_CANCELED",
|
|
8
|
+
"ASSEMBLY_FAILED",
|
|
9
|
+
];
|
|
10
|
+
export default defineSchema({
|
|
11
|
+
assemblies: defineTable({
|
|
12
|
+
assemblyId: v.string(),
|
|
13
|
+
status: v.optional(v.string()),
|
|
14
|
+
ok: v.optional(v.string()),
|
|
15
|
+
message: v.optional(v.string()),
|
|
16
|
+
templateId: v.optional(v.string()),
|
|
17
|
+
notifyUrl: v.optional(v.string()),
|
|
18
|
+
numExpectedUploadFiles: v.optional(v.number()),
|
|
19
|
+
fields: v.optional(v.any()),
|
|
20
|
+
uploads: v.optional(v.any()),
|
|
21
|
+
results: v.optional(v.any()),
|
|
22
|
+
error: v.optional(v.any()),
|
|
23
|
+
raw: v.optional(v.any()),
|
|
24
|
+
createdAt: v.number(),
|
|
25
|
+
updatedAt: v.number(),
|
|
26
|
+
userId: v.optional(v.string()),
|
|
27
|
+
})
|
|
28
|
+
.index("by_assemblyId", ["assemblyId"])
|
|
29
|
+
.index("by_status", ["status"])
|
|
30
|
+
.index("by_userId", ["userId"]),
|
|
31
|
+
results: defineTable({
|
|
32
|
+
assemblyId: v.string(),
|
|
33
|
+
stepName: v.string(),
|
|
34
|
+
resultId: v.optional(v.string()),
|
|
35
|
+
sslUrl: v.optional(v.string()),
|
|
36
|
+
name: v.optional(v.string()),
|
|
37
|
+
size: v.optional(v.number()),
|
|
38
|
+
mime: v.optional(v.string()),
|
|
39
|
+
raw: v.any(),
|
|
40
|
+
createdAt: v.number(),
|
|
41
|
+
})
|
|
42
|
+
.index("by_assemblyId", ["assemblyId"])
|
|
43
|
+
.index("by_assemblyId_and_step", ["assemblyId", "stepName"]),
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAm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AAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,EAAE,WAAW,CAAC;QACnB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5B,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE;QACZ,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;SACC,KAAK,CAAC,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC;SACtC,KAAK,CAAC,wBAAwB,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;CAC/D,CAAC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { FunctionReference } from "convex/server";
|
|
2
|
+
export type GenerateUploadParamsFn = FunctionReference<"action", "public", {
|
|
3
|
+
templateId?: string;
|
|
4
|
+
steps?: unknown;
|
|
5
|
+
fields?: unknown;
|
|
6
|
+
notifyUrl?: string;
|
|
7
|
+
numExpectedUploadFiles?: number;
|
|
8
|
+
expires?: string;
|
|
9
|
+
additionalParams?: unknown;
|
|
10
|
+
userId?: string;
|
|
11
|
+
}, {
|
|
12
|
+
params: string;
|
|
13
|
+
signature: string;
|
|
14
|
+
url: string;
|
|
15
|
+
}>;
|
|
16
|
+
export type CreateAssemblyFn = FunctionReference<"action", "public", {
|
|
17
|
+
templateId?: string;
|
|
18
|
+
steps?: unknown;
|
|
19
|
+
fields?: unknown;
|
|
20
|
+
notifyUrl?: string;
|
|
21
|
+
numExpectedUploadFiles?: number;
|
|
22
|
+
expires?: string;
|
|
23
|
+
additionalParams?: unknown;
|
|
24
|
+
userId?: string;
|
|
25
|
+
}, {
|
|
26
|
+
assemblyId: string;
|
|
27
|
+
data: Record<string, unknown>;
|
|
28
|
+
}>;
|
|
29
|
+
export type GetAssemblyStatusFn = FunctionReference<"query", "public", {
|
|
30
|
+
assemblyId: string;
|
|
31
|
+
}, unknown>;
|
|
32
|
+
export type ListResultsFn = FunctionReference<"query", "public", {
|
|
33
|
+
assemblyId: string;
|
|
34
|
+
stepName?: string;
|
|
35
|
+
limit?: number;
|
|
36
|
+
}, Array<unknown>>;
|
|
37
|
+
export interface UploadOptions {
|
|
38
|
+
templateId?: string;
|
|
39
|
+
steps?: Record<string, unknown>;
|
|
40
|
+
fields?: Record<string, unknown>;
|
|
41
|
+
notifyUrl?: string;
|
|
42
|
+
numExpectedUploadFiles?: number;
|
|
43
|
+
expires?: string;
|
|
44
|
+
additionalParams?: Record<string, unknown>;
|
|
45
|
+
userId?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface UploadState {
|
|
48
|
+
isUploading: boolean;
|
|
49
|
+
progress: number;
|
|
50
|
+
error: Error | null;
|
|
51
|
+
}
|
|
52
|
+
export interface FormUploadOptions extends UploadOptions {
|
|
53
|
+
fileField?: string;
|
|
54
|
+
onProgress?: (progress: number) => void;
|
|
55
|
+
}
|
|
56
|
+
export interface TusUploadOptions extends UploadOptions {
|
|
57
|
+
metadata?: Record<string, string>;
|
|
58
|
+
chunkSize?: number;
|
|
59
|
+
retryDelays?: number[];
|
|
60
|
+
onProgress?: (progress: number) => void;
|
|
61
|
+
}
|
|
62
|
+
export declare function useTransloaditUpload(generateUploadParams: GenerateUploadParamsFn): {
|
|
63
|
+
upload: (file: File, options: FormUploadOptions) => Promise<Record<string, unknown>>;
|
|
64
|
+
reset: () => void;
|
|
65
|
+
isUploading: boolean;
|
|
66
|
+
progress: number;
|
|
67
|
+
error: Error | null;
|
|
68
|
+
};
|
|
69
|
+
export declare function useTransloaditTusUpload(createAssembly: CreateAssemblyFn): {
|
|
70
|
+
upload: (file: File, options: TusUploadOptions) => Promise<{
|
|
71
|
+
assemblyId: string;
|
|
72
|
+
data: Record<string, unknown>;
|
|
73
|
+
}>;
|
|
74
|
+
reset: () => void;
|
|
75
|
+
isUploading: boolean;
|
|
76
|
+
progress: number;
|
|
77
|
+
error: Error | null;
|
|
78
|
+
};
|
|
79
|
+
export declare function useAssemblyStatus(getStatus: GetAssemblyStatusFn, assemblyId: string): unknown;
|
|
80
|
+
export declare function useTransloaditFiles(listResults: ListResultsFn, args: {
|
|
81
|
+
assemblyId: string;
|
|
82
|
+
stepName?: string;
|
|
83
|
+
limit?: number;
|
|
84
|
+
}): unknown[] | undefined;
|
|
85
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CACpD,QAAQ,EACR,QAAQ,EACR;IACE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,EACD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CACnD,CAAC;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AAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAkDD,wBAAgB,oBAAoB,CAClC,oBAAoB,EAAE,sBAAsB;mBAU7B,IAAI,WAAW,iBAAiB;;;;;EA+ChD;AAED,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,gBAAgB;mBASvD,IAAI,WAAW,gBAAgB;oBAnKhC,MAAM;cAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;EAmPpD;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,MAAM,WAGnB;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,aAAa,EAC1B,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,yBAGhE"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { useAction, useQuery } from "convex/react";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { Upload } from "tus-js-client";
|
|
4
|
+
async function uploadViaForm(file, params, options) {
|
|
5
|
+
const formData = new FormData();
|
|
6
|
+
formData.append("params", params.params);
|
|
7
|
+
formData.append("signature", params.signature);
|
|
8
|
+
formData.append(options.fileField ?? "file", file);
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const xhr = new XMLHttpRequest();
|
|
11
|
+
xhr.open("POST", params.url, true);
|
|
12
|
+
xhr.upload.onprogress = (event) => {
|
|
13
|
+
if (!event.lengthComputable)
|
|
14
|
+
return;
|
|
15
|
+
const progress = Math.round((event.loaded / event.total) * 100);
|
|
16
|
+
options.onProgress?.(progress);
|
|
17
|
+
};
|
|
18
|
+
xhr.onload = () => {
|
|
19
|
+
try {
|
|
20
|
+
const response = JSON.parse(xhr.responseText);
|
|
21
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
22
|
+
resolve(response);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
reject(new Error(`Transloadit upload failed (${xhr.status}): ${JSON.stringify(response)}`));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
reject(error);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
xhr.onerror = () => {
|
|
33
|
+
reject(new Error("Transloadit upload failed"));
|
|
34
|
+
};
|
|
35
|
+
xhr.send(formData);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function useTransloaditUpload(generateUploadParams) {
|
|
39
|
+
const generate = useAction(generateUploadParams);
|
|
40
|
+
const [state, setState] = useState({
|
|
41
|
+
isUploading: false,
|
|
42
|
+
progress: 0,
|
|
43
|
+
error: null,
|
|
44
|
+
});
|
|
45
|
+
const upload = useCallback(async (file, options) => {
|
|
46
|
+
setState({ isUploading: true, progress: 0, error: null });
|
|
47
|
+
try {
|
|
48
|
+
const params = await generate({
|
|
49
|
+
templateId: options.templateId,
|
|
50
|
+
steps: options.steps,
|
|
51
|
+
fields: options.fields,
|
|
52
|
+
notifyUrl: options.notifyUrl,
|
|
53
|
+
numExpectedUploadFiles: options.numExpectedUploadFiles,
|
|
54
|
+
expires: options.expires,
|
|
55
|
+
additionalParams: options.additionalParams,
|
|
56
|
+
userId: options.userId,
|
|
57
|
+
});
|
|
58
|
+
const response = await uploadViaForm(file, params, {
|
|
59
|
+
...options,
|
|
60
|
+
onProgress: (progress) => {
|
|
61
|
+
setState((prev) => ({ ...prev, progress }));
|
|
62
|
+
options.onProgress?.(progress);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
setState({ isUploading: false, progress: 100, error: null });
|
|
66
|
+
return response;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const err = error instanceof Error ? error : new Error("Upload failed");
|
|
70
|
+
setState({ isUploading: false, progress: 0, error: err });
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
}, [generate]);
|
|
74
|
+
const reset = useCallback(() => {
|
|
75
|
+
setState({ isUploading: false, progress: 0, error: null });
|
|
76
|
+
}, []);
|
|
77
|
+
return useMemo(() => ({
|
|
78
|
+
upload,
|
|
79
|
+
reset,
|
|
80
|
+
isUploading: state.isUploading,
|
|
81
|
+
progress: state.progress,
|
|
82
|
+
error: state.error,
|
|
83
|
+
}), [state.error, state.isUploading, state.progress, upload, reset]);
|
|
84
|
+
}
|
|
85
|
+
export function useTransloaditTusUpload(createAssembly) {
|
|
86
|
+
const create = useAction(createAssembly);
|
|
87
|
+
const [state, setState] = useState({
|
|
88
|
+
isUploading: false,
|
|
89
|
+
progress: 0,
|
|
90
|
+
error: null,
|
|
91
|
+
});
|
|
92
|
+
const upload = useCallback(async (file, options) => {
|
|
93
|
+
setState({ isUploading: true, progress: 0, error: null });
|
|
94
|
+
try {
|
|
95
|
+
const assembly = await create({
|
|
96
|
+
templateId: options.templateId,
|
|
97
|
+
steps: options.steps,
|
|
98
|
+
fields: options.fields,
|
|
99
|
+
notifyUrl: options.notifyUrl,
|
|
100
|
+
numExpectedUploadFiles: options.numExpectedUploadFiles ?? 1,
|
|
101
|
+
expires: options.expires,
|
|
102
|
+
additionalParams: options.additionalParams,
|
|
103
|
+
userId: options.userId,
|
|
104
|
+
});
|
|
105
|
+
const data = assembly.data;
|
|
106
|
+
const tusUrl = (typeof data.tus_url === "string" && data.tus_url) ||
|
|
107
|
+
(typeof data.tusUrl === "string" && data.tusUrl) ||
|
|
108
|
+
"";
|
|
109
|
+
if (!tusUrl) {
|
|
110
|
+
throw new Error("Transloadit response missing tus_url for resumable upload");
|
|
111
|
+
}
|
|
112
|
+
const metadata = {
|
|
113
|
+
filename: file.name,
|
|
114
|
+
filetype: file.type,
|
|
115
|
+
...options.metadata,
|
|
116
|
+
};
|
|
117
|
+
await new Promise((resolve, reject) => {
|
|
118
|
+
const uploader = new Upload(file, {
|
|
119
|
+
endpoint: tusUrl,
|
|
120
|
+
metadata,
|
|
121
|
+
chunkSize: options.chunkSize,
|
|
122
|
+
retryDelays: options.retryDelays ?? [0, 3000, 5000, 10000],
|
|
123
|
+
onProgress: (bytesUploaded, bytesTotal) => {
|
|
124
|
+
const progress = Math.round((bytesUploaded / bytesTotal) * 100);
|
|
125
|
+
setState((prev) => ({ ...prev, progress }));
|
|
126
|
+
options.onProgress?.(progress);
|
|
127
|
+
},
|
|
128
|
+
onError: (error) => {
|
|
129
|
+
reject(error);
|
|
130
|
+
},
|
|
131
|
+
onSuccess: () => {
|
|
132
|
+
resolve();
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
uploader.start();
|
|
136
|
+
});
|
|
137
|
+
setState({ isUploading: false, progress: 100, error: null });
|
|
138
|
+
return assembly;
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
const err = error instanceof Error ? error : new Error("Upload failed");
|
|
142
|
+
setState({ isUploading: false, progress: 0, error: err });
|
|
143
|
+
throw err;
|
|
144
|
+
}
|
|
145
|
+
}, [create]);
|
|
146
|
+
const reset = useCallback(() => {
|
|
147
|
+
setState({ isUploading: false, progress: 0, error: null });
|
|
148
|
+
}, []);
|
|
149
|
+
return useMemo(() => ({
|
|
150
|
+
upload,
|
|
151
|
+
reset,
|
|
152
|
+
isUploading: state.isUploading,
|
|
153
|
+
progress: state.progress,
|
|
154
|
+
error: state.error,
|
|
155
|
+
}), [state.error, state.isUploading, state.progress, upload, reset]);
|
|
156
|
+
}
|
|
157
|
+
export function useAssemblyStatus(getStatus, assemblyId) {
|
|
158
|
+
return useQuery(getStatus, { assemblyId });
|
|
159
|
+
}
|
|
160
|
+
export function useTransloaditFiles(listResults, args) {
|
|
161
|
+
return useQuery(listResults, args);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AA6EvC,KAAK,UAAU,aAAa,CAC1B,IAAU,EACV,MAA0D,EAC1D,OAA0B;IAE1B,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,IAAI,MAAM,EAAE,IAAI,CAAC,CAAC;IAEnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAEnC,GAAG,CAAC,MAAM,C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AG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,KAAK;QACL,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC,EACF,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAChE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,SAA8B,EAC9B,UAAkB;IAElB,OAAO,QAAQ,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,WAA0B,EAC1B,IAA+D;IAE/D,OAAO,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@transloadit/convex",
|
|
3
|
+
"description": "Transloadit component for Convex",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"packageManager": "yarn@4.5.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/transloadit/convex.git"
|
|
10
|
+
},
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"author": "Transloadit",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"convex",
|
|
15
|
+
"component",
|
|
16
|
+
"transloadit",
|
|
17
|
+
"upload",
|
|
18
|
+
"assembly",
|
|
19
|
+
"tus",
|
|
20
|
+
"media"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -p tsconfig.build.json && node scripts/emit-package-json.ts",
|
|
24
|
+
"build:watch": "tsc -p tsconfig.build.json --watch",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"test": "vitest run --typecheck",
|
|
27
|
+
"test:watch": "vitest --typecheck",
|
|
28
|
+
"lint": "biome check .",
|
|
29
|
+
"format": "biome format . --write",
|
|
30
|
+
"prepack": "yarn build",
|
|
31
|
+
"smoke": "dotenv -q -- node scripts/smoke-test.ts",
|
|
32
|
+
"template:ensure": "dotenv -q -- node scripts/ensure-template.ts",
|
|
33
|
+
"tunnel": "node scripts/start-webhook-tunnel.ts",
|
|
34
|
+
"qa:full": "dotenv -q -- node scripts/qa-full.ts",
|
|
35
|
+
"qa:full:verbose": "dotenv -q -- node scripts/qa-full.ts --verbose"
|
|
36
|
+
},
|
|
37
|
+
"files": ["dist", "src"],
|
|
38
|
+
"exports": {
|
|
39
|
+
"./package.json": "./package.json",
|
|
40
|
+
".": {
|
|
41
|
+
"@convex-dev/component-source": "./src/client/index.ts",
|
|
42
|
+
"types": "./dist/client/index.d.ts",
|
|
43
|
+
"default": "./dist/client/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./react": {
|
|
46
|
+
"@convex-dev/component-source": "./src/react/index.tsx",
|
|
47
|
+
"types": "./dist/react/index.d.ts",
|
|
48
|
+
"default": "./dist/react/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./lib": {
|
|
51
|
+
"@convex-dev/component-source": "./src/component/lib.ts",
|
|
52
|
+
"types": "./dist/component/lib.d.ts",
|
|
53
|
+
"default": "./dist/component/lib.js"
|
|
54
|
+
},
|
|
55
|
+
"./convex.config": {
|
|
56
|
+
"@convex-dev/component-source": "./src/component/convex.config.ts",
|
|
57
|
+
"types": "./dist/component/convex.config.d.ts",
|
|
58
|
+
"default": "./dist/component/convex.config.js"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"convex": "^1.24.8",
|
|
63
|
+
"react": "^18.3.1 || ^19.0.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"react": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"tus-js-client": "^4.1.0"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@biomejs/biome": "^1.9.4",
|
|
75
|
+
"@edge-runtime/vm": "^5.0.0",
|
|
76
|
+
"@types/node": "^20.19.0",
|
|
77
|
+
"@types/react": "^19.1.10",
|
|
78
|
+
"convex": "^1.24.8",
|
|
79
|
+
"convex-test": "0.0.37",
|
|
80
|
+
"dotenv-cli": "^8.0.0",
|
|
81
|
+
"typescript": "^5.9.3",
|
|
82
|
+
"vitest": "3.2.4"
|
|
83
|
+
},
|
|
84
|
+
"types": "./dist/client/index.d.ts",
|
|
85
|
+
"module": "./dist/client/index.js"
|
|
86
|
+
}
|