@rendobar/sdk 5.1.1 → 5.2.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/dist/index.cjs CHANGED
@@ -209,6 +209,25 @@ function createJobsResource(request) {
209
209
  signal: options?.signal
210
210
  });
211
211
  }
212
+ /**
213
+ * Create a job and wait for it to reach a terminal state, returning the
214
+ * finished job. A convenience wrapper over `create()` + `wait()` for
215
+ * callers who just want the result without juggling two calls — works for
216
+ * any job type, not just a specific product.
217
+ *
218
+ * Unlike `wait()` (which defaults `throwOnFailure` to `false` to preserve
219
+ * its existing behavior), `run()` defaults `throwOnFailure` to `true`: a
220
+ * job that ends "failed" or "cancelled" throws `JobFailedError` unless the
221
+ * caller explicitly opts out with `throwOnFailure: false`.
222
+ */
223
+ async function run(params, options = {}) {
224
+ const { signal, throwOnFailure = true, ...waitOptions } = options;
225
+ return wait((await create(params, { signal })).id, {
226
+ ...waitOptions,
227
+ signal,
228
+ throwOnFailure
229
+ });
230
+ }
212
231
  async function get(id, options) {
213
232
  return request(`/jobs/${id}`, { signal: options?.signal });
214
233
  }
@@ -265,6 +284,7 @@ function createJobsResource(request) {
265
284
  list,
266
285
  listAll,
267
286
  wait,
287
+ run,
268
288
  cancel,
269
289
  download,
270
290
  logs,
package/dist/index.d.cts CHANGED
@@ -2195,6 +2195,7 @@ declare const fileSchema: ZodObject<{
2195
2195
  width: ZodOptional<ZodNumber>;
2196
2196
  height: ZodOptional<ZodNumber>;
2197
2197
  durationMs: ZodOptional<ZodNumber>;
2198
+ seed: ZodOptional<ZodNumber>;
2198
2199
  }, $strip>>;
2199
2200
  }, $strip>;
2200
2201
  declare const jobOutputSchema: ZodObject<{
@@ -2217,6 +2218,7 @@ declare const jobOutputSchema: ZodObject<{
2217
2218
  width: ZodOptional<ZodNumber>;
2218
2219
  height: ZodOptional<ZodNumber>;
2219
2220
  durationMs: ZodOptional<ZodNumber>;
2221
+ seed: ZodOptional<ZodNumber>;
2220
2222
  }, $strip>>;
2221
2223
  }, $strip>>;
2222
2224
  files: ZodArray<ZodObject<{
@@ -2237,6 +2239,7 @@ declare const jobOutputSchema: ZodObject<{
2237
2239
  width: ZodOptional<ZodNumber>;
2238
2240
  height: ZodOptional<ZodNumber>;
2239
2241
  durationMs: ZodOptional<ZodNumber>;
2242
+ seed: ZodOptional<ZodNumber>;
2240
2243
  }, $strip>>;
2241
2244
  }, $strip>>;
2242
2245
  expiresAt: ZodNullable<ZodNumber>;
@@ -2301,6 +2304,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2301
2304
  completedAt: ZodNullable<ZodNumber>;
2302
2305
  settledAt: ZodNullable<ZodNumber>;
2303
2306
  retentionExpiresAt: ZodNullable<ZodNumber>;
2307
+ webUrl: ZodString;
2308
+ model: ZodNullable<ZodString>;
2304
2309
  callback: ZodOptional<ZodNullable<ZodObject<{
2305
2310
  status: ZodEnum<{
2306
2311
  delivered: "delivered";
@@ -2353,6 +2358,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2353
2358
  completedAt: ZodNullable<ZodNumber>;
2354
2359
  settledAt: ZodNullable<ZodNumber>;
2355
2360
  retentionExpiresAt: ZodNullable<ZodNumber>;
2361
+ webUrl: ZodString;
2362
+ model: ZodNullable<ZodString>;
2356
2363
  callback: ZodOptional<ZodNullable<ZodObject<{
2357
2364
  status: ZodEnum<{
2358
2365
  delivered: "delivered";
@@ -2407,6 +2414,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2407
2414
  completedAt: ZodNullable<ZodNumber>;
2408
2415
  settledAt: ZodNullable<ZodNumber>;
2409
2416
  retentionExpiresAt: ZodNullable<ZodNumber>;
2417
+ webUrl: ZodString;
2418
+ model: ZodNullable<ZodString>;
2410
2419
  callback: ZodOptional<ZodNullable<ZodObject<{
2411
2420
  status: ZodEnum<{
2412
2421
  delivered: "delivered";
@@ -2461,6 +2470,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2461
2470
  completedAt: ZodNullable<ZodNumber>;
2462
2471
  settledAt: ZodNullable<ZodNumber>;
2463
2472
  retentionExpiresAt: ZodNullable<ZodNumber>;
2473
+ webUrl: ZodString;
2474
+ model: ZodNullable<ZodString>;
2464
2475
  callback: ZodOptional<ZodNullable<ZodObject<{
2465
2476
  status: ZodEnum<{
2466
2477
  delivered: "delivered";
@@ -2489,6 +2500,7 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2489
2500
  width: ZodOptional<ZodNumber>;
2490
2501
  height: ZodOptional<ZodNumber>;
2491
2502
  durationMs: ZodOptional<ZodNumber>;
2503
+ seed: ZodOptional<ZodNumber>;
2492
2504
  }, $strip>>;
2493
2505
  }, $strip>>;
2494
2506
  files: ZodArray<ZodObject<{
@@ -2509,6 +2521,7 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2509
2521
  width: ZodOptional<ZodNumber>;
2510
2522
  height: ZodOptional<ZodNumber>;
2511
2523
  durationMs: ZodOptional<ZodNumber>;
2524
+ seed: ZodOptional<ZodNumber>;
2512
2525
  }, $strip>>;
2513
2526
  }, $strip>>;
2514
2527
  expiresAt: ZodNullable<ZodNumber>;
@@ -2557,6 +2570,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2557
2570
  completedAt: ZodNullable<ZodNumber>;
2558
2571
  settledAt: ZodNullable<ZodNumber>;
2559
2572
  retentionExpiresAt: ZodNullable<ZodNumber>;
2573
+ webUrl: ZodString;
2574
+ model: ZodNullable<ZodString>;
2560
2575
  callback: ZodOptional<ZodNullable<ZodObject<{
2561
2576
  status: ZodEnum<{
2562
2577
  delivered: "delivered";
@@ -2620,6 +2635,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2620
2635
  completedAt: ZodNullable<ZodNumber>;
2621
2636
  settledAt: ZodNullable<ZodNumber>;
2622
2637
  retentionExpiresAt: ZodNullable<ZodNumber>;
2638
+ webUrl: ZodString;
2639
+ model: ZodNullable<ZodString>;
2623
2640
  callback: ZodOptional<ZodNullable<ZodObject<{
2624
2641
  status: ZodEnum<{
2625
2642
  delivered: "delivered";
@@ -3332,6 +3349,7 @@ declare function createClient(config?: ClientConfig): {
3332
3349
  }) => Promise<JobListPage>;
3333
3350
  listAll: (params?: Omit<ListJobsParams, "offset">) => AsyncGenerator<JobResponse>;
3334
3351
  wait: (id: string, options?: WaitOptions) => Promise<JobResponse>;
3352
+ run: (params: CreateJobParams, options?: WaitOptions) => Promise<JobResponse>;
3335
3353
  cancel: (id: string, options?: {
3336
3354
  signal?: AbortSignal;
3337
3355
  }) => Promise<JobResponse>;
@@ -3678,6 +3696,61 @@ interface FfmpegParams {
3678
3696
  compute?: "auto" | "cpu" | "gpu";
3679
3697
  }
3680
3698
  //#endregion
3699
+ //#region src/jobs/image.d.ts
3700
+ /**
3701
+ * Public params types for the `image.generate` and `image.edit` jobs.
3702
+ *
3703
+ * Declared as plain interfaces here (rather than re-exported from
3704
+ * `@rendobar/shared`) for the same reason as `FfmpegParams` in `./ffmpeg.js`:
3705
+ * the SDK's dts bundler must not follow the shared package's job-registry
3706
+ * type graph — that graph pulls the full generation model catalog into the
3707
+ * .d.ts output and causes tsdown to OOM.
3708
+ *
3709
+ * The canonical runtime shape is the discriminated Zod unions in
3710
+ * `packages/shared/src/jobs/definitions/image-generate.job.ts` and
3711
+ * `image-edit.job.ts` (built from `GEN_BASE_PARAMS` in
3712
+ * `packages/shared/src/jobs/gen-registry.ts`) — keep these interfaces in
3713
+ * sync with them. Both jobs share the same base field set. The per-model
3714
+ * extras (`negativePrompt`, `guidance`, `steps`) are offered here as
3715
+ * optional on every model rather than reproduced as the catalog's per-model
3716
+ * discriminated union, so the SDK doesn't have to track which model
3717
+ * supports which knob — the API validates against the real per-model schema
3718
+ * and rejects a field the resolved model doesn't support.
3719
+ */
3720
+ /**
3721
+ * Tier alias for a generation model. `"economy"` is the default when `model`
3722
+ * is omitted. Pin an exact model id (e.g. `"qwen-image-2512"`) instead of a
3723
+ * tier to reach that model's own controls.
3724
+ */
3725
+ type GenModelTier = "economy" | "standard" | "premium";
3726
+ interface ImageGenBaseParams {
3727
+ /** Tier alias or exact model id. Defaults to the "economy" tier when omitted. */
3728
+ model?: GenModelTier | string;
3729
+ /** What you want. For image.edit, describe the change to make. Plain language, no special syntax. */
3730
+ prompt: string;
3731
+ /** Requested output width in pixels. Snapped to what the model can render. */
3732
+ width?: number;
3733
+ /** Requested output height in pixels. Snapped to what the model can render. */
3734
+ height?: number;
3735
+ /** Fixed seed for a reproducible result. The seed used is echoed back. */
3736
+ seed?: number;
3737
+ /** What to keep out of the image. Only some models support this. */
3738
+ negativePrompt?: string;
3739
+ /** How strictly to follow the prompt. Higher is stricter. Only some models support this. */
3740
+ guidance?: number;
3741
+ /** Denoise steps. More steps means more detail and more time. Range depends on the resolved model. */
3742
+ steps?: number;
3743
+ /** Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default. */
3744
+ enhancePrompt?: boolean;
3745
+ }
3746
+ /** Public params type for the `image.generate` job. */
3747
+ interface ImageGenerateParams extends ImageGenBaseParams {}
3748
+ /**
3749
+ * Public params type for the `image.edit` job. Reference images (1-4) are
3750
+ * passed as job `inputs.images`, not here — see `CreateJobParams.inputs`.
3751
+ */
3752
+ interface ImageEditParams extends ImageGenBaseParams {}
3753
+ //#endregion
3681
3754
  //#region src/resources/jobs.d.ts
3682
3755
  type CreateJobParams = {
3683
3756
  type: string;
@@ -3852,4 +3925,4 @@ type AssetListPage = {
3852
3925
  meta: AssetListMeta;
3853
3926
  };
3854
3927
  //#endregion
3855
- export { ApiError, type ApiKey, type AssetResponse as Asset, type AssetDownloadResponse, type AssetInitResponse, type AssetListMeta, type AssetListPage, type BalanceDepletedData, type BalanceLowData, type BillingInvoice, type BillingState, type ClientConfig, type Cost, type CreateJobParams, type CreateUploadOptions, type CreateWebhookParams, type FfmpegParams, type FileType, type JobResponse as Job, type JobCancelledData, type JobCompletedData, type JobCreatedData, type JobCreatedResponse, type JobError, type JobFailedData, JobFailedError, type JobListPage, type JobStartedData, type JobStats, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListAssetsParams, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type OrgSettings, type Organization, type Output, type OutputFile, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type RetryDeliveryResult, type StatsParams, type TestEventData, type Transaction, type TransactionListParams, type UpdateWebhookParams, type UploadProgress, type UsageParams, type UsageSummary, type WaitOptions, WaitTimeoutError, type WebhookDelivery, type WebhookEndpoint, type WebhookEventDataMap, type WebhookPayload, createClient, isApiError, jobData, outputUrl };
3928
+ export { ApiError, type ApiKey, type AssetResponse as Asset, type AssetDownloadResponse, type AssetInitResponse, type AssetListMeta, type AssetListPage, type BalanceDepletedData, type BalanceLowData, type BillingInvoice, type BillingState, type ClientConfig, type Cost, type CreateJobParams, type CreateUploadOptions, type CreateWebhookParams, type FfmpegParams, type FileType, type GenModelTier, type ImageEditParams, type ImageGenerateParams, type JobResponse as Job, type JobCancelledData, type JobCompletedData, type JobCreatedData, type JobCreatedResponse, type JobError, type JobFailedData, JobFailedError, type JobListPage, type JobStartedData, type JobStats, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListAssetsParams, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type OrgSettings, type Organization, type Output, type OutputFile, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type RetryDeliveryResult, type StatsParams, type TestEventData, type Transaction, type TransactionListParams, type UpdateWebhookParams, type UploadProgress, type UsageParams, type UsageSummary, type WaitOptions, WaitTimeoutError, type WebhookDelivery, type WebhookEndpoint, type WebhookEventDataMap, type WebhookPayload, createClient, isApiError, jobData, outputUrl };
package/dist/index.d.mts CHANGED
@@ -2195,6 +2195,7 @@ declare const fileSchema: ZodObject<{
2195
2195
  width: ZodOptional<ZodNumber>;
2196
2196
  height: ZodOptional<ZodNumber>;
2197
2197
  durationMs: ZodOptional<ZodNumber>;
2198
+ seed: ZodOptional<ZodNumber>;
2198
2199
  }, $strip>>;
2199
2200
  }, $strip>;
2200
2201
  declare const jobOutputSchema: ZodObject<{
@@ -2217,6 +2218,7 @@ declare const jobOutputSchema: ZodObject<{
2217
2218
  width: ZodOptional<ZodNumber>;
2218
2219
  height: ZodOptional<ZodNumber>;
2219
2220
  durationMs: ZodOptional<ZodNumber>;
2221
+ seed: ZodOptional<ZodNumber>;
2220
2222
  }, $strip>>;
2221
2223
  }, $strip>>;
2222
2224
  files: ZodArray<ZodObject<{
@@ -2237,6 +2239,7 @@ declare const jobOutputSchema: ZodObject<{
2237
2239
  width: ZodOptional<ZodNumber>;
2238
2240
  height: ZodOptional<ZodNumber>;
2239
2241
  durationMs: ZodOptional<ZodNumber>;
2242
+ seed: ZodOptional<ZodNumber>;
2240
2243
  }, $strip>>;
2241
2244
  }, $strip>>;
2242
2245
  expiresAt: ZodNullable<ZodNumber>;
@@ -2301,6 +2304,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2301
2304
  completedAt: ZodNullable<ZodNumber>;
2302
2305
  settledAt: ZodNullable<ZodNumber>;
2303
2306
  retentionExpiresAt: ZodNullable<ZodNumber>;
2307
+ webUrl: ZodString;
2308
+ model: ZodNullable<ZodString>;
2304
2309
  callback: ZodOptional<ZodNullable<ZodObject<{
2305
2310
  status: ZodEnum<{
2306
2311
  delivered: "delivered";
@@ -2353,6 +2358,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2353
2358
  completedAt: ZodNullable<ZodNumber>;
2354
2359
  settledAt: ZodNullable<ZodNumber>;
2355
2360
  retentionExpiresAt: ZodNullable<ZodNumber>;
2361
+ webUrl: ZodString;
2362
+ model: ZodNullable<ZodString>;
2356
2363
  callback: ZodOptional<ZodNullable<ZodObject<{
2357
2364
  status: ZodEnum<{
2358
2365
  delivered: "delivered";
@@ -2407,6 +2414,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2407
2414
  completedAt: ZodNullable<ZodNumber>;
2408
2415
  settledAt: ZodNullable<ZodNumber>;
2409
2416
  retentionExpiresAt: ZodNullable<ZodNumber>;
2417
+ webUrl: ZodString;
2418
+ model: ZodNullable<ZodString>;
2410
2419
  callback: ZodOptional<ZodNullable<ZodObject<{
2411
2420
  status: ZodEnum<{
2412
2421
  delivered: "delivered";
@@ -2461,6 +2470,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2461
2470
  completedAt: ZodNullable<ZodNumber>;
2462
2471
  settledAt: ZodNullable<ZodNumber>;
2463
2472
  retentionExpiresAt: ZodNullable<ZodNumber>;
2473
+ webUrl: ZodString;
2474
+ model: ZodNullable<ZodString>;
2464
2475
  callback: ZodOptional<ZodNullable<ZodObject<{
2465
2476
  status: ZodEnum<{
2466
2477
  delivered: "delivered";
@@ -2489,6 +2500,7 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2489
2500
  width: ZodOptional<ZodNumber>;
2490
2501
  height: ZodOptional<ZodNumber>;
2491
2502
  durationMs: ZodOptional<ZodNumber>;
2503
+ seed: ZodOptional<ZodNumber>;
2492
2504
  }, $strip>>;
2493
2505
  }, $strip>>;
2494
2506
  files: ZodArray<ZodObject<{
@@ -2509,6 +2521,7 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2509
2521
  width: ZodOptional<ZodNumber>;
2510
2522
  height: ZodOptional<ZodNumber>;
2511
2523
  durationMs: ZodOptional<ZodNumber>;
2524
+ seed: ZodOptional<ZodNumber>;
2512
2525
  }, $strip>>;
2513
2526
  }, $strip>>;
2514
2527
  expiresAt: ZodNullable<ZodNumber>;
@@ -2557,6 +2570,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2557
2570
  completedAt: ZodNullable<ZodNumber>;
2558
2571
  settledAt: ZodNullable<ZodNumber>;
2559
2572
  retentionExpiresAt: ZodNullable<ZodNumber>;
2573
+ webUrl: ZodString;
2574
+ model: ZodNullable<ZodString>;
2560
2575
  callback: ZodOptional<ZodNullable<ZodObject<{
2561
2576
  status: ZodEnum<{
2562
2577
  delivered: "delivered";
@@ -2620,6 +2635,8 @@ declare const jobResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
2620
2635
  completedAt: ZodNullable<ZodNumber>;
2621
2636
  settledAt: ZodNullable<ZodNumber>;
2622
2637
  retentionExpiresAt: ZodNullable<ZodNumber>;
2638
+ webUrl: ZodString;
2639
+ model: ZodNullable<ZodString>;
2623
2640
  callback: ZodOptional<ZodNullable<ZodObject<{
2624
2641
  status: ZodEnum<{
2625
2642
  delivered: "delivered";
@@ -3332,6 +3349,7 @@ declare function createClient(config?: ClientConfig): {
3332
3349
  }) => Promise<JobListPage>;
3333
3350
  listAll: (params?: Omit<ListJobsParams, "offset">) => AsyncGenerator<JobResponse>;
3334
3351
  wait: (id: string, options?: WaitOptions) => Promise<JobResponse>;
3352
+ run: (params: CreateJobParams, options?: WaitOptions) => Promise<JobResponse>;
3335
3353
  cancel: (id: string, options?: {
3336
3354
  signal?: AbortSignal;
3337
3355
  }) => Promise<JobResponse>;
@@ -3678,6 +3696,61 @@ interface FfmpegParams {
3678
3696
  compute?: "auto" | "cpu" | "gpu";
3679
3697
  }
3680
3698
  //#endregion
3699
+ //#region src/jobs/image.d.ts
3700
+ /**
3701
+ * Public params types for the `image.generate` and `image.edit` jobs.
3702
+ *
3703
+ * Declared as plain interfaces here (rather than re-exported from
3704
+ * `@rendobar/shared`) for the same reason as `FfmpegParams` in `./ffmpeg.js`:
3705
+ * the SDK's dts bundler must not follow the shared package's job-registry
3706
+ * type graph — that graph pulls the full generation model catalog into the
3707
+ * .d.ts output and causes tsdown to OOM.
3708
+ *
3709
+ * The canonical runtime shape is the discriminated Zod unions in
3710
+ * `packages/shared/src/jobs/definitions/image-generate.job.ts` and
3711
+ * `image-edit.job.ts` (built from `GEN_BASE_PARAMS` in
3712
+ * `packages/shared/src/jobs/gen-registry.ts`) — keep these interfaces in
3713
+ * sync with them. Both jobs share the same base field set. The per-model
3714
+ * extras (`negativePrompt`, `guidance`, `steps`) are offered here as
3715
+ * optional on every model rather than reproduced as the catalog's per-model
3716
+ * discriminated union, so the SDK doesn't have to track which model
3717
+ * supports which knob — the API validates against the real per-model schema
3718
+ * and rejects a field the resolved model doesn't support.
3719
+ */
3720
+ /**
3721
+ * Tier alias for a generation model. `"economy"` is the default when `model`
3722
+ * is omitted. Pin an exact model id (e.g. `"qwen-image-2512"`) instead of a
3723
+ * tier to reach that model's own controls.
3724
+ */
3725
+ type GenModelTier = "economy" | "standard" | "premium";
3726
+ interface ImageGenBaseParams {
3727
+ /** Tier alias or exact model id. Defaults to the "economy" tier when omitted. */
3728
+ model?: GenModelTier | string;
3729
+ /** What you want. For image.edit, describe the change to make. Plain language, no special syntax. */
3730
+ prompt: string;
3731
+ /** Requested output width in pixels. Snapped to what the model can render. */
3732
+ width?: number;
3733
+ /** Requested output height in pixels. Snapped to what the model can render. */
3734
+ height?: number;
3735
+ /** Fixed seed for a reproducible result. The seed used is echoed back. */
3736
+ seed?: number;
3737
+ /** What to keep out of the image. Only some models support this. */
3738
+ negativePrompt?: string;
3739
+ /** How strictly to follow the prompt. Higher is stricter. Only some models support this. */
3740
+ guidance?: number;
3741
+ /** Denoise steps. More steps means more detail and more time. Range depends on the resolved model. */
3742
+ steps?: number;
3743
+ /** Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default. */
3744
+ enhancePrompt?: boolean;
3745
+ }
3746
+ /** Public params type for the `image.generate` job. */
3747
+ interface ImageGenerateParams extends ImageGenBaseParams {}
3748
+ /**
3749
+ * Public params type for the `image.edit` job. Reference images (1-4) are
3750
+ * passed as job `inputs.images`, not here — see `CreateJobParams.inputs`.
3751
+ */
3752
+ interface ImageEditParams extends ImageGenBaseParams {}
3753
+ //#endregion
3681
3754
  //#region src/resources/jobs.d.ts
3682
3755
  type CreateJobParams = {
3683
3756
  type: string;
@@ -3852,4 +3925,4 @@ type AssetListPage = {
3852
3925
  meta: AssetListMeta;
3853
3926
  };
3854
3927
  //#endregion
3855
- export { ApiError, type ApiKey, type AssetResponse as Asset, type AssetDownloadResponse, type AssetInitResponse, type AssetListMeta, type AssetListPage, type BalanceDepletedData, type BalanceLowData, type BillingInvoice, type BillingState, type ClientConfig, type Cost, type CreateJobParams, type CreateUploadOptions, type CreateWebhookParams, type FfmpegParams, type FileType, type JobResponse as Job, type JobCancelledData, type JobCompletedData, type JobCreatedData, type JobCreatedResponse, type JobError, type JobFailedData, JobFailedError, type JobListPage, type JobStartedData, type JobStats, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListAssetsParams, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type OrgSettings, type Organization, type Output, type OutputFile, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type RetryDeliveryResult, type StatsParams, type TestEventData, type Transaction, type TransactionListParams, type UpdateWebhookParams, type UploadProgress, type UsageParams, type UsageSummary, type WaitOptions, WaitTimeoutError, type WebhookDelivery, type WebhookEndpoint, type WebhookEventDataMap, type WebhookPayload, createClient, isApiError, jobData, outputUrl };
3928
+ export { ApiError, type ApiKey, type AssetResponse as Asset, type AssetDownloadResponse, type AssetInitResponse, type AssetListMeta, type AssetListPage, type BalanceDepletedData, type BalanceLowData, type BillingInvoice, type BillingState, type ClientConfig, type Cost, type CreateJobParams, type CreateUploadOptions, type CreateWebhookParams, type FfmpegParams, type FileType, type GenModelTier, type ImageEditParams, type ImageGenerateParams, type JobResponse as Job, type JobCancelledData, type JobCompletedData, type JobCreatedData, type JobCreatedResponse, type JobError, type JobFailedData, JobFailedError, type JobListPage, type JobStartedData, type JobStats, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListAssetsParams, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type OrgSettings, type Organization, type Output, type OutputFile, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type RetryDeliveryResult, type StatsParams, type TestEventData, type Transaction, type TransactionListParams, type UpdateWebhookParams, type UploadProgress, type UsageParams, type UsageSummary, type WaitOptions, WaitTimeoutError, type WebhookDelivery, type WebhookEndpoint, type WebhookEventDataMap, type WebhookPayload, createClient, isApiError, jobData, outputUrl };
package/dist/index.mjs CHANGED
@@ -208,6 +208,25 @@ function createJobsResource(request) {
208
208
  signal: options?.signal
209
209
  });
210
210
  }
211
+ /**
212
+ * Create a job and wait for it to reach a terminal state, returning the
213
+ * finished job. A convenience wrapper over `create()` + `wait()` for
214
+ * callers who just want the result without juggling two calls — works for
215
+ * any job type, not just a specific product.
216
+ *
217
+ * Unlike `wait()` (which defaults `throwOnFailure` to `false` to preserve
218
+ * its existing behavior), `run()` defaults `throwOnFailure` to `true`: a
219
+ * job that ends "failed" or "cancelled" throws `JobFailedError` unless the
220
+ * caller explicitly opts out with `throwOnFailure: false`.
221
+ */
222
+ async function run(params, options = {}) {
223
+ const { signal, throwOnFailure = true, ...waitOptions } = options;
224
+ return wait((await create(params, { signal })).id, {
225
+ ...waitOptions,
226
+ signal,
227
+ throwOnFailure
228
+ });
229
+ }
211
230
  async function get(id, options) {
212
231
  return request(`/jobs/${id}`, { signal: options?.signal });
213
232
  }
@@ -264,6 +283,7 @@ function createJobsResource(request) {
264
283
  list,
265
284
  listAll,
266
285
  wait,
286
+ run,
267
287
  cancel,
268
288
  download,
269
289
  logs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rendobar/sdk",
3
- "version": "5.1.1",
3
+ "version": "5.2.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript client for the Rendobar media processing API",
6
6
  "license": "MIT",