convex-mux-component 0.1.7 → 0.1.8

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 +10 -53
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -26,21 +26,7 @@ This package gives you:
26
26
  npm i convex-mux-component convex-mux-init @mux/mux-node
27
27
  ```
28
28
 
29
- ## 2) Mount the component
30
-
31
- Create or update `convex/convex.config.ts`:
32
-
33
- ```ts
34
- import { defineApp } from "convex/server";
35
- import mux from "convex-mux-component/convex.config.js";
36
-
37
- const app = defineApp();
38
- app.use(mux, { name: "mux" });
39
-
40
- export default app;
41
- ```
42
-
43
- ## 3) Generate app-level wrappers
29
+ ## 2) Generate app-level Convex files
44
30
 
45
31
  ```sh
46
32
  npx convex-mux-init --component-name mux
@@ -48,57 +34,28 @@ npx convex-mux-init --component-name mux
48
34
 
49
35
  This creates:
50
36
 
37
+ - `convex/convex.config.ts`
51
38
  - `convex/migrations.ts`
52
39
  - `convex/muxWebhook.node.ts`
40
+ - `convex/http.ts`
53
41
 
54
- ## 4) Add webhook HTTP route
55
-
56
- Create or update `convex/http.ts`:
57
-
58
- ```ts
59
- import { httpRouter } from "convex/server";
60
- import { httpAction } from "./_generated/server";
61
- import { internal } from "./_generated/api";
62
-
63
- const http = httpRouter();
64
-
65
- http.route({
66
- path: "/mux/webhook",
67
- method: "POST",
68
- handler: httpAction(async (ctx, request) => {
69
- const rawBody = await request.text();
70
- const headers: Record<string, string> = {};
71
- request.headers.forEach((value, key) => {
72
- headers[key] = value;
73
- });
74
- const result = await ctx.runAction(internal.muxWebhook.ingestMuxWebhook, {
75
- rawBody,
76
- headers,
77
- });
78
- return new Response(JSON.stringify(result), {
79
- headers: { "content-type": "application/json" },
80
- });
81
- }),
82
- });
83
-
84
- export default http;
85
- ```
42
+ If files already exist, the CLI skips them unless you pass `--force`.
86
43
 
87
- ## 5) Set Mux API env vars in Convex
44
+ ## 3) Set Mux API env vars in Convex
88
45
 
89
46
  ```sh
90
47
  npx convex env set MUX_TOKEN_ID <your_mux_token_id>
91
48
  npx convex env set MUX_TOKEN_SECRET <your_mux_token_secret>
92
49
  ```
93
50
 
94
- ## 6) Start Convex and run backfill
51
+ ## 4) Start Convex and run backfill
95
52
 
96
53
  ```sh
97
54
  npx convex dev
98
55
  npx convex run migrations:backfillMux '{}'
99
56
  ```
100
57
 
101
- ## 7) Configure Mux webhook endpoint
58
+ ## 5) Configure Mux webhook endpoint
102
59
 
103
60
  In Mux dashboard, create a webhook endpoint:
104
61
 
@@ -111,7 +68,7 @@ Copy the webhook signing secret and set it in Convex:
111
68
  npx convex env set MUX_WEBHOOK_SECRET <your_mux_webhook_secret>
112
69
  ```
113
70
 
114
- ## 8) Verify data in Convex dashboard
71
+ ## 6) Verify data in Convex dashboard
115
72
 
116
73
  Tables to check:
117
74
 
@@ -168,8 +125,8 @@ npx convex run --prod migrations:backfillMux '{"maxAssets":500}'
168
125
  Use this order when automating setup:
169
126
 
170
127
  1. `npm i convex-mux-component convex-mux-init @mux/mux-node`
171
- 2. Ensure `convex/convex.config.ts` mounts `convex-mux-component/convex.config.js`
172
- 3. Run `npx convex-mux-init --component-name <mounted_name> --force`
128
+ 2. Run `npx convex-mux-init --component-name <mounted_name> --force`
129
+ 3. Ensure `convex/convex.config.ts` mounts `convex-mux-component/convex.config.js` with the same `<mounted_name>`
173
130
  4. Ensure `convex/http.ts` routes `POST /mux/webhook` to `internal.muxWebhook.ingestMuxWebhook`
174
131
  5. Set `MUX_TOKEN_ID` and `MUX_TOKEN_SECRET`
175
132
  6. Run `npx convex dev`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "convex-mux-component",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Convex Component for syncing Mux video data and app metadata.",
5
5
  "type": "module",
6
6
  "keywords": [