@effing/ffs 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.
@@ -1,6 +1,7 @@
1
- import { C as CacheStorage, H as HttpProxy } from '../proxy-BI8OMQl0.js';
1
+ import { T as TransientStore, H as HttpProxy } from '../proxy-qTA69nOV.js';
2
2
  import { EffieSourceWithType, EffieData, EffieSources } from '@effing/effie';
3
3
  import express from 'express';
4
+ import { Response } from 'undici';
4
5
  import 'stream';
5
6
 
6
7
  type UploadOptions = {
@@ -16,12 +17,25 @@ type RenderJob = {
16
17
  upload?: UploadOptions;
17
18
  createdAt: number;
18
19
  };
20
+ type WarmupAndRenderJob = {
21
+ effie: EffieData<EffieSources>;
22
+ sources: EffieSourceWithType[];
23
+ scale: number;
24
+ upload?: UploadOptions;
25
+ warmupJobId: string;
26
+ renderJobId: string;
27
+ createdAt: number;
28
+ };
19
29
  type ServerContext = {
20
- cacheStorage: CacheStorage;
30
+ transientStore: TransientStore;
21
31
  httpProxy: HttpProxy;
22
32
  baseUrl: string;
23
33
  skipValidation: boolean;
24
- cacheConcurrency: number;
34
+ warmupConcurrency: number;
35
+ warmupBackendBaseUrl?: string;
36
+ renderBackendBaseUrl?: string;
37
+ warmupBackendApiKey?: string;
38
+ renderBackendApiKey?: string;
25
39
  };
26
40
  type SSEEventSender = (event: string, data: object) => void;
27
41
  /**
@@ -55,4 +69,24 @@ declare function createRenderJob(req: express.Request, res: express.Response, ct
55
69
  */
56
70
  declare function streamRenderJob(req: express.Request, res: express.Response, ctx: ServerContext): Promise<void>;
57
71
 
58
- export { type RenderJob, type SSEEventSender, type ServerContext, type UploadOptions, type WarmupJob, createRenderJob, createServerContext, createWarmupJob, purgeCache, streamRenderJob, streamWarmupJob };
72
+ /**
73
+ * POST /warmup-and-render - Create a combined warmup and render job
74
+ * Returns a job ID and URL for SSE streaming
75
+ */
76
+ declare function createWarmupAndRenderJob(req: express.Request, res: express.Response, ctx: ServerContext): Promise<void>;
77
+ /**
78
+ * GET /warmup-and-render/:id - Stream warmup and render progress via SSE
79
+ * Orchestrates warmup (local or remote) followed by render (local or remote)
80
+ */
81
+ declare function streamWarmupAndRenderJob(req: express.Request, res: express.Response, ctx: ServerContext): Promise<void>;
82
+ /**
83
+ * Proxy SSE events from a remote backend, prefixing event names
84
+ */
85
+ declare function proxyRemoteSSE(url: string, sendEvent: SSEEventSender, prefix: string, res: express.Response, headers?: Record<string, string>): Promise<void>;
86
+ /**
87
+ * Proxy a binary stream (e.g., video) from a fetch Response to an Express response.
88
+ * Forwards Content-Type and Content-Length headers.
89
+ */
90
+ declare function proxyBinaryStream(response: Response, res: express.Response): Promise<void>;
91
+
92
+ export { type RenderJob, type SSEEventSender, type ServerContext, type UploadOptions, type WarmupAndRenderJob, type WarmupJob, createRenderJob, createServerContext, createWarmupAndRenderJob, createWarmupJob, proxyBinaryStream, proxyRemoteSSE, purgeCache, streamRenderJob, streamWarmupAndRenderJob, streamWarmupJob };
@@ -1,18 +1,26 @@
1
1
  import {
2
2
  createRenderJob,
3
3
  createServerContext,
4
+ createWarmupAndRenderJob,
4
5
  createWarmupJob,
6
+ proxyBinaryStream,
7
+ proxyRemoteSSE,
5
8
  purgeCache,
6
9
  streamRenderJob,
10
+ streamWarmupAndRenderJob,
7
11
  streamWarmupJob
8
- } from "../chunk-6YHSYHDY.js";
9
- import "../chunk-A7BAW24L.js";
12
+ } from "../chunk-7FMPCMLO.js";
13
+ import "../chunk-J64HSZNQ.js";
10
14
  export {
11
15
  createRenderJob,
12
16
  createServerContext,
17
+ createWarmupAndRenderJob,
13
18
  createWarmupJob,
19
+ proxyBinaryStream,
20
+ proxyRemoteSSE,
14
21
  purgeCache,
15
22
  streamRenderJob,
23
+ streamWarmupAndRenderJob,
16
24
  streamWarmupJob
17
25
  };
18
26
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Readable } from 'stream';
2
2
  import { EffieWebUrl, EffieData, EffieSources } from '@effing/effie';
3
- import { C as CacheStorage, H as HttpProxy } from './proxy-BI8OMQl0.js';
3
+ import { T as TransientStore, H as HttpProxy } from './proxy-qTA69nOV.js';
4
4
 
5
5
  type EffieRendererOptions = {
6
6
  /**
@@ -11,10 +11,10 @@ type EffieRendererOptions = {
11
11
  */
12
12
  allowLocalFiles?: boolean;
13
13
  /**
14
- * Cache storage instance for source lookups.
15
- * If not provided, a shared lazy-initialized cache will be used.
14
+ * Transient store instance for source lookups.
15
+ * If not provided, sources will be fetched directly from network.
16
16
  */
17
- cacheStorage?: CacheStorage;
17
+ transientStore?: TransientStore;
18
18
  /**
19
19
  * HTTP proxy for video/audio URLs.
20
20
  * When provided, HTTP(S) URLs for video/audio inputs will be routed
@@ -27,7 +27,7 @@ declare class EffieRenderer<U extends string = EffieWebUrl> {
27
27
  private effieData;
28
28
  private ffmpegRunner?;
29
29
  private allowLocalFiles;
30
- private cacheStorage?;
30
+ private transientStore?;
31
31
  private httpProxy?;
32
32
  constructor(effieData: EffieData<EffieSources<U>, U>, options?: EffieRendererOptions);
33
33
  private fetchSource;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  EffieRenderer,
3
3
  FFmpegCommand,
4
4
  FFmpegRunner
5
- } from "./chunk-A7BAW24L.js";
5
+ } from "./chunk-J64HSZNQ.js";
6
6
  export {
7
7
  EffieRenderer,
8
8
  FFmpegCommand,
@@ -1,11 +1,15 @@
1
1
  import { Readable } from 'stream';
2
2
 
3
3
  /**
4
- * Cache storage interface
4
+ * Transient store interface for caching sources and storing ephemeral job metadata.
5
5
  */
6
- interface CacheStorage {
7
- /** Store a stream with the given key */
8
- put(key: string, stream: Readable): Promise<void>;
6
+ interface TransientStore {
7
+ /** TTL for cached sources in milliseconds */
8
+ readonly sourceTtlMs: number;
9
+ /** TTL for job metadata in milliseconds */
10
+ readonly jobMetadataTtlMs: number;
11
+ /** Store a stream with the given key and optional TTL override */
12
+ put(key: string, stream: Readable, ttlMs?: number): Promise<void>;
9
13
  /** Get a stream for the given key, or null if not found */
10
14
  getStream(key: string): Promise<Readable | null>;
11
15
  /** Check if a key exists */
@@ -14,8 +18,8 @@ interface CacheStorage {
14
18
  existsMany(keys: string[]): Promise<Map<string, boolean>>;
15
19
  /** Delete a key */
16
20
  delete(key: string): Promise<void>;
17
- /** Store JSON data */
18
- putJson(key: string, data: object): Promise<void>;
21
+ /** Store JSON data with optional TTL override */
22
+ putJson(key: string, data: object, ttlMs?: number): Promise<void>;
19
23
  /** Get JSON data, or null if not found */
20
24
  getJson<T>(key: string): Promise<T | null>;
21
25
  /** Close and cleanup resources */
@@ -65,4 +69,4 @@ declare class HttpProxy {
65
69
  close(): void;
66
70
  }
67
71
 
68
- export { type CacheStorage as C, HttpProxy as H };
72
+ export { HttpProxy as H, type TransientStore as T };