@vantageos/convex-doc-forge 0.1.1 → 0.1.2
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/CHANGELOG.md +15 -0
- package/README.md +60 -0
- package/dist/mutations.d.ts +2 -0
- package/dist/mutations.d.ts.map +1 -1
- package/dist/mutations.js +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this package follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) + [SemVer](https://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [0.1.2] - 2026-06-19
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `mutations.ts`: public `generate_upload_url` mutation — enables host apps / consumers to upload a template binary into the component storage namespace, then register it via `upsert_template`. Unblocks `render_now` E2E and template upload (Marie/Iris RH critical path).
|
|
10
|
+
- Takes no args, returns `v.string()` (signed upload URL).
|
|
11
|
+
- Pure addition, no breaking change, `peerDependencies.convex` unchanged (`>=1.17.0`).
|
|
12
|
+
- V8-pure: no `"use node"`, no `node:*` imports (component constraint).
|
|
13
|
+
- `scripts/smoke-render.md`: canonical, reusable fleet smoke harness documenting the full upload→upsert→render CLI sequence.
|
|
14
|
+
|
|
15
|
+
### Notes
|
|
16
|
+
|
|
17
|
+
- Discovered via consumer-1 dogfood (Omega install on vibrant-ibex-858): `upsert_template` required `asset_storage_id: v.id("_storage")` but there was no public path for a consumer to obtain a storage ID in the component namespace.
|
|
18
|
+
- tsc: 0 errors. Test ratio: 31/31 PASS.
|
|
19
|
+
|
|
5
20
|
## [0.1.1] - 2026-06-19
|
|
6
21
|
|
|
7
22
|
### Fixed
|
package/README.md
CHANGED
|
@@ -122,6 +122,66 @@ docForge.actions.render_now({
|
|
|
122
122
|
|
|
123
123
|
---
|
|
124
124
|
|
|
125
|
+
## Asset ingestion
|
|
126
|
+
|
|
127
|
+
Before calling `upsert_template`, the host app must upload the `.docx`/`.pptx` binary into the component's isolated storage namespace and obtain a `storageId`. The three-step flow:
|
|
128
|
+
|
|
129
|
+
**Step 1 — get a signed upload URL** (from a host app action):
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
// convex/myActions.ts
|
|
133
|
+
import { action } from "./_generated/server";
|
|
134
|
+
import { components } from "./_generated/api";
|
|
135
|
+
|
|
136
|
+
export const getDocForgeUploadUrl = action({
|
|
137
|
+
args: {},
|
|
138
|
+
handler: async (ctx) =>
|
|
139
|
+
await ctx.runMutation(components.docForge.mutations.generate_upload_url, {}),
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Step 2 — POST the raw bytes to the signed URL**:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
curl -X POST "<uploadUrl>" \
|
|
147
|
+
-H "Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document" \
|
|
148
|
+
--data-binary @template.docx
|
|
149
|
+
# → { "storageId": "kg2abc..." }
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Step 3 — register the asset as a template** and then render:
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
const templateId = await ctx.runMutation(
|
|
156
|
+
components.docForge.mutations.upsert_template,
|
|
157
|
+
{
|
|
158
|
+
name: "proposition-audit",
|
|
159
|
+
team: "iris-rh",
|
|
160
|
+
tenant_id: "org_clerk_abc",
|
|
161
|
+
renderer_kind: "docxtpl",
|
|
162
|
+
input_schema: { type: "object", properties: { client_name: { type: "string" } } },
|
|
163
|
+
asset_storage_id: storageId, // from step 2
|
|
164
|
+
output_formats: ["pdf", "docx"],
|
|
165
|
+
version: "1.0.0",
|
|
166
|
+
createdBy: "clerk_user_id",
|
|
167
|
+
},
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// Now render_now works end-to-end:
|
|
171
|
+
const result = await ctx.runAction(components.docForge.actions.render_now, {
|
|
172
|
+
template_id: templateId,
|
|
173
|
+
context: { client_name: "Iris RH" },
|
|
174
|
+
output_format: "pdf",
|
|
175
|
+
actor: "clerk_user_id",
|
|
176
|
+
source: "manual",
|
|
177
|
+
});
|
|
178
|
+
// → { output_url, render_job_id, duration_ms }
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
See `scripts/smoke-render.md` in this repo for the full copy-paste fleet smoke harness.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
125
185
|
## Renderer contract
|
|
126
186
|
|
|
127
187
|
`render_now` calls the sidecar:
|
package/dist/mutations.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare function failRenderJobHandler(ctx: AnyCtx, args: {
|
|
|
29
29
|
job_id: Id<"render_jobs">;
|
|
30
30
|
error: string;
|
|
31
31
|
}): Promise<null>;
|
|
32
|
+
export declare function generateUploadUrlHandler(ctx: AnyCtx): Promise<string>;
|
|
32
33
|
export declare function writeAuditHandler(ctx: AnyCtx, args: {
|
|
33
34
|
render_job_id: Id<"render_jobs">;
|
|
34
35
|
tenant_id: string;
|
|
@@ -40,6 +41,7 @@ export declare function writeAuditHandler(ctx: AnyCtx, args: {
|
|
|
40
41
|
actor: string;
|
|
41
42
|
source: "manual" | "workflow" | "agent";
|
|
42
43
|
}): Promise<Id<"render_audit">>;
|
|
44
|
+
export declare const generate_upload_url: import("convex/server").RegisteredMutation<"public", {}, Promise<string>>;
|
|
43
45
|
export declare const upsert_template: import("convex/server").RegisteredMutation<"public", {
|
|
44
46
|
name: string;
|
|
45
47
|
team: string;
|
package/dist/mutations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../src/mutations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAIjD,KAAK,MAAM,GAAG,GAAG,CAAC;AAMlB,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,IAA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GAAG,OAAO,CAAC;CACzC,GACA,OAAO,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAK7B;AAMD,eAAO,MAAM,mBAAmB,2EAI9B,CAAC;AAEH,eAAO,MAAM,eAAe;UA9JlB,MAAM;UACN,MAAM;eACD,MAAM;mBACF,SAAS,GAAG,aAAa,GAAG,aAAa;kBAC1C,OAAO;sBACH,EAAE,CAAC,UAAU,CAAC;oBAChB,MAAM,EAAE;eACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;aACxB,MAAM;eACJ,MAAM;4BAwKnB,CAAC;AAEH,eAAO,MAAM,YAAY;iBAxHR,EAAE,CAAC,WAAW,CAAC;aACnB,OAAO;mBACD,MAAM;eACV,MAAM;8BA8HnB,CAAC;AAEH,eAAO,MAAM,kBAAkB;YAtGb,EAAE,CAAC,aAAa,CAAC;iBA0GjC,CAAC;AAEH,eAAO,MAAM,oBAAoB;YAlGf,EAAE,CAAC,aAAa,CAAC;uBAAqB,EAAE,CAAC,UAAU,CAAC;iBAyGpE,CAAC;AAEH,eAAO,MAAM,gBAAgB;YA7FX,EAAE,CAAC,aAAa,CAAC;WAAS,MAAM;iBAoGhD,CAAC;AAEH,eAAO,MAAM,YAAY;mBAnFN,EAAE,CAAC,aAAa,CAAC;eACrB,MAAM;iBACJ,EAAE,CAAC,WAAW,CAAC;sBACV,MAAM;kBACV,MAAM;uBACD,MAAM;gBACb,MAAM;WACX,MAAM;YACL,QAAQ,GAAG,UAAU,GAAG,OAAO;+BA6FzC,CAAC"}
|
package/dist/mutations.js
CHANGED
|
@@ -93,6 +93,9 @@ export async function failRenderJobHandler(ctx, args) {
|
|
|
93
93
|
});
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
|
+
export async function generateUploadUrlHandler(ctx) {
|
|
97
|
+
return await ctx.storage.generateUploadUrl();
|
|
98
|
+
}
|
|
96
99
|
export async function writeAuditHandler(ctx, args) {
|
|
97
100
|
return await ctx.db.insert("render_audit", {
|
|
98
101
|
...args,
|
|
@@ -102,6 +105,11 @@ export async function writeAuditHandler(ctx, args) {
|
|
|
102
105
|
// ---------------------------------------------------------------------------
|
|
103
106
|
// Convex registrations
|
|
104
107
|
// ---------------------------------------------------------------------------
|
|
108
|
+
export const generate_upload_url = mutation({
|
|
109
|
+
args: {},
|
|
110
|
+
returns: v.string(),
|
|
111
|
+
handler: generateUploadUrlHandler,
|
|
112
|
+
});
|
|
105
113
|
export const upsert_template = mutation({
|
|
106
114
|
args: {
|
|
107
115
|
name: v.string(),
|