@transloadit/convex 0.0.3 → 0.0.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.
Files changed (85) hide show
  1. package/README.md +154 -122
  2. package/dist/client/index.d.ts +54 -13
  3. package/dist/client/index.d.ts.map +1 -1
  4. package/dist/client/index.js +48 -5
  5. package/dist/client/index.js.map +1 -1
  6. package/dist/component/_generated/api.d.ts +2 -2
  7. package/dist/component/_generated/component.d.ts +11 -0
  8. package/dist/component/_generated/component.d.ts.map +1 -1
  9. package/dist/component/_generated/dataModel.d.ts +1 -1
  10. package/dist/component/_generated/server.d.ts +1 -1
  11. package/dist/component/apiUtils.d.ts +26 -6
  12. package/dist/component/apiUtils.d.ts.map +1 -1
  13. package/dist/component/apiUtils.js +48 -38
  14. package/dist/component/apiUtils.js.map +1 -1
  15. package/dist/component/lib.d.ts +37 -8
  16. package/dist/component/lib.d.ts.map +1 -1
  17. package/dist/component/lib.js +145 -18
  18. package/dist/component/lib.js.map +1 -1
  19. package/dist/component/schema.d.ts +9 -6
  20. package/dist/component/schema.d.ts.map +1 -1
  21. package/dist/component/schema.js +4 -8
  22. package/dist/component/schema.js.map +1 -1
  23. package/dist/debug/index.d.ts +19 -0
  24. package/dist/debug/index.d.ts.map +1 -0
  25. package/dist/debug/index.js +49 -0
  26. package/dist/debug/index.js.map +1 -0
  27. package/dist/react/index.d.ts +201 -3
  28. package/dist/react/index.d.ts.map +1 -1
  29. package/dist/react/index.js +674 -94
  30. package/dist/react/index.js.map +1 -1
  31. package/dist/shared/assemblyUrls.d.ts +10 -0
  32. package/dist/shared/assemblyUrls.d.ts.map +1 -0
  33. package/dist/shared/assemblyUrls.js +26 -0
  34. package/dist/shared/assemblyUrls.js.map +1 -0
  35. package/dist/shared/errors.d.ts +7 -0
  36. package/dist/shared/errors.d.ts.map +1 -0
  37. package/dist/shared/errors.js +10 -0
  38. package/dist/shared/errors.js.map +1 -0
  39. package/dist/shared/pollAssembly.d.ts +12 -0
  40. package/dist/shared/pollAssembly.d.ts.map +1 -0
  41. package/dist/shared/pollAssembly.js +50 -0
  42. package/dist/shared/pollAssembly.js.map +1 -0
  43. package/dist/shared/resultTypes.d.ts +37 -0
  44. package/dist/shared/resultTypes.d.ts.map +1 -0
  45. package/dist/shared/resultTypes.js +2 -0
  46. package/dist/shared/resultTypes.js.map +1 -0
  47. package/dist/shared/resultUtils.d.ts +4 -0
  48. package/dist/shared/resultUtils.d.ts.map +1 -0
  49. package/dist/shared/resultUtils.js +69 -0
  50. package/dist/shared/resultUtils.js.map +1 -0
  51. package/dist/shared/tusUpload.d.ts +13 -0
  52. package/dist/shared/tusUpload.d.ts.map +1 -0
  53. package/dist/shared/tusUpload.js +32 -0
  54. package/dist/shared/tusUpload.js.map +1 -0
  55. package/dist/test/index.d.ts +9 -4
  56. package/dist/test/index.d.ts.map +1 -1
  57. package/dist/test/nodeModules.d.ts +2 -0
  58. package/dist/test/nodeModules.d.ts.map +1 -0
  59. package/dist/test/nodeModules.js +19 -0
  60. package/dist/test/nodeModules.js.map +1 -0
  61. package/package.json +40 -7
  62. package/src/client/index.ts +111 -9
  63. package/src/component/_generated/api.ts +2 -2
  64. package/src/component/_generated/component.ts +14 -0
  65. package/src/component/_generated/dataModel.ts +1 -1
  66. package/src/component/_generated/server.ts +1 -1
  67. package/src/component/apiUtils.test.ts +166 -2
  68. package/src/component/apiUtils.ts +96 -64
  69. package/src/component/lib.test.ts +213 -4
  70. package/src/component/lib.ts +192 -25
  71. package/src/component/schema.ts +4 -11
  72. package/src/debug/index.ts +84 -0
  73. package/src/react/index.test.tsx +340 -0
  74. package/src/react/index.tsx +1089 -179
  75. package/src/react/uploadWithTus.test.tsx +192 -0
  76. package/src/shared/assemblyUrls.test.ts +71 -0
  77. package/src/shared/assemblyUrls.ts +59 -0
  78. package/src/shared/errors.ts +23 -0
  79. package/src/shared/pollAssembly.ts +65 -0
  80. package/src/shared/resultTypes.ts +44 -0
  81. package/src/shared/resultUtils.test.ts +29 -0
  82. package/src/shared/resultUtils.ts +71 -0
  83. package/src/shared/tusUpload.ts +59 -0
  84. package/src/test/index.ts +1 -1
  85. package/src/test/nodeModules.ts +19 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@ A Convex component for creating Transloadit Assemblies, handling resumable uploa
4
4
 
5
5
  ## Features
6
6
 
7
- - Create Assemblies with templates or inline steps.
7
+ - Create Assemblies with Templates or inline Steps.
8
8
  - Resumable uploads via tus (client-side hook; form/XHR uploads are intentionally not supported).
9
9
  - Webhook ingestion with signature verification (direct or queued).
10
10
  - Persist Assembly status + results in Convex tables.
@@ -43,15 +43,12 @@ npx convex env set TRANSLOADIT_KEY <your_auth_key>
43
43
  npx convex env set TRANSLOADIT_SECRET <your_auth_secret>
44
44
  ```
45
45
 
46
- ### 3) Create a demo template (idempotent)
46
+ ## Golden path (secure by default)
47
47
 
48
- We use the Transloadit CLI under the hood for the best DX and to avoid hand-rolling API calls.
49
-
50
- ```bash
51
- yarn template:ensure
52
- ```
53
-
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.
48
+ 1. **Server-only create**: a Convex action creates the Assembly (auth secret stays server-side).
49
+ 2. **Client upload**: use `useTransloaditUppy` for resumable uploads.
50
+ 3. **Webhook ingestion**: verify the signature and `queueWebhook` for durable processing.
51
+ 4. **Realtime UI**: query status/results and render the gallery.
55
52
 
56
53
  ## Backend API
57
54
 
@@ -72,7 +69,7 @@ export const {
72
69
  } = makeTransloaditAPI(components.transloadit);
73
70
  ```
74
71
 
75
- Note: if you don’t supply `expires`, the component defaults it to 1 hour from now.
72
+ Note: pass `expires` in `createAssembly` when you need a custom expiry; otherwise the component defaults to 1 hour from now.
76
73
 
77
74
  ## Data model
78
75
 
@@ -83,7 +80,7 @@ assemblies 1 ──── * results
83
80
  ```
84
81
 
85
82
  - `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.
83
+ - `results`: one row per output file, keyed by `assemblyId` + `stepName`, plus normalized fields (name/size/mime/url) and the raw Transloadit output object.
87
84
 
88
85
  Lifecycle:
89
86
  1. `createAssembly` inserts the initial `assemblies` row.
@@ -97,7 +94,7 @@ Transloadit sends webhooks as `multipart/form-data` with `transloadit` (JSON) an
97
94
  ```ts
98
95
  // convex/http.ts
99
96
  import { httpRouter } from "convex/server";
100
- import { parseTransloaditWebhook } from "@transloadit/convex";
97
+ import { handleWebhookRequest } from "@transloadit/convex";
101
98
  import { api } from "./_generated/api";
102
99
  import { httpAction } from "./_generated/server";
103
100
 
@@ -106,38 +103,21 @@ const http = httpRouter();
106
103
  http.route({
107
104
  path: "/transloadit/webhook",
108
105
  method: "POST",
109
- handler: httpAction(async (ctx, request) => {
110
- const { payload, rawBody, signature } =
111
- await parseTransloaditWebhook(request);
112
-
113
- await ctx.runAction(api.transloadit.handleWebhook, {
114
- payload,
115
- rawBody,
116
- signature,
117
- });
118
-
119
- return new Response(null, { status: 204 });
120
- }),
106
+ handler: httpAction((ctx, request) =>
107
+ handleWebhookRequest(request, {
108
+ mode: "queue",
109
+ runAction: (args) => ctx.runAction(api.transloadit.queueWebhook, args),
110
+ }),
111
+ ),
121
112
  });
122
113
 
123
114
  export default http;
124
115
  ```
125
116
 
126
- If you want to queue webhook processing (durable retry via Convex scheduling), use `queueWebhook` and return HTTP 202:
127
-
128
- ```ts
129
- await ctx.runAction(api.transloadit.queueWebhook, {
130
- payload,
131
- rawBody,
132
- signature,
133
- });
134
-
135
- return new Response(null, { status: 202 });
136
- ```
137
-
138
- ## Client wrapper
117
+ ## Client wrapper (optional)
139
118
 
140
- If you prefer a class-based API (similar to other Convex components), use `Transloadit`:
119
+ Most integrations should use `makeTransloaditAPI` (above). If you prefer a class-based API
120
+ (similar to other Convex components), use `Transloadit`:
141
121
 
142
122
  ```ts
143
123
  import { Transloadit } from "@transloadit/convex";
@@ -149,93 +129,139 @@ const transloadit = new Transloadit(components.transloadit, {
149
129
  });
150
130
  ```
151
131
 
152
- ## React usage
153
-
154
- ### Resumable tus upload
132
+ ## React usage (Uppy)
155
133
 
156
134
  ```tsx
157
- import { useTransloaditTusUpload } from "@transloadit/convex/react";
135
+ import { useTransloaditUppy } from "@transloadit/convex/react";
158
136
  import { api } from "../convex/_generated/api";
159
137
 
160
- function TusUpload() {
161
- const { upload, isUploading, progress } = useTransloaditTusUpload(
162
- api.transloadit.createAssembly,
163
- );
164
-
165
- const handleUpload = async (file: File) => {
166
- await upload(file, {
167
- templateId: "template_id_here",
168
- onAssemblyCreated: (assembly) => console.log(assembly.assemblyId),
169
- });
170
- };
171
-
172
- return (
173
- <div>
174
- <input type="file" onChange={(e) => handleUpload(e.target.files![0])} />
175
- {isUploading && <p>Uploading: {progress}%</p>}
176
- </div>
177
- );
178
- }
138
+ const { startUpload, status, results, stage } = useTransloaditUppy({
139
+ uppy,
140
+ createAssembly: api.wedding.createWeddingAssembly,
141
+ getStatus: api.transloadit.getAssemblyStatus,
142
+ listResults: api.transloadit.listResults,
143
+ refreshAssembly: api.transloadit.refreshAssembly,
144
+ });
145
+
146
+ await startUpload({
147
+ createAssemblyArgs: { guestName, uploadCode },
148
+ });
179
149
  ```
150
+ For advanced/legacy helpers (raw parsing, low-level tus uploads, polling utilities), see `docs/advanced.md`.
180
151
 
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.
152
+ ## Example app (Next.js + Uppy wedding gallery)
182
153
 
183
- ### Reactive status/results
154
+ The `example/` app is a wedding gallery where guests upload photos + short videos. It uses Uppy on the client and Convex Auth (anonymous sign-in) to create assemblies securely. If you do not set `NEXT_PUBLIC_CONVEX_URL`, the example falls back to the in-process Convex test harness.
155
+ Uploads are stored via Transloadit directly into Cloudflare R2.
156
+ The client wiring uses the `useTransloaditUppy` hook from `@transloadit/convex/react` to keep Uppy + polling in sync.
184
157
 
185
- ```tsx
186
- import { useAssemblyStatus, useTransloaditFiles } from "@transloadit/convex/react";
187
- import { api } from "../convex/_generated/api";
158
+ Live demo:
188
159
 
189
- function AssemblyStatus({ assemblyId }: { assemblyId: string }) {
190
- const status = useAssemblyStatus(api.transloadit.getAssemblyStatus, assemblyId);
191
- const results = useTransloaditFiles(api.transloadit.listResults, {
192
- assemblyId,
193
- });
194
-
195
- if (!status) return null;
196
- return (
197
- <div>
198
- <p>Status: {status.ok}</p>
199
- <p>Results: {results?.length ?? 0}</p>
200
- </div>
201
- );
202
- }
160
+ ```
161
+ https://convex-demo.transload.it
203
162
  ```
204
163
 
205
- ### Polling fallback (no webhooks)
164
+ Quick start (local):
206
165
 
207
- ```tsx
208
- import { useAssemblyStatusWithPolling } from "@transloadit/convex/react";
209
- import { api } from "../convex/_generated/api";
166
+ ```bash
167
+ # In repo root
168
+ export TRANSLOADIT_KEY=...
169
+ export TRANSLOADIT_SECRET=...
170
+ export TRANSLOADIT_R2_CREDENTIALS=...
171
+
172
+ # Get a public webhook URL (cloudflared is auto-downloaded if needed)
173
+ yarn tunnel --once
174
+ # Set TRANSLOADIT_NOTIFY_URL to the printed notifyUrl
175
+ export TRANSLOADIT_NOTIFY_URL=...
176
+
177
+ yarn example:dev
178
+ ```
179
+
180
+ If you want the API routes to talk to an existing Convex deployment (bypassing Convex Auth), set:
181
+
182
+ ```bash
183
+ export CONVEX_URL=...
184
+ export CONVEX_ADMIN_KEY=...
185
+ ```
210
186
 
211
- const status = useAssemblyStatusWithPolling(
212
- api.transloadit.getAssemblyStatus,
213
- api.transloadit.refreshAssembly,
214
- assemblyId,
215
- { pollIntervalMs: 5000, stopOnTerminal: true },
216
- );
187
+ The example exposes `POST /transloadit/webhook` and forwards webhooks into Convex via `queueWebhook`.
188
+ Realtime “new upload” toasts use a Convex subscription on recent assemblies.
189
+ The demo also applies a simple per-user upload limit in the Convex backend (see `example/convex/wedding.ts`).
190
+
191
+ ### Storage (required R2 persistence)
192
+
193
+ The example uses the `/cloudflare/store` robot to write processed files into Cloudflare R2. Configure one of these:
194
+
195
+ ```bash
196
+ # Option A: Transloadit template credentials (recommended)
197
+ export TRANSLOADIT_R2_CREDENTIALS=...
198
+
199
+ # Option B: supply R2 details directly
200
+ export R2_BUCKET=...
201
+ export R2_ACCESS_KEY_ID=...
202
+ export R2_SECRET_ACCESS_KEY=...
203
+ export R2_ACCOUNT_ID=... # or R2_HOST
204
+ export R2_PUBLIC_URL=... # optional public URL prefix
217
205
  ```
218
206
 
219
- ## Example app
207
+ The UI hides older items based on `NEXT_PUBLIC_GALLERY_RETENTION_HOURS` (default: 24) to discourage spam/abuse.
208
+ The demo bucket auto-expires objects after 1 day via an R2 lifecycle rule (reapply with `yarn r2:lifecycle` or override with `R2_RETENTION_DAYS`).
209
+ Preview deployments reset data on each deploy. The demo is built with
210
+ [`@transloadit/convex`](https://github.com/transloadit/convex) and
211
+ [Transloadit](https://transloadit.com/).
212
+ If you set `WEDDING_UPLOAD_CODE` on the Convex deployment, guests must enter the passcode before uploads can start.
213
+
214
+ ### Deploy the example (Vercel + stable Convex)
215
+
216
+ For a public demo, deploy the `example/` app and point it at a stable Convex deployment.
217
+
218
+ 1. Deploy a Convex app that includes this component (stable/prod deployment).
219
+ 2. Set Vercel environment variables for the project:
220
+ - `NEXT_PUBLIC_CONVEX_URL` (point to the stable Convex deployment)
221
+ - `NEXT_PUBLIC_GALLERY_RETENTION_HOURS` (optional)
222
+ 3. Set Convex environment variables on the deployment:
223
+ - `TRANSLOADIT_KEY` and `TRANSLOADIT_SECRET`
224
+ - `TRANSLOADIT_NOTIFY_URL` (set to `https://<deployment>.convex.site/transloadit/webhook`)
225
+ - R2 credentials (see above)
226
+ - `WEDDING_UPLOAD_CODE` (optional passcode for uploads)
227
+ 4. Trigger the Vercel deploy hook (or deploy manually).
220
228
 
221
- The `example/` directory contains a minimal Vite + React app wired to the component.
229
+ To deploy a stable Convex backend for the demo (once per environment), run:
222
230
 
223
231
  ```bash
224
- cd example
225
- yarn install
226
- npx convex dev
227
- # In another terminal:
228
- yarn dev
232
+ export CONVEX_DEPLOY_KEY=...
233
+ export TRANSLOADIT_KEY=...
234
+ export TRANSLOADIT_SECRET=...
235
+
236
+ yarn deploy:cloud
229
237
  ```
230
238
 
231
- Set environment variables in Convex:
239
+ Once deployed, use the Vercel URL as `E2E_REMOTE_APP_URL` for `yarn verify:cloud`.
240
+ CI expects a stable Vercel production URL in the `E2E_REMOTE_APP_URL` secret on `main`.
241
+
242
+ ### Demo cleanup (Convex + R2)
243
+
244
+ To remove demo uploads from Convex and Cloudflare R2, run:
232
245
 
233
246
  ```bash
234
- npx convex env set TRANSLOADIT_KEY <your_auth_key>
235
- npx convex env set TRANSLOADIT_SECRET <your_auth_secret>
247
+ yarn demo:cleanup
236
248
  ```
237
249
 
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.
250
+ This requires:
251
+
252
+ - `CONVEX_URL`
253
+ - `CONVEX_ADMIN_KEY`
254
+ - `R2_BUCKET`
255
+ - `R2_ACCESS_KEY_ID`
256
+ - `R2_SECRET_ACCESS_KEY`
257
+ - `R2_ACCOUNT_ID` or `R2_HOST`
258
+
259
+ Optional:
260
+
261
+ - `DEMO_ALBUM` (defaults to `wedding-gallery`)
262
+ - `--dry-run` (prints the counts without deleting)
263
+
264
+ Note: the demo bucket is configured to auto-expire objects after 1 day via `yarn r2:lifecycle`.
239
265
 
240
266
  ## Verification and QA
241
267
 
@@ -245,18 +271,29 @@ Fast checks:
245
271
  yarn check
246
272
  ```
247
273
 
248
- This runs format, lint, typecheck, and unit tests. Additional commands:
274
+ This runs format, lint, typecheck, and unit tests. For a full verification run:
275
+
276
+ ```bash
277
+ yarn verify
278
+ ```
279
+
280
+ Additional commands:
249
281
 
250
282
  - `yarn lint` (Biome)
251
283
  - `yarn format` (Biome write)
252
284
  - `yarn typecheck` (tsc)
253
285
  - `yarn test` (Vitest unit tests)
254
- - `yarn test:browser` (browser + webhook QA flow)
286
+ - `yarn verify:local` (runs the Next.js wedding example + uploads an image + video)
287
+ - `yarn verify:cloud` (runs the browser flow against a deployed Next.js app)
288
+ - `yarn deploy:cloud` (deploys a stable Convex backend for the demo app)
255
289
  - `yarn build` (tsc build + emit package json)
256
290
 
257
291
  Notes:
258
- - `yarn template:ensure` and `yarn tunnel` are support tools, not verification.
292
+ - `yarn tunnel` is a support tool, not verification.
259
293
  - CI should run non-mutating checks; local `yarn check` may format/fix.
294
+ - `yarn verify:local` needs `TRANSLOADIT_KEY`, `TRANSLOADIT_SECRET`, `TRANSLOADIT_NOTIFY_URL`, and R2 credentials.
295
+ - `yarn verify:cloud` needs `E2E_REMOTE_APP_URL`.
296
+ - Set `TRANSLOADIT_DEBUG=1` to enable verbose verify logs.
260
297
 
261
298
  ## Component test helpers
262
299
 
@@ -274,7 +311,7 @@ const t = createTransloaditTest();
274
311
 
275
312
  ## Release process
276
313
 
277
- Releases are automated via GitHub Actions and published to npm using OIDC (Trusted Publisher).
314
+ Releases are automated via Changesets + GitHub Actions and published to npm using OIDC (Trusted Publisher).
278
315
 
279
316
  1. Ensure CI is green on `main`.
280
317
  2. Run local checks:
@@ -283,36 +320,31 @@ Releases are automated via GitHub Actions and published to npm using OIDC (Trust
283
320
  yarn check
284
321
  ```
285
322
 
286
- 3. Update `package.json` version and commit it:
323
+ 3. Add a changeset describing the release:
287
324
 
288
325
  ```bash
289
- git checkout main
290
- git pull
291
- # edit package.json version, then:
292
- git add package.json
326
+ yarn changeset
327
+ ```
328
+
329
+ 4. Apply the version bump + changelog updates:
330
+
331
+ ```bash
332
+ yarn changeset:version
333
+ git add package.json CHANGELOG.md
293
334
  git commit -m "Release vX.Y.Z"
294
335
  git push
295
336
  ```
296
337
 
297
- 4. Tag and push the release:
338
+ 5. Tag and push the release:
298
339
 
299
340
  ```bash
300
341
  git tag vX.Y.Z
301
342
  git push origin vX.Y.Z
302
343
  ```
303
344
 
304
- 5. The `Publish to npm` workflow will:
345
+ 6. The publish workflow will:
305
346
  - build and pack a `.tgz` artifact,
306
347
  - create a draft GitHub release,
307
348
  - publish the tarball to npm with provenance.
308
349
 
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
315
-
316
- - Convex components authoring guide
317
- - Convex official components (e.g. Resend, Aggregate)
318
- - Transloadit API docs (assembly status + resumable uploads)
350
+ Note: This package is 0.x, so breaking changes are allowed. Use changesets to document them clearly.
@@ -1,9 +1,18 @@
1
- import type { AssemblyStatus } from "@transloadit/types/assemblyStatus";
2
- import type { AssemblyInstructionsInput } from "@transloadit/types/template";
1
+ import type { AssemblyStatus } from "@transloadit/zod/v3/assemblyStatus";
2
+ import type { AssemblyInstructionsInput } from "@transloadit/zod/v3/template";
3
3
  import { type Infer } from "convex/values";
4
- import type { ComponentApi } from "../component/_generated/component.js";
5
- import type { RunActionCtx, RunMutationCtx, RunQueryCtx } from "./types.js";
6
- export { parseTransloaditWebhook } from "../component/apiUtils.js";
4
+ import type { ComponentApi } from "../component/_generated/component.ts";
5
+ import type { RunActionCtx, RunMutationCtx, RunQueryCtx } from "./types.ts";
6
+ export { assemblyStatusErrCodeSchema, assemblyStatusOkCodeSchema, assemblyStatusResultsSchema, assemblyStatusSchema, isAssemblyBusy, isAssemblyBusyStatus, isAssemblyErrorStatus, isAssemblyOkStatus, isAssemblySysError, isAssemblyTerminal, isAssemblyTerminalError, isAssemblyTerminalOk, isAssemblyTerminalOkStatus, } from "@transloadit/zod/v3/assemblyStatus";
7
+ export type { ParsedWebhookRequest, VerifiedWebhookRequest, WebhookActionArgs, } from "../component/apiUtils.ts";
8
+ export { buildWebhookQueueArgs, handleWebhookRequest, parseAndVerifyTransloaditWebhook, parseTransloaditWebhook, } from "../component/apiUtils.ts";
9
+ export type { NormalizedAssemblyUrls, TransloaditAssembly, } from "../shared/assemblyUrls.ts";
10
+ export { ASSEMBLY_STATUS_COMPLETED, ASSEMBLY_STATUS_UPLOADING, getAssemblyStage, isAssemblyCompletedStatus, isAssemblyUploadingStatus, normalizeAssemblyUploadUrls, parseAssemblyFields, parseAssemblyResults, parseAssemblyStatus, parseAssemblyUrls, } from "../shared/assemblyUrls.ts";
11
+ export { pollAssembly } from "../shared/pollAssembly.ts";
12
+ export type { ImageResizeResult, ResultByRobot, ResultForRobot, StoreResult, TransloaditResult, VideoEncodeResult, VideoThumbsResult, } from "../shared/resultTypes.ts";
13
+ export { getResultOriginalKey, getResultUrl, } from "../shared/resultUtils.ts";
14
+ export type { TusMetadataOptions, TusUploadConfig, } from "../shared/tusUpload.ts";
15
+ export { buildTusUploadConfig } from "../shared/tusUpload.ts";
7
16
  export type { AssemblyStatus, AssemblyInstructionsInput };
8
17
  export interface TransloaditConfig {
9
18
  authKey: string;
@@ -49,11 +58,13 @@ export declare const vAssemblyResponse: import("convex/values").VObject<{
49
58
  }, "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}`>;
50
59
  export type AssemblyResponse = Infer<typeof vAssemblyResponse>;
51
60
  export declare const vAssemblyResultResponse: import("convex/values").VObject<{
61
+ userId?: string | undefined;
62
+ album?: string | undefined;
63
+ mime?: string | undefined;
52
64
  name?: string | undefined;
53
- resultId?: string | undefined;
54
- sslUrl?: string | undefined;
55
65
  size?: number | undefined;
56
- mime?: string | undefined;
66
+ sslUrl?: string | undefined;
67
+ resultId?: string | undefined;
57
68
  assemblyId: string;
58
69
  raw: any;
59
70
  stepName: string;
@@ -64,6 +75,8 @@ export declare const vAssemblyResultResponse: import("convex/values").VObject<{
64
75
  _id: import("convex/values").VString<string, "required">;
65
76
  _creationTime: import("convex/values").VFloat64<number, "required">;
66
77
  assemblyId: import("convex/values").VString<string, "required">;
78
+ album: import("convex/values").VString<string | undefined, "optional">;
79
+ userId: import("convex/values").VString<string | undefined, "optional">;
67
80
  stepName: import("convex/values").VString<string, "required">;
68
81
  resultId: import("convex/values").VString<string | undefined, "optional">;
69
82
  sslUrl: import("convex/values").VString<string | undefined, "optional">;
@@ -72,7 +85,7 @@ export declare const vAssemblyResultResponse: import("convex/values").VObject<{
72
85
  mime: import("convex/values").VString<string | undefined, "optional">;
73
86
  raw: import("convex/values").VAny<any, "required", string>;
74
87
  createdAt: import("convex/values").VFloat64<number, "required">;
75
- }, "required", "assemblyId" | "raw" | "stepName" | "name" | "_id" | "_creationTime" | "createdAt" | `raw.${string}` | "resultId" | "sslUrl" | "size" | "mime">;
88
+ }, "required", "assemblyId" | "raw" | "userId" | "stepName" | "album" | "mime" | "name" | "size" | "sslUrl" | "resultId" | "_id" | "_creationTime" | "createdAt" | `raw.${string}`>;
76
89
  export type AssemblyResultResponse = Infer<typeof vAssemblyResultResponse>;
77
90
  export declare const vCreateAssemblyArgs: import("convex/values").VObject<{
78
91
  templateId?: string | undefined;
@@ -93,6 +106,9 @@ export declare const vCreateAssemblyArgs: import("convex/values").VObject<{
93
106
  additionalParams: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
94
107
  userId: import("convex/values").VString<string | undefined, "optional">;
95
108
  }, "required", "templateId" | "notifyUrl" | "numExpectedUploadFiles" | "fields" | "userId" | "steps" | "expires" | "additionalParams" | `fields.${string}` | `steps.${string}` | `additionalParams.${string}`>;
109
+ /**
110
+ * @deprecated Prefer `makeTransloaditAPI` or `Transloadit` for new code.
111
+ */
96
112
  export declare class TransloaditClient {
97
113
  component: TransloaditComponent;
98
114
  config: TransloaditConfig;
@@ -139,6 +155,10 @@ export declare class TransloaditClient {
139
155
  stepName?: string;
140
156
  limit?: number;
141
157
  }): Promise<any[]>;
158
+ listAlbumResults(ctx: RunQueryCtx, args: {
159
+ album: string;
160
+ limit?: number;
161
+ }): Promise<any[]>;
142
162
  storeAssemblyMetadata(ctx: RunMutationCtx, args: {
143
163
  assemblyId: string;
144
164
  userId?: string;
@@ -161,7 +181,6 @@ export declare class TransloaditClient {
161
181
  handleWebhook: import("convex/server").RegisteredAction<"public", {
162
182
  rawBody?: string | undefined;
163
183
  signature?: string | undefined;
164
- verifySignature?: boolean | undefined;
165
184
  payload: any;
166
185
  }, Promise<{
167
186
  assemblyId: string;
@@ -172,7 +191,6 @@ export declare class TransloaditClient {
172
191
  queueWebhook: import("convex/server").RegisteredAction<"public", {
173
192
  rawBody?: string | undefined;
174
193
  signature?: string | undefined;
175
- verifySignature?: boolean | undefined;
176
194
  payload: any;
177
195
  }, Promise<{
178
196
  assemblyId: string;
@@ -199,6 +217,17 @@ export declare class TransloaditClient {
199
217
  stepName?: string | undefined;
200
218
  assemblyId: string;
201
219
  }, Promise<any[]>>;
220
+ listAlbumResults: import("convex/server").RegisteredQuery<"public", {
221
+ limit?: number | undefined;
222
+ album: string;
223
+ }, Promise<any[]>>;
224
+ purgeAlbum: import("convex/server").RegisteredMutation<"public", {
225
+ deleteAssemblies?: boolean | undefined;
226
+ album: string;
227
+ }, Promise<{
228
+ deletedResults: number;
229
+ deletedAssemblies: number;
230
+ }>>;
202
231
  storeAssemblyMetadata: import("convex/server").RegisteredMutation<"public", {
203
232
  fields?: Record<string, any> | undefined;
204
233
  userId?: string | undefined;
@@ -208,6 +237,9 @@ export declare class TransloaditClient {
208
237
  }
209
238
  export declare class Transloadit extends TransloaditClient {
210
239
  }
240
+ /**
241
+ * @deprecated Prefer `new Transloadit(...)` or `makeTransloaditAPI(...)`.
242
+ */
211
243
  export declare function createTransloadit(component: TransloaditComponent, config?: Partial<TransloaditConfig>): Transloadit;
212
244
  export declare function makeTransloaditAPI(component: TransloaditComponent, config?: Partial<TransloaditConfig>): {
213
245
  createAssembly: import("convex/server").RegisteredAction<"public", {
@@ -226,7 +258,6 @@ export declare function makeTransloaditAPI(component: TransloaditComponent, conf
226
258
  handleWebhook: import("convex/server").RegisteredAction<"public", {
227
259
  rawBody?: string | undefined;
228
260
  signature?: string | undefined;
229
- verifySignature?: boolean | undefined;
230
261
  payload: any;
231
262
  }, Promise<{
232
263
  assemblyId: string;
@@ -237,7 +268,6 @@ export declare function makeTransloaditAPI(component: TransloaditComponent, conf
237
268
  queueWebhook: import("convex/server").RegisteredAction<"public", {
238
269
  rawBody?: string | undefined;
239
270
  signature?: string | undefined;
240
- verifySignature?: boolean | undefined;
241
271
  payload: any;
242
272
  }, Promise<{
243
273
  assemblyId: string;
@@ -264,6 +294,17 @@ export declare function makeTransloaditAPI(component: TransloaditComponent, conf
264
294
  stepName?: string | undefined;
265
295
  assemblyId: string;
266
296
  }, Promise<any[]>>;
297
+ listAlbumResults: import("convex/server").RegisteredQuery<"public", {
298
+ limit?: number | undefined;
299
+ album: string;
300
+ }, Promise<any[]>>;
301
+ purgeAlbum: import("convex/server").RegisteredMutation<"public", {
302
+ deleteAssemblies?: boolean | undefined;
303
+ album: string;
304
+ }, Promise<{
305
+ deletedResults: number;
306
+ deletedAssemblies: number;
307
+ }>>;
267
308
  storeAssemblyMetadata: import("convex/server").RegisteredMutation<"public", {
268
309
  fields?: Record<string, any> | undefined;
269
310
  userId?: string | undefined;
@@ -1 +1 @@
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,YA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiHpC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAE9E,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,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gCAAgC,EAChC,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,GA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