@transloadit/convex 0.0.5 → 0.0.6

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 (2) hide show
  1. package/README.md +6 -196
  2. package/package.json +3 -1
package/README.md CHANGED
@@ -80,7 +80,7 @@ assemblies 1 ──── * results
80
80
  ```
81
81
 
82
82
  - `assemblies`: one row per Transloadit Assembly (status/ok, notify URL, uploads, raw payload, etc).
83
- - `results`: one row per output file, keyed by `assemblyId` + `stepName`, plus normalized fields (name/size/mime/url) and the raw Transloadit output object.
83
+ - `results`: one row per output file, grouped by `assemblyId` + `stepName` (a step can yield multiple rows). Each row includes normalized fields (name/size/mime/url), optional `resultId`, and the raw Transloadit output object.
84
84
 
85
85
  Lifecycle:
86
86
  1. `createAssembly` inserts the initial `assemblies` row.
@@ -151,200 +151,10 @@ For advanced/legacy helpers (raw parsing, low-level tus uploads, polling utiliti
151
151
 
152
152
  ## Example app (Next.js + Uppy wedding gallery)
153
153
 
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.
154
+ The `example/` app is a wedding gallery where guests upload photos + short videos. It uses Uppy on
155
+ the client and Convex Auth (anonymous sign-in) to create assemblies securely. Uploads are stored via
156
+ Transloadit directly into Cloudflare R2.
157
157
 
158
- Live demo:
158
+ Live demo: `https://convex-demo.transload.it`
159
159
 
160
- ```
161
- https://convex-demo.transload.it
162
- ```
163
-
164
- Quick start (local):
165
-
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
- ```
186
-
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
205
- ```
206
-
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).
228
-
229
- To deploy a stable Convex backend for the demo (once per environment), run:
230
-
231
- ```bash
232
- export CONVEX_DEPLOY_KEY=...
233
- export TRANSLOADIT_KEY=...
234
- export TRANSLOADIT_SECRET=...
235
-
236
- yarn deploy:cloud
237
- ```
238
-
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:
245
-
246
- ```bash
247
- yarn demo:cleanup
248
- ```
249
-
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`.
265
-
266
- ## Verification and QA
267
-
268
- Fast checks:
269
-
270
- ```bash
271
- yarn check
272
- ```
273
-
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:
281
-
282
- - `yarn lint` (Biome)
283
- - `yarn format` (Biome write)
284
- - `yarn typecheck` (tsc)
285
- - `yarn test` (Vitest unit tests)
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)
289
- - `yarn build` (tsc build + emit package json)
290
-
291
- Notes:
292
- - `yarn tunnel` is a support tool, not verification.
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.
297
-
298
- ## Component test helpers
299
-
300
- For `convex-test`, you can use the built-in helper:
301
-
302
- ```ts
303
- import { createTransloaditTest } from "@transloadit/convex/test";
304
-
305
- const t = createTransloaditTest();
306
- ```
307
-
308
- ## Generated files
309
-
310
- `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.
311
-
312
- ## Release process
313
-
314
- Releases are automated via Changesets + GitHub Actions and published to npm using OIDC (Trusted Publisher).
315
-
316
- 1. Ensure CI is green on `main`.
317
- 2. Run local checks:
318
-
319
- ```bash
320
- yarn check
321
- ```
322
-
323
- 3. Add a changeset describing the release:
324
-
325
- ```bash
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
334
- git commit -m "Release vX.Y.Z"
335
- git push
336
- ```
337
-
338
- 5. Tag and push the release:
339
-
340
- ```bash
341
- git tag vX.Y.Z
342
- git push origin vX.Y.Z
343
- ```
344
-
345
- 6. The publish workflow will:
346
- - build and pack a `.tgz` artifact,
347
- - create a draft GitHub release,
348
- - publish the tarball to npm with provenance.
349
-
350
- Note: This package is 0.x, so breaking changes are allowed. Use changesets to document them clearly.
160
+ For setup, deployment, and verification details, see `CONTRIBUTING.md`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@transloadit/convex",
3
3
  "description": "Transloadit component for Convex",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@4.5.0",
7
7
  "repository": {
@@ -35,6 +35,7 @@
35
35
  "verify:convex": "yarn verify:cloud",
36
36
  "deploy:cloud": "node scripts/deploy-cloud.ts",
37
37
  "demo:cleanup": "node scripts/cleanup-demo.ts",
38
+ "demo:media": "node scripts/generate-demo-media.ts",
38
39
  "example:dev": "yarn build && node ./node_modules/next/dist/bin/next dev example",
39
40
  "example:build": "yarn build && node ./node_modules/next/dist/bin/next build example",
40
41
  "example:start": "yarn build && node ./node_modules/next/dist/bin/next start example",
@@ -102,6 +103,7 @@
102
103
  "@changesets/cli": "^2.29.8",
103
104
  "@convex-dev/auth": "^0.0.90",
104
105
  "@edge-runtime/vm": "^5.0.0",
106
+ "@fal-ai/client": "^1.8.4",
105
107
  "@playwright/test": "^1.57.0",
106
108
  "@testing-library/dom": "^10.4.1",
107
109
  "@testing-library/react": "^16.3.0",