@transloadit/convex 0.0.2 → 0.0.3
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 +162 -79
- package/dist/client/index.d.ts +83 -54
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +57 -30
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +35 -15
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/apiUtils.d.ts +13 -4
- package/dist/component/apiUtils.d.ts.map +1 -1
- package/dist/component/apiUtils.js +22 -12
- package/dist/component/apiUtils.js.map +1 -1
- package/dist/component/lib.d.ts +69 -45
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +154 -77
- package/dist/component/lib.js.map +1 -1
- package/dist/component/schema.d.ts +9 -9
- package/dist/component/schema.js +3 -3
- package/dist/component/schema.js.map +1 -1
- package/dist/react/index.d.ts +23 -25
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +129 -88
- package/dist/react/index.js.map +1 -1
- package/dist/test/index.d.ts +65 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +8 -0
- package/dist/test/index.js.map +1 -0
- package/package.json +21 -13
- package/src/client/index.ts +72 -35
- package/src/component/_generated/component.ts +44 -13
- package/src/component/apiUtils.test.ts +29 -0
- package/src/component/apiUtils.ts +52 -26
- package/src/component/lib.test.ts +73 -3
- package/src/component/lib.ts +220 -96
- package/src/component/schema.ts +3 -3
- package/src/react/index.tsx +193 -150
- package/src/test/index.ts +10 -0
package/README.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# Transloadit Convex Component
|
|
2
2
|
|
|
3
|
-
A Convex component for creating Transloadit Assemblies,
|
|
3
|
+
A Convex component for creating Transloadit Assemblies, handling resumable uploads with tus, and persisting status/results in Convex.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Create Assemblies with templates or inline steps.
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- Persist Assembly status + results in Convex.
|
|
8
|
+
- Resumable uploads via tus (client-side hook; form/XHR uploads are intentionally not supported).
|
|
9
|
+
- Webhook ingestion with signature verification (direct or queued).
|
|
10
|
+
- Persist Assembly status + results in Convex tables.
|
|
12
11
|
- Typed API wrappers and React hooks.
|
|
13
12
|
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Node.js 24+
|
|
16
|
+
- Yarn 4 (Corepack)
|
|
17
|
+
|
|
14
18
|
## Install
|
|
15
19
|
|
|
16
20
|
```bash
|
|
@@ -34,15 +38,6 @@ export default app;
|
|
|
34
38
|
|
|
35
39
|
### 2) Set environment variables
|
|
36
40
|
|
|
37
|
-
Preferred names:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npx convex env set TRANSLOADIT_AUTH_KEY <your_auth_key>
|
|
41
|
-
npx convex env set TRANSLOADIT_AUTH_SECRET <your_auth_secret>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Aliases also supported:
|
|
45
|
-
|
|
46
41
|
```bash
|
|
47
42
|
npx convex env set TRANSLOADIT_KEY <your_auth_key>
|
|
48
43
|
npx convex env set TRANSLOADIT_SECRET <your_auth_secret>
|
|
@@ -56,9 +51,7 @@ We use the Transloadit CLI under the hood for the best DX and to avoid hand-roll
|
|
|
56
51
|
yarn template:ensure
|
|
57
52
|
```
|
|
58
53
|
|
|
59
|
-
The script reads `TRANSLOADIT_KEY/TRANSLOADIT_SECRET`
|
|
60
|
-
creates or updates the template `convex-demo`, and prints the template id.
|
|
61
|
-
Use that id as `VITE_TRANSLOADIT_TEMPLATE_ID` in `example/.env` when running the demo app.
|
|
54
|
+
The script reads `TRANSLOADIT_KEY/TRANSLOADIT_SECRET` from `.env`, creates or updates the template `convex-demo`, and prints the template id. Use that id as `VITE_TRANSLOADIT_TEMPLATE_ID` in `example/.env` when running the demo app.
|
|
62
55
|
|
|
63
56
|
## Backend API
|
|
64
57
|
|
|
@@ -69,8 +62,9 @@ import { components } from "./_generated/api";
|
|
|
69
62
|
|
|
70
63
|
export const {
|
|
71
64
|
createAssembly,
|
|
72
|
-
generateUploadParams,
|
|
73
65
|
handleWebhook,
|
|
66
|
+
queueWebhook,
|
|
67
|
+
refreshAssembly,
|
|
74
68
|
getAssemblyStatus,
|
|
75
69
|
listAssemblies,
|
|
76
70
|
listResults,
|
|
@@ -80,14 +74,32 @@ export const {
|
|
|
80
74
|
|
|
81
75
|
Note: if you don’t supply `expires`, the component defaults it to 1 hour from now.
|
|
82
76
|
|
|
77
|
+
## Data model
|
|
78
|
+
|
|
79
|
+
The component stores Transloadit metadata in two tables:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
assemblies 1 ──── * results
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- `assemblies`: one row per Transloadit Assembly (status/ok, notify URL, uploads, raw payload, etc).
|
|
86
|
+
- `results`: one row per output file, keyed by `assemblyId` + `stepName` with the raw result payload.
|
|
87
|
+
|
|
88
|
+
Lifecycle:
|
|
89
|
+
1. `createAssembly` inserts the initial `assemblies` row.
|
|
90
|
+
2. `handleWebhook`, `queueWebhook`, or `refreshAssembly` upserts the assembly + replaces results.
|
|
91
|
+
3. `listResults` returns flattened step outputs for use in UIs.
|
|
92
|
+
|
|
83
93
|
## Webhook route
|
|
84
94
|
|
|
85
95
|
Transloadit sends webhooks as `multipart/form-data` with `transloadit` (JSON) and `signature` fields.
|
|
86
96
|
|
|
87
97
|
```ts
|
|
88
98
|
// convex/http.ts
|
|
89
|
-
import {
|
|
99
|
+
import { httpRouter } from "convex/server";
|
|
100
|
+
import { parseTransloaditWebhook } from "@transloadit/convex";
|
|
90
101
|
import { api } from "./_generated/api";
|
|
102
|
+
import { httpAction } from "./_generated/server";
|
|
91
103
|
|
|
92
104
|
const http = httpRouter();
|
|
93
105
|
|
|
@@ -95,20 +107,13 @@ http.route({
|
|
|
95
107
|
path: "/transloadit/webhook",
|
|
96
108
|
method: "POST",
|
|
97
109
|
handler: httpAction(async (ctx, request) => {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const signature = formData.get("signature");
|
|
101
|
-
|
|
102
|
-
if (typeof rawPayload !== "string") {
|
|
103
|
-
return new Response("Missing payload", { status: 400 });
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const payload = JSON.parse(rawPayload);
|
|
110
|
+
const { payload, rawBody, signature } =
|
|
111
|
+
await parseTransloaditWebhook(request);
|
|
107
112
|
|
|
108
113
|
await ctx.runAction(api.transloadit.handleWebhook, {
|
|
109
114
|
payload,
|
|
110
|
-
rawBody
|
|
111
|
-
signature
|
|
115
|
+
rawBody,
|
|
116
|
+
signature,
|
|
112
117
|
});
|
|
113
118
|
|
|
114
119
|
return new Response(null, { status: 204 });
|
|
@@ -118,60 +123,34 @@ http.route({
|
|
|
118
123
|
export default http;
|
|
119
124
|
```
|
|
120
125
|
|
|
121
|
-
|
|
126
|
+
If you want to queue webhook processing (durable retry via Convex scheduling), use `queueWebhook` and return HTTP 202:
|
|
122
127
|
|
|
123
|
-
|
|
128
|
+
```ts
|
|
129
|
+
await ctx.runAction(api.transloadit.queueWebhook, {
|
|
130
|
+
payload,
|
|
131
|
+
rawBody,
|
|
132
|
+
signature,
|
|
133
|
+
});
|
|
124
134
|
|
|
125
|
-
|
|
126
|
-
yarn tunnel
|
|
135
|
+
return new Response(null, { status: 202 });
|
|
127
136
|
```
|
|
128
137
|
|
|
129
|
-
|
|
130
|
-
`VITE_TRANSLOADIT_NOTIFY_URL` for the example app.
|
|
131
|
-
|
|
132
|
-
You can also run `yarn tunnel --once` to print the URL and exit.
|
|
138
|
+
## Client wrapper
|
|
133
139
|
|
|
134
|
-
|
|
140
|
+
If you prefer a class-based API (similar to other Convex components), use `Transloadit`:
|
|
135
141
|
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
```ts
|
|
143
|
+
import { Transloadit } from "@transloadit/convex";
|
|
144
|
+
import { components } from "./_generated/api";
|
|
138
145
|
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
const transloadit = new Transloadit(components.transloadit, {
|
|
147
|
+
authKey: process.env.TRANSLOADIT_KEY!,
|
|
148
|
+
authSecret: process.env.TRANSLOADIT_SECRET!,
|
|
149
|
+
});
|
|
141
150
|
```
|
|
142
151
|
|
|
143
|
-
It prints a JSON summary including the assembly id, webhook status, and number of stored results.
|
|
144
|
-
|
|
145
152
|
## React usage
|
|
146
153
|
|
|
147
|
-
### Form upload
|
|
148
|
-
|
|
149
|
-
```tsx
|
|
150
|
-
import { useTransloaditUpload } from "@transloadit/convex/react";
|
|
151
|
-
import { api } from "../convex/_generated/api";
|
|
152
|
-
|
|
153
|
-
function UploadButton() {
|
|
154
|
-
const { upload, isUploading, progress, error } = useTransloaditUpload(
|
|
155
|
-
api.transloadit.generateUploadParams,
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
const handleUpload = async (file: File) => {
|
|
159
|
-
await upload(file, {
|
|
160
|
-
templateId: "template_id_here",
|
|
161
|
-
onProgress: (percent) => console.log(percent),
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<div>
|
|
167
|
-
<input type="file" onChange={(e) => handleUpload(e.target.files![0])} />
|
|
168
|
-
{isUploading && <p>Uploading: {progress}%</p>}
|
|
169
|
-
{error && <p>{error.message}</p>}
|
|
170
|
-
</div>
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
154
|
### Resumable tus upload
|
|
176
155
|
|
|
177
156
|
```tsx
|
|
@@ -186,6 +165,7 @@ function TusUpload() {
|
|
|
186
165
|
const handleUpload = async (file: File) => {
|
|
187
166
|
await upload(file, {
|
|
188
167
|
templateId: "template_id_here",
|
|
168
|
+
onAssemblyCreated: (assembly) => console.log(assembly.assemblyId),
|
|
189
169
|
});
|
|
190
170
|
};
|
|
191
171
|
|
|
@@ -198,6 +178,8 @@ function TusUpload() {
|
|
|
198
178
|
}
|
|
199
179
|
```
|
|
200
180
|
|
|
181
|
+
Note: Transloadit expects tus metadata `fieldname`. The hook sets it to `file` by default; override via `fieldName` or `metadata.fieldname`. You can also use `onAssemblyCreated` to access the assembly id before the upload finishes.
|
|
182
|
+
|
|
201
183
|
### Reactive status/results
|
|
202
184
|
|
|
203
185
|
```tsx
|
|
@@ -220,16 +202,117 @@ function AssemblyStatus({ assemblyId }: { assemblyId: string }) {
|
|
|
220
202
|
}
|
|
221
203
|
```
|
|
222
204
|
|
|
223
|
-
|
|
205
|
+
### Polling fallback (no webhooks)
|
|
224
206
|
|
|
225
|
-
|
|
207
|
+
```tsx
|
|
208
|
+
import { useAssemblyStatusWithPolling } from "@transloadit/convex/react";
|
|
209
|
+
import { api } from "../convex/_generated/api";
|
|
210
|
+
|
|
211
|
+
const status = useAssemblyStatusWithPolling(
|
|
212
|
+
api.transloadit.getAssemblyStatus,
|
|
213
|
+
api.transloadit.refreshAssembly,
|
|
214
|
+
assemblyId,
|
|
215
|
+
{ pollIntervalMs: 5000, stopOnTerminal: true },
|
|
216
|
+
);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Example app
|
|
220
|
+
|
|
221
|
+
The `example/` directory contains a minimal Vite + React app wired to the component.
|
|
226
222
|
|
|
227
223
|
```bash
|
|
228
|
-
|
|
224
|
+
cd example
|
|
225
|
+
yarn install
|
|
226
|
+
npx convex dev
|
|
227
|
+
# In another terminal:
|
|
228
|
+
yarn dev
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
-
|
|
231
|
+
Set environment variables in Convex:
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
```bash
|
|
234
|
+
npx convex env set TRANSLOADIT_KEY <your_auth_key>
|
|
235
|
+
npx convex env set TRANSLOADIT_SECRET <your_auth_secret>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Create `example/.env` and set `VITE_TRANSLOADIT_TEMPLATE_ID` (use `yarn template:ensure` to create one). To test webhooks locally, run `yarn tunnel` and set `VITE_TRANSLOADIT_NOTIFY_URL` to the generated URL.
|
|
239
|
+
|
|
240
|
+
## Verification and QA
|
|
241
|
+
|
|
242
|
+
Fast checks:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
yarn check
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
This runs format, lint, typecheck, and unit tests. Additional commands:
|
|
249
|
+
|
|
250
|
+
- `yarn lint` (Biome)
|
|
251
|
+
- `yarn format` (Biome write)
|
|
252
|
+
- `yarn typecheck` (tsc)
|
|
253
|
+
- `yarn test` (Vitest unit tests)
|
|
254
|
+
- `yarn test:browser` (browser + webhook QA flow)
|
|
255
|
+
- `yarn build` (tsc build + emit package json)
|
|
256
|
+
|
|
257
|
+
Notes:
|
|
258
|
+
- `yarn template:ensure` and `yarn tunnel` are support tools, not verification.
|
|
259
|
+
- CI should run non-mutating checks; local `yarn check` may format/fix.
|
|
260
|
+
|
|
261
|
+
## Component test helpers
|
|
262
|
+
|
|
263
|
+
For `convex-test`, you can use the built-in helper:
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
import { createTransloaditTest } from "@transloadit/convex/test";
|
|
267
|
+
|
|
268
|
+
const t = createTransloaditTest();
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Generated files
|
|
272
|
+
|
|
273
|
+
`src/component/_generated` is Convex codegen output. It is checked in so tests and component consumers have stable API references. If you change component functions or schemas, regenerate with Convex codegen (for example via `npx convex dev` or `npx convex codegen`) and commit the updated files.
|
|
274
|
+
|
|
275
|
+
## Release process
|
|
276
|
+
|
|
277
|
+
Releases are automated via GitHub Actions and published to npm using OIDC (Trusted Publisher).
|
|
278
|
+
|
|
279
|
+
1. Ensure CI is green on `main`.
|
|
280
|
+
2. Run local checks:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
yarn check
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
3. Update `package.json` version and commit it:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
git checkout main
|
|
290
|
+
git pull
|
|
291
|
+
# edit package.json version, then:
|
|
292
|
+
git add package.json
|
|
293
|
+
git commit -m "Release vX.Y.Z"
|
|
294
|
+
git push
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
4. Tag and push the release:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
git tag vX.Y.Z
|
|
301
|
+
git push origin vX.Y.Z
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
5. The `Publish to npm` workflow will:
|
|
305
|
+
- build and pack a `.tgz` artifact,
|
|
306
|
+
- create a draft GitHub release,
|
|
307
|
+
- publish the tarball to npm with provenance.
|
|
308
|
+
|
|
309
|
+
## Roadmap (condensed)
|
|
310
|
+
|
|
311
|
+
- Completed: tus-only uploads, webhook handling, polling fallback, typed API wrappers, React hooks, browser QA.
|
|
312
|
+
- Possible next steps: richer typed step/result validators, automated webhook retries with backoff, additional templates/recipes.
|
|
313
|
+
|
|
314
|
+
## References
|
|
234
315
|
|
|
235
|
-
|
|
316
|
+
- Convex components authoring guide
|
|
317
|
+
- Convex official components (e.g. Resend, Aggregate)
|
|
318
|
+
- Transloadit API docs (assembly status + resumable uploads)
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import type { AssemblyStatus } from "@transloadit/types/assemblyStatus";
|
|
2
|
+
import type { AssemblyInstructionsInput } from "@transloadit/types/template";
|
|
1
3
|
import { type Infer } from "convex/values";
|
|
2
4
|
import type { ComponentApi } from "../component/_generated/component.js";
|
|
3
5
|
import type { RunActionCtx, RunMutationCtx, RunQueryCtx } from "./types.js";
|
|
6
|
+
export { parseTransloaditWebhook } from "../component/apiUtils.js";
|
|
7
|
+
export type { AssemblyStatus, AssemblyInstructionsInput };
|
|
4
8
|
export interface TransloaditConfig {
|
|
5
9
|
authKey: string;
|
|
6
10
|
authSecret: string;
|
|
@@ -13,9 +17,9 @@ export declare const vAssemblyResponse: import("convex/values").VObject<{
|
|
|
13
17
|
templateId?: string | undefined;
|
|
14
18
|
notifyUrl?: string | undefined;
|
|
15
19
|
numExpectedUploadFiles?: number | undefined;
|
|
16
|
-
fields?: any;
|
|
17
|
-
uploads?: any;
|
|
18
|
-
results?: any;
|
|
20
|
+
fields?: Record<string, any> | undefined;
|
|
21
|
+
uploads?: any[] | undefined;
|
|
22
|
+
results?: Record<string, any[]> | undefined;
|
|
19
23
|
error?: any;
|
|
20
24
|
raw?: any;
|
|
21
25
|
userId?: string | undefined;
|
|
@@ -34,20 +38,20 @@ export declare const vAssemblyResponse: import("convex/values").VObject<{
|
|
|
34
38
|
templateId: import("convex/values").VString<string | undefined, "optional">;
|
|
35
39
|
notifyUrl: import("convex/values").VString<string | undefined, "optional">;
|
|
36
40
|
numExpectedUploadFiles: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
37
|
-
fields: import("convex/values").VAny<any, "optional", string>;
|
|
38
|
-
uploads: import("convex/values").VAny<any, "
|
|
39
|
-
results: import("convex/values").VAny<any, "optional", string>;
|
|
41
|
+
fields: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
42
|
+
uploads: import("convex/values").VArray<any[] | undefined, import("convex/values").VAny<any, "required", string>, "optional">;
|
|
43
|
+
results: import("convex/values").VRecord<Record<string, any[]> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VArray<any[], import("convex/values").VAny<any, "required", string>, "required">, "optional", string>;
|
|
40
44
|
error: import("convex/values").VAny<any, "optional", string>;
|
|
41
45
|
raw: import("convex/values").VAny<any, "optional", string>;
|
|
42
46
|
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
43
47
|
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
44
48
|
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
45
|
-
}, "required", "assemblyId" | "status" | "ok" | "message" | "templateId" | "notifyUrl" | "numExpectedUploadFiles" | "fields" | "uploads" | "results" | "error" | "raw" | "userId" | "_id" | "_creationTime" | "createdAt" | "updatedAt" | `fields.${string}` | `
|
|
49
|
+
}, "required", "assemblyId" | "status" | "ok" | "message" | "templateId" | "notifyUrl" | "numExpectedUploadFiles" | "fields" | "uploads" | "results" | "error" | "raw" | "userId" | "_id" | "_creationTime" | "createdAt" | "updatedAt" | `fields.${string}` | `results.${string}` | `error.${string}` | `raw.${string}`>;
|
|
46
50
|
export type AssemblyResponse = Infer<typeof vAssemblyResponse>;
|
|
47
51
|
export declare const vAssemblyResultResponse: import("convex/values").VObject<{
|
|
52
|
+
name?: string | undefined;
|
|
48
53
|
resultId?: string | undefined;
|
|
49
54
|
sslUrl?: string | undefined;
|
|
50
|
-
name?: string | undefined;
|
|
51
55
|
size?: number | undefined;
|
|
52
56
|
mime?: string | undefined;
|
|
53
57
|
assemblyId: string;
|
|
@@ -68,25 +72,25 @@ export declare const vAssemblyResultResponse: import("convex/values").VObject<{
|
|
|
68
72
|
mime: import("convex/values").VString<string | undefined, "optional">;
|
|
69
73
|
raw: import("convex/values").VAny<any, "required", string>;
|
|
70
74
|
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
71
|
-
}, "required", "assemblyId" | "raw" | "stepName" | "_id" | "_creationTime" | "createdAt" | `raw.${string}` | "resultId" | "sslUrl" | "
|
|
75
|
+
}, "required", "assemblyId" | "raw" | "stepName" | "name" | "_id" | "_creationTime" | "createdAt" | `raw.${string}` | "resultId" | "sslUrl" | "size" | "mime">;
|
|
72
76
|
export type AssemblyResultResponse = Infer<typeof vAssemblyResultResponse>;
|
|
73
77
|
export declare const vCreateAssemblyArgs: import("convex/values").VObject<{
|
|
74
78
|
templateId?: string | undefined;
|
|
75
79
|
notifyUrl?: string | undefined;
|
|
76
80
|
numExpectedUploadFiles?: number | undefined;
|
|
77
|
-
fields?: any;
|
|
81
|
+
fields?: Record<string, any> | undefined;
|
|
78
82
|
userId?: string | undefined;
|
|
79
|
-
steps?: any;
|
|
83
|
+
steps?: Record<string, any> | undefined;
|
|
80
84
|
expires?: string | undefined;
|
|
81
|
-
additionalParams?: any;
|
|
85
|
+
additionalParams?: Record<string, any> | undefined;
|
|
82
86
|
}, {
|
|
83
87
|
templateId: import("convex/values").VString<string | undefined, "optional">;
|
|
84
|
-
steps: import("convex/values").VAny<any, "optional", string>;
|
|
85
|
-
fields: import("convex/values").VAny<any, "optional", string>;
|
|
88
|
+
steps: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
89
|
+
fields: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
86
90
|
notifyUrl: import("convex/values").VString<string | undefined, "optional">;
|
|
87
91
|
numExpectedUploadFiles: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
88
92
|
expires: import("convex/values").VString<string | undefined, "optional">;
|
|
89
|
-
additionalParams: import("convex/values").VAny<any, "optional", string>;
|
|
93
|
+
additionalParams: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
90
94
|
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
91
95
|
}, "required", "templateId" | "notifyUrl" | "numExpectedUploadFiles" | "fields" | "userId" | "steps" | "expires" | "additionalParams" | `fields.${string}` | `steps.${string}` | `additionalParams.${string}`>;
|
|
92
96
|
export declare class TransloaditClient {
|
|
@@ -98,11 +102,6 @@ export declare class TransloaditClient {
|
|
|
98
102
|
assemblyId: string;
|
|
99
103
|
data: any;
|
|
100
104
|
}>;
|
|
101
|
-
generateUploadParams(ctx: RunActionCtx, args: Infer<typeof vCreateAssemblyArgs>): Promise<{
|
|
102
|
-
params: string;
|
|
103
|
-
signature: string;
|
|
104
|
-
url: string;
|
|
105
|
-
}>;
|
|
106
105
|
handleWebhook(ctx: RunActionCtx, args: {
|
|
107
106
|
payload: unknown;
|
|
108
107
|
rawBody?: string;
|
|
@@ -111,6 +110,23 @@ export declare class TransloaditClient {
|
|
|
111
110
|
}): Promise<{
|
|
112
111
|
assemblyId: string;
|
|
113
112
|
resultCount: number;
|
|
113
|
+
ok?: string;
|
|
114
|
+
status?: string;
|
|
115
|
+
}>;
|
|
116
|
+
queueWebhook(ctx: RunActionCtx, args: {
|
|
117
|
+
payload: unknown;
|
|
118
|
+
rawBody?: string;
|
|
119
|
+
signature?: string;
|
|
120
|
+
verifySignature?: boolean;
|
|
121
|
+
}): Promise<{
|
|
122
|
+
assemblyId: string;
|
|
123
|
+
queued: boolean;
|
|
124
|
+
}>;
|
|
125
|
+
refreshAssembly(ctx: RunActionCtx, assemblyId: string): Promise<{
|
|
126
|
+
assemblyId: string;
|
|
127
|
+
resultCount: number;
|
|
128
|
+
ok?: string;
|
|
129
|
+
status?: string;
|
|
114
130
|
}>;
|
|
115
131
|
getAssemblyStatus(ctx: RunQueryCtx, assemblyId: string): Promise<any>;
|
|
116
132
|
listAssemblies(ctx: RunQueryCtx, args?: {
|
|
@@ -133,37 +149,42 @@ export declare class TransloaditClient {
|
|
|
133
149
|
templateId?: string | undefined;
|
|
134
150
|
notifyUrl?: string | undefined;
|
|
135
151
|
numExpectedUploadFiles?: number | undefined;
|
|
136
|
-
fields?: any;
|
|
152
|
+
fields?: Record<string, any> | undefined;
|
|
137
153
|
userId?: string | undefined;
|
|
138
|
-
steps?: any;
|
|
154
|
+
steps?: Record<string, any> | undefined;
|
|
139
155
|
expires?: string | undefined;
|
|
140
|
-
additionalParams?: any;
|
|
156
|
+
additionalParams?: Record<string, any> | undefined;
|
|
141
157
|
}, Promise<{
|
|
142
158
|
assemblyId: string;
|
|
143
159
|
data: any;
|
|
144
160
|
}>>;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
userId?: string | undefined;
|
|
151
|
-
steps?: any;
|
|
152
|
-
expires?: string | undefined;
|
|
153
|
-
additionalParams?: any;
|
|
161
|
+
handleWebhook: import("convex/server").RegisteredAction<"public", {
|
|
162
|
+
rawBody?: string | undefined;
|
|
163
|
+
signature?: string | undefined;
|
|
164
|
+
verifySignature?: boolean | undefined;
|
|
165
|
+
payload: any;
|
|
154
166
|
}, Promise<{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
167
|
+
assemblyId: string;
|
|
168
|
+
resultCount: number;
|
|
169
|
+
ok?: string;
|
|
170
|
+
status?: string;
|
|
158
171
|
}>>;
|
|
159
|
-
|
|
172
|
+
queueWebhook: import("convex/server").RegisteredAction<"public", {
|
|
160
173
|
rawBody?: string | undefined;
|
|
161
174
|
signature?: string | undefined;
|
|
162
175
|
verifySignature?: boolean | undefined;
|
|
163
176
|
payload: any;
|
|
177
|
+
}, Promise<{
|
|
178
|
+
assemblyId: string;
|
|
179
|
+
queued: boolean;
|
|
180
|
+
}>>;
|
|
181
|
+
refreshAssembly: import("convex/server").RegisteredAction<"public", {
|
|
182
|
+
assemblyId: string;
|
|
164
183
|
}, Promise<{
|
|
165
184
|
assemblyId: string;
|
|
166
185
|
resultCount: number;
|
|
186
|
+
ok?: string;
|
|
187
|
+
status?: string;
|
|
167
188
|
}>>;
|
|
168
189
|
getAssemblyStatus: import("convex/server").RegisteredQuery<"public", {
|
|
169
190
|
assemblyId: string;
|
|
@@ -179,48 +200,56 @@ export declare class TransloaditClient {
|
|
|
179
200
|
assemblyId: string;
|
|
180
201
|
}, Promise<any[]>>;
|
|
181
202
|
storeAssemblyMetadata: import("convex/server").RegisteredMutation<"public", {
|
|
182
|
-
fields?: any;
|
|
203
|
+
fields?: Record<string, any> | undefined;
|
|
183
204
|
userId?: string | undefined;
|
|
184
205
|
assemblyId: string;
|
|
185
206
|
}, Promise<any>>;
|
|
186
207
|
};
|
|
187
208
|
}
|
|
209
|
+
export declare class Transloadit extends TransloaditClient {
|
|
210
|
+
}
|
|
211
|
+
export declare function createTransloadit(component: TransloaditComponent, config?: Partial<TransloaditConfig>): Transloadit;
|
|
188
212
|
export declare function makeTransloaditAPI(component: TransloaditComponent, config?: Partial<TransloaditConfig>): {
|
|
189
213
|
createAssembly: import("convex/server").RegisteredAction<"public", {
|
|
190
214
|
templateId?: string | undefined;
|
|
191
215
|
notifyUrl?: string | undefined;
|
|
192
216
|
numExpectedUploadFiles?: number | undefined;
|
|
193
|
-
fields?: any;
|
|
217
|
+
fields?: Record<string, any> | undefined;
|
|
194
218
|
userId?: string | undefined;
|
|
195
|
-
steps?: any;
|
|
219
|
+
steps?: Record<string, any> | undefined;
|
|
196
220
|
expires?: string | undefined;
|
|
197
|
-
additionalParams?: any;
|
|
221
|
+
additionalParams?: Record<string, any> | undefined;
|
|
198
222
|
}, Promise<{
|
|
199
223
|
assemblyId: string;
|
|
200
224
|
data: any;
|
|
201
225
|
}>>;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
userId?: string | undefined;
|
|
208
|
-
steps?: any;
|
|
209
|
-
expires?: string | undefined;
|
|
210
|
-
additionalParams?: any;
|
|
226
|
+
handleWebhook: import("convex/server").RegisteredAction<"public", {
|
|
227
|
+
rawBody?: string | undefined;
|
|
228
|
+
signature?: string | undefined;
|
|
229
|
+
verifySignature?: boolean | undefined;
|
|
230
|
+
payload: any;
|
|
211
231
|
}, Promise<{
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
232
|
+
assemblyId: string;
|
|
233
|
+
resultCount: number;
|
|
234
|
+
ok?: string;
|
|
235
|
+
status?: string;
|
|
215
236
|
}>>;
|
|
216
|
-
|
|
237
|
+
queueWebhook: import("convex/server").RegisteredAction<"public", {
|
|
217
238
|
rawBody?: string | undefined;
|
|
218
239
|
signature?: string | undefined;
|
|
219
240
|
verifySignature?: boolean | undefined;
|
|
220
241
|
payload: any;
|
|
242
|
+
}, Promise<{
|
|
243
|
+
assemblyId: string;
|
|
244
|
+
queued: boolean;
|
|
245
|
+
}>>;
|
|
246
|
+
refreshAssembly: import("convex/server").RegisteredAction<"public", {
|
|
247
|
+
assemblyId: string;
|
|
221
248
|
}, Promise<{
|
|
222
249
|
assemblyId: string;
|
|
223
250
|
resultCount: number;
|
|
251
|
+
ok?: string;
|
|
252
|
+
status?: string;
|
|
224
253
|
}>>;
|
|
225
254
|
getAssemblyStatus: import("convex/server").RegisteredQuery<"public", {
|
|
226
255
|
assemblyId: string;
|
|
@@ -236,7 +265,7 @@ export declare function makeTransloaditAPI(component: TransloaditComponent, conf
|
|
|
236
265
|
assemblyId: string;
|
|
237
266
|
}, Promise<any[]>>;
|
|
238
267
|
storeAssemblyMetadata: import("convex/server").RegisteredMutation<"public", {
|
|
239
|
-
fields?: any;
|
|
268
|
+
fields?: Record<string, any> | undefined;
|
|
240
269
|
userId?: string | undefined;
|
|
241
270
|
assemblyId: string;
|
|
242
271
|
}, Promise<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,KAAK,KAAK,EAAK,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,YAAY,EAAE,cAAc,EAAE,yBAAyB,EAAE,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,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