@unityclaw/sdk 1.0.8 → 1.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/dist/index.cjs CHANGED
@@ -496,6 +496,14 @@ function toNumericDurationLabelFieldItem(input) {
496
496
  }
497
497
  return item;
498
498
  }
499
+ function normalizeJimengAction(action, attachment) {
500
+ const normalized = toLabelFieldItem(action);
501
+ if (normalized?.value === "t2v" || normalized?.value === "i2v") {
502
+ return normalized;
503
+ }
504
+ const inferred = attachment && attachment.length > 0 ? "i2v" : "t2v";
505
+ return { value: inferred, label: inferred };
506
+ }
499
507
  var VideoAPI = class {
500
508
  constructor(client) {
501
509
  this.client = client;
@@ -594,7 +602,7 @@ var VideoAPI = class {
594
602
  */
595
603
  async jimeng(params) {
596
604
  return this.client.request("/api/jimeng/video", {
597
- action: toLabelFieldItem(params.action),
605
+ action: normalizeJimengAction(params.action, params.attachment),
598
606
  attachment: params.attachment,
599
607
  prompt: toTextFieldItems(params.prompt),
600
608
  aspect_ratio: toLabelFieldItem(params.aspect_ratio)
package/dist/index.d.cts CHANGED
@@ -174,7 +174,7 @@ interface KlingVideoParams {
174
174
  }
175
175
  /** JiMeng video generation params */
176
176
  interface JiMengVideoParams {
177
- action: SelectValue<'t2v' | 'i2v' | string>;
177
+ action?: SelectValue<'t2v' | 'i2v' | string>;
178
178
  attachment?: AttachmentInput[];
179
179
  prompt?: TextInput;
180
180
  aspect_ratio: SelectValue<string>;
@@ -596,7 +596,7 @@ declare class VideoAPI {
596
596
  * ```
597
597
  */
598
598
  jimeng(params: {
599
- action: LabelFieldItem | string;
599
+ action?: LabelFieldItem | string;
600
600
  attachment?: JiMengVideoParams['attachment'];
601
601
  prompt?: string | TextFieldItem[];
602
602
  aspect_ratio: LabelFieldItem | string;
package/dist/index.d.ts CHANGED
@@ -174,7 +174,7 @@ interface KlingVideoParams {
174
174
  }
175
175
  /** JiMeng video generation params */
176
176
  interface JiMengVideoParams {
177
- action: SelectValue<'t2v' | 'i2v' | string>;
177
+ action?: SelectValue<'t2v' | 'i2v' | string>;
178
178
  attachment?: AttachmentInput[];
179
179
  prompt?: TextInput;
180
180
  aspect_ratio: SelectValue<string>;
@@ -596,7 +596,7 @@ declare class VideoAPI {
596
596
  * ```
597
597
  */
598
598
  jimeng(params: {
599
- action: LabelFieldItem | string;
599
+ action?: LabelFieldItem | string;
600
600
  attachment?: JiMengVideoParams['attachment'];
601
601
  prompt?: string | TextFieldItem[];
602
602
  aspect_ratio: LabelFieldItem | string;
package/dist/index.js CHANGED
@@ -382,6 +382,14 @@ function toNumericDurationLabelFieldItem(input) {
382
382
  }
383
383
  return item;
384
384
  }
385
+ function normalizeJimengAction(action, attachment) {
386
+ const normalized = toLabelFieldItem(action);
387
+ if (normalized?.value === "t2v" || normalized?.value === "i2v") {
388
+ return normalized;
389
+ }
390
+ const inferred = attachment && attachment.length > 0 ? "i2v" : "t2v";
391
+ return { value: inferred, label: inferred };
392
+ }
385
393
  var VideoAPI = class {
386
394
  constructor(client) {
387
395
  this.client = client;
@@ -480,7 +488,7 @@ var VideoAPI = class {
480
488
  */
481
489
  async jimeng(params) {
482
490
  return this.client.request("/api/jimeng/video", {
483
- action: toLabelFieldItem(params.action),
491
+ action: normalizeJimengAction(params.action, params.attachment),
484
492
  attachment: params.attachment,
485
493
  prompt: toTextFieldItems(params.prompt),
486
494
  aspect_ratio: toLabelFieldItem(params.aspect_ratio)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unityclaw/sdk",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "Node.js SDK for UnityClaw API - AI-powered image/video generation, media analysis, and more",
5
5
  "type": "module",
6
6
  "bin": {