@rendobar/sdk 1.0.0 → 2.1.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/README.md CHANGED
@@ -99,6 +99,44 @@ const logs = await client.jobs.logs("job_abc");
99
99
  const types = await client.jobs.types();
100
100
  ```
101
101
 
102
+ ## Raw FFmpeg
103
+
104
+ Run arbitrary FFmpeg commands in a sandboxed container. Commands are parsed, sanitized (protocol whitelist/blacklist flags blocked), and executed with a clean process environment.
105
+
106
+ Put input URLs directly in `-i` positions — they're extracted automatically and staged via presigned R2 URLs before execution:
107
+
108
+ ```ts
109
+ import { createClient } from "@rendobar/sdk";
110
+
111
+ const client = createClient({ apiKey: process.env.RENDOBAR_API_KEY });
112
+
113
+ const job = await client.jobs.create({
114
+ type: "ffmpeg",
115
+ params: {
116
+ command:
117
+ "ffmpeg -i https://cdn.example.com/source.mp4 " +
118
+ "-vf scale=1280:720 -c:v libx264 -crf 23 output.mp4",
119
+ },
120
+ });
121
+
122
+ const done = await client.jobs.wait(job.id);
123
+ console.log(done.outputUrl);
124
+ ```
125
+
126
+ Prefer named inputs? Pass them in the top-level `inputs` map and reference the keys in the command:
127
+
128
+ ```ts
129
+ await client.jobs.create({
130
+ type: "ffmpeg",
131
+ inputs: { source: "https://cdn.example.com/source.mp4" },
132
+ params: { command: "ffmpeg -i source -vf scale=1280:720 output.mp4" },
133
+ });
134
+ ```
135
+
136
+ Need a typed params object? Import `FfmpegParams` — optional fields (`outputFormat`, `timeout`) have server-side defaults.
137
+
138
+ See the [FFmpeg guide](https://rendobar.com/docs/guides/ffmpeg) for the full security model and supported flags.
139
+
102
140
  ## Billing
103
141
 
104
142
  ```typescript
package/dist/index.cjs CHANGED
@@ -214,6 +214,9 @@ function createJobsResource(request) {
214
214
  async logs(id, options) {
215
215
  return request(`/jobs/${id}/logs`, { signal: options?.signal });
216
216
  },
217
+ async getTimings(id, options) {
218
+ return request(`/jobs/${id}/timings`, { signal: options?.signal });
219
+ },
217
220
  async types(options) {
218
221
  return request("/jobs/types", { signal: options?.signal });
219
222
  }
@@ -385,6 +388,13 @@ function createApiKeysResource(request) {
385
388
  method: "DELETE",
386
389
  signal: options?.signal
387
390
  });
391
+ },
392
+ async update(id, params, options) {
393
+ return request(`/api-keys/${id}`, {
394
+ method: "PATCH",
395
+ body: params,
396
+ signal: options?.signal
397
+ });
388
398
  }
389
399
  };
390
400
  }
package/dist/index.d.cts CHANGED
@@ -2114,11 +2114,11 @@ declare const jobResponseSchema: ZodObject<{
2114
2114
  orgId: ZodString;
2115
2115
  type: ZodString;
2116
2116
  status: ZodString;
2117
- aiPattern: ZodNullable<ZodString>;
2118
2117
  inputs: ZodRecord<ZodString, ZodUnknown>;
2119
2118
  params: ZodRecord<ZodString, ZodUnknown>;
2120
2119
  outputRef: ZodNullable<ZodString>;
2121
2120
  outputUrl: ZodNullable<ZodString>;
2121
+ posterUrl: ZodNullable<ZodString>;
2122
2122
  outputMeta: ZodNullable<ZodRecord<ZodString, ZodUnknown>>;
2123
2123
  errorCode: ZodNullable<ZodString>;
2124
2124
  errorMessage: ZodNullable<ZodString>;
@@ -2147,18 +2147,7 @@ declare const jobResponseSchema: ZodObject<{
2147
2147
  logsAvailable: ZodBoolean;
2148
2148
  providerType: ZodNullable<ZodString>;
2149
2149
  providerRunId: ZodNullable<ZodString>;
2150
- apiTotalMs: ZodNullable<ZodNumber>;
2151
- apiPrechecksMs: ZodNullable<ZodNumber>;
2152
- apiValidationMs: ZodNullable<ZodNumber>;
2153
- apiDbInsertMs: ZodNullable<ZodNumber>;
2154
- apiDispatchMs: ZodNullable<ZodNumber>;
2155
- execDownloadMs: ZodNullable<ZodNumber>;
2156
- execExecuteMs: ZodNullable<ZodNumber>;
2157
- execUploadMs: ZodNullable<ZodNumber>;
2158
- queueWaitMs: ZodNullable<ZodNumber>;
2159
- consumerTotalMs: ZodNullable<ZodNumber>;
2160
2150
  settledAt: ZodNullable<ZodNumber>;
2161
- execTotalMs: ZodNullable<ZodNumber>;
2162
2151
  }, $strip>;
2163
2152
  declare const jobCreatedResponseSchema: ZodObject<{
2164
2153
  id: ZodString;
@@ -2286,6 +2275,7 @@ declare const apiKeySchema: ZodObject<{
2286
2275
  id: ZodString;
2287
2276
  name: ZodString;
2288
2277
  prefix: ZodString;
2278
+ enabled: ZodBoolean;
2289
2279
  createdAt: ZodNumber;
2290
2280
  lastUsedAt: ZodNullable<ZodNumber>;
2291
2281
  expiresAt: ZodNullable<ZodNumber>;
@@ -2436,6 +2426,28 @@ interface LogEntryData {
2436
2426
  meta?: Record<string, unknown>;
2437
2427
  }
2438
2428
  //#endregion
2429
+ //#region src/types.d.ts
2430
+ /**
2431
+ * Per-job execution timing breakdown. Returned by `client.jobs.getTimings(id)`.
2432
+ *
2433
+ * All values are milliseconds, or `null` if the corresponding stage did not
2434
+ * execute (e.g. a sync-completed job has no executor or queue timings).
2435
+ */
2436
+ interface JobTimings {
2437
+ jobId: string;
2438
+ apiTotalMs: number | null;
2439
+ apiPrechecksMs: number | null;
2440
+ apiValidationMs: number | null;
2441
+ apiDbInsertMs: number | null;
2442
+ apiDispatchMs: number | null;
2443
+ execDownloadMs: number | null;
2444
+ execExecuteMs: number | null;
2445
+ execUploadMs: number | null;
2446
+ execTotalMs: number | null;
2447
+ queueWaitMs: number | null;
2448
+ consumerTotalMs: number | null;
2449
+ }
2450
+ //#endregion
2439
2451
  //#region src/client.d.ts
2440
2452
  interface ClientConfig {
2441
2453
  /** API key (Bearer rb_...). Mutually exclusive with credentials. */
@@ -2479,6 +2491,9 @@ declare function createClient(config?: ClientConfig): {
2479
2491
  logs(id: string, options?: {
2480
2492
  signal?: AbortSignal;
2481
2493
  }): Promise<LogEntryData[]>;
2494
+ getTimings(id: string, options?: {
2495
+ signal?: AbortSignal;
2496
+ }): Promise<JobTimings>;
2482
2497
  types(options?: {
2483
2498
  signal?: AbortSignal;
2484
2499
  }): Promise<JobType[]>;
@@ -2600,6 +2615,12 @@ declare function createClient(config?: ClientConfig): {
2600
2615
  id: string;
2601
2616
  revoked: boolean;
2602
2617
  }>;
2618
+ update(id: string, params: {
2619
+ name?: string;
2620
+ enabled?: boolean;
2621
+ }, options?: {
2622
+ signal?: AbortSignal;
2623
+ }): Promise<ApiKey>;
2603
2624
  };
2604
2625
  orgs: {
2605
2626
  list(options?: {
@@ -2734,6 +2755,30 @@ interface JobSubscription {
2734
2755
  unsubscribe: () => void;
2735
2756
  }
2736
2757
  //#endregion
2758
+ //#region src/jobs/ffmpeg.d.ts
2759
+ /**
2760
+ * Public params type for the `ffmpeg` job.
2761
+ *
2762
+ * Declared as a plain interface here (rather than re-exported from
2763
+ * `@rendobar/shared`) so the SDK's dts bundler does not have to follow
2764
+ * the shared package's full job-registry type graph — that graph pulls
2765
+ * pipelines, templates, and every job definition into the .d.ts output
2766
+ * and causes tsdown to OOM.
2767
+ *
2768
+ * The canonical runtime shape is the Zod schema in
2769
+ * `packages/shared/src/jobs/definitions/ffmpeg.job.ts` — keep this
2770
+ * interface in sync with it. Optional fields match `.default(...)`
2771
+ * semantics on the schema side.
2772
+ */
2773
+ interface FfmpegParams {
2774
+ /** FFmpeg command. The leading "ffmpeg" is stripped if present. */
2775
+ command: string;
2776
+ /** Output container/format. Inferred from the trailing filename if omitted. */
2777
+ outputFormat?: "mp4" | "mkv" | "webm" | "mov" | "avi" | "ts" | "gif" | "png" | "jpg" | "mp3" | "wav" | "flac" | "ogg" | "aac" | "opus" | "m4a" | "srt" | "vtt";
2778
+ /** Maximum execution time in seconds (1 - 900). Defaults to 120. */
2779
+ timeout?: number;
2780
+ }
2781
+ //#endregion
2737
2782
  //#region src/resources/jobs.d.ts
2738
2783
  type CreateJobParams = {
2739
2784
  type: string;
@@ -2811,7 +2856,6 @@ type OrgCurrentResponse = {
2811
2856
  };
2812
2857
  balance: {
2813
2858
  balance: number;
2814
- rollover: number;
2815
2859
  balanceFormatted: string;
2816
2860
  };
2817
2861
  };
@@ -2847,5 +2891,5 @@ type Asset = {
2847
2891
  updatedAt: number;
2848
2892
  };
2849
2893
  //#endregion
2850
- export { ApiError, type ApiKey, type Asset, type BatchResult, type BillingInvoice, type BillingState, type ClientConfig, type CreateJobParams, type CreateWebhookParams, type JobResponse as Job, type JobCreatedResponse, type JobListPage, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobType, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type Organization, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type Transaction, type TransactionListParams, type UpdateWebhookParams, type UploadResult, type UsageParams, type UsageSummary, type WaitOptions, type WebhookDelivery, type WebhookEndpoint, createClient, isApiError };
2894
+ export { ApiError, type ApiKey, type Asset, type BatchResult, type BillingInvoice, type BillingState, type ClientConfig, type CreateJobParams, type CreateWebhookParams, type FfmpegParams, type JobResponse as Job, type JobCreatedResponse, type JobListPage, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type Organization, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type Transaction, type TransactionListParams, type UpdateWebhookParams, type UploadResult, type UsageParams, type UsageSummary, type WaitOptions, type WebhookDelivery, type WebhookEndpoint, createClient, isApiError };
2851
2895
  //# sourceMappingURL=index.d.cts.map