@hubfluencer/mcp 0.2.0 → 0.4.0

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/src/uploads.ts CHANGED
@@ -365,5 +365,30 @@ export async function uploadImageFile(
365
365
  return { s3_key };
366
366
  }
367
367
 
368
+ /**
369
+ * Uploads a local image as a short's end-card POSTER. The short poster presign
370
+ * is older than the editor asset presign and uses a different envelope: it takes
371
+ * `{ content_type }` and returns a bare `{ upload_url, s3_key }` (no `data`
372
+ * wrapper, `upload_url` not `presigned_url`, and a single fixed key per short).
373
+ * Kept separate from `uploadImageFile` (which speaks the editor `{data:{...}}`
374
+ * shape) so neither has to branch on the surface. Returns the `s3_key` to thread
375
+ * into `/shorts/:slug/poster/confirm`.
376
+ */
377
+ export async function uploadShortPoster(
378
+ client: HubfluencerClient,
379
+ slug: string,
380
+ filePath: string,
381
+ ): Promise<{ s3_key: string }> {
382
+ const file = await resolveReadPath(filePath, IMAGE_EXT_MIME, MAX_IMAGE_BYTES);
383
+ const presign = await client.post<{ upload_url: string; s3_key: string }>(
384
+ `/shorts/${slug}/poster/presign`,
385
+ { content_type: file.mime },
386
+ );
387
+ const { upload_url, s3_key } = presign;
388
+ const buf = await readFile(file.path);
389
+ await putToPresignedUrl(upload_url, buf, file.mime);
390
+ return { s3_key };
391
+ }
392
+
368
393
  export const LOGO_MAX_BYTES = MAX_LOGO_BYTES;
369
394
  export const IMAGE_MAX_BYTES = MAX_IMAGE_BYTES;