samsar-js 0.48.27 → 0.48.28

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
@@ -547,9 +547,9 @@ console.log(externalLibrary.data.requests.map((request) => request.request_id));
547
547
 
548
548
  Video model support notes:
549
549
  - `createVideoFromText` image model keys include: `GPTIMAGE2`, `IMAGEN4`, `SEEDREAM`, `NANOBANANA2`, `CUSTOM_TEXT_TO_IMAGE`.
550
- - `createVideoFromText` supports these video models: `VEO3.1I2V`, `VEO3.1I2VFAST`, `SEEDANCEI2V` (Seedance 2.0), `KLINGIMGTOVID3PRO`, `RUNWAYML`, and `CUSTOM_IMAGE_TO_VIDEO`.
550
+ - `createVideoFromText` supports these video models: `RUNWAYML`, `VEO3.1I2V`, `VEO3.1I2VFAST`, `SEEDANCEI2V` (Seedance 1.5), `KLINGIMGTOVID3PRO`, and `CUSTOM_IMAGE_TO_VIDEO`.
551
551
  - `createVideoFromText` accepts either a provided outro (`outro_image_url`) or server-generated QR outro (`generate_outro_image: true` with `cta_url`). It can also render bottom CTA footer QR cards with `add_footer_animation` and `footer_metadata`; one footer item applies to every generated scene, while multiple items map by scene index.
552
- - `createVideoFromImageList` supports `VEO3.1I2V`, `VEO3.1I2VFAST`, `SEEDANCEI2V`, `KLINGIMGTOVID3PRO`, `RUNWAYML`, and `CUSTOM_IMAGE_TO_VIDEO` via `video_model`; if omitted, it defaults to `VEO3.1I2V`. Use `aspect_ratio: '16:9'` or `'9:16'`; omitted or invalid values fall back to `16:9`.
552
+ - `createVideoFromImageList` supports `RUNWAYML`, `VEO3.1I2V`, `VEO3.1I2VFAST`, `SEEDANCEI2V`, `KLINGIMGTOVID3PRO`, and `CUSTOM_IMAGE_TO_VIDEO` via `video_model`; if omitted, it defaults to `RUNWAYML`. Use `aspect_ratio: '16:9'` or `'9:16'`; omitted or invalid values fall back to `16:9`.
553
553
  - `createVideoFromImageList` accepts either a provided outro (`outro_image_url`) or server-generated QR outro (`generate_outro_image: true` with `cta_url`). Do not combine the two modes in a single request.
554
554
  - `createVideoFromImageList` can render per-scene footer QR cards by setting `add_footer_animation: true` and providing one `footer_metadata` item per image scene.
555
555
  - `createVideoFromImageList` accepts `limit_single_narrator: true` to keep all narration under one narrator identity. `add_narrator_avatar: true` automatically enables `limit_single_narrator`, generates an influencer-style human narrator avatar, and overlays it bottom-center or centered in the footer row when footer metadata is present.
@@ -564,10 +564,11 @@ Video model support notes:
564
564
 
565
565
  Upcoming `/v2` omni route adapters:
566
566
  - `/v2` is additive; `/v1` is not deprecated.
567
- - `createV2VideoFromText`, `createV2VideoFromImageList`, `translateV2Video`, `cloneV2Video`, `updateV2VideoOutroImage`, `updateV2VideoFooterImage`, `addV2VideoOutroImage`, `getV2Status`, `getV2Credits`, `listV2Requests`, and `createV2Session` call the new omni route surface.
568
- - Step-controlled video helpers include `createV2StepVideoFromText`, `createV2StepTextToVideo`, `createV2StepVideoFromImage`, `createV2StepImageToVideo`, `getV2StepVideoStatus`, and `processNextV2StepVideo`.
567
+ - `createV2VideoFromText`, `createV2VideoFromImageList`, `translateV2Video`, `cloneV2Video`, `updateV2VideoOutroImage`, `updateV2VideoFooterImage`, `addV2VideoOutroImage`, `getV2Status`, `getV2StatusDetailed`, `getV2Credits`, `listV2Requests`, and `createV2Session` call the new omni route surface.
568
+ - Step-controlled video helpers include `createV2StepVideoFromText`, `createV2StepTextToVideo`, `createV2StepVideoFromImage`, `createV2StepImageToVideo`, `getV2StepVideoStatus`, `getV2StepVideoStatusDetailed`, and `processNextV2StepVideo`.
569
569
  - Programmatic user helpers include `createV2ExternalUser`, `createV2UserRechargeCredits`, `refreshV2UserToken`, `createV2UserAppKey`, `refreshV2UserAppKey`, `getV2UserCredits`, `getV2UserUsageLogs`, and `getV2UserPaymentStatus`.
570
570
  - Omit `externalUser` for internal account billing, pass `externalUser` to scope an external user with the account API key, or authenticate the client directly with an external-user auth token/API key. V2 external users can be referenced by `unique_key`; if `unique_key` is omitted during creation, the server uses `external_user_id` as the key.
571
+ - Detailed status adapters return the normal status payload plus a normalized `session` preview shape with `layers`, `audioLayers`, `globalAudioLayers`, and `globalVideos`. Layer timing uses `startTime` and `endTime` so clients can preview generated images, scene clips, and speech before final render completion.
571
572
 
572
573
  ```ts
573
574
  const v2Video = await platform.createV2VideoFromImageList({
@@ -600,6 +601,9 @@ const v2Clone = await platform.cloneV2Video({
600
601
 
601
602
  const v2Status = await platform.getV2Status(v2Video.data.request_id!);
602
603
  console.log(v2Status.data.status);
604
+
605
+ const v2Detailed = await platform.getV2StatusDetailed(v2Video.data.request_id!);
606
+ console.log(v2Detailed.data.session?.previewStage, v2Detailed.data.session?.layers?.[0]?.preview?.url);
603
607
  ```
604
608
 
605
609
  Step-controlled video generation pauses after each completed stage until you call `processNextV2StepVideo`:
@@ -617,6 +621,8 @@ const stepVideo = await platform.createV2StepVideoFromText({
617
621
  let stepStatus = await platform.getV2StepVideoStatus(stepVideo.data.request_id);
618
622
  if (stepStatus.data.step_status === 'COMPLETED') {
619
623
  console.log(stepStatus.data.current_step, stepStatus.data.current_step_resources);
624
+ const stepDetailed = await platform.getV2StepVideoStatusDetailed(stepVideo.data.request_id);
625
+ console.log(stepDetailed.data.session?.previewStage, stepDetailed.data.session?.layers?.[0]?.preview?.url);
620
626
  stepStatus = await platform.processNextV2StepVideo(stepVideo.data.request_id);
621
627
  }
622
628
 
package/dist/index.d.ts CHANGED
@@ -111,7 +111,7 @@ export interface FooterMetadataItem {
111
111
  footerLogoImagePath?: string;
112
112
  }
113
113
  export type ImageListToVideoAspectRatio = '16:9' | '9:16';
114
- export type ImageListToVideoModel = 'VEO3.1I2V' | 'VEO3.1I2VFAST' | 'SEEDANCEI2V' | 'KLINGIMGTOVID3PRO' | 'RUNWAYML' | 'CUSTOM_IMAGE_TO_VIDEO';
114
+ export type ImageListToVideoModel = 'RUNWAYML' | 'VEO3.1I2V' | 'VEO3.1I2VFAST' | 'SEEDANCEI2V' | 'KLINGIMGTOVID3PRO' | 'CUSTOM_IMAGE_TO_VIDEO';
115
115
  export interface ImageListToVideoItem {
116
116
  image_url?: string;
117
117
  imageUrl?: string;
@@ -1411,8 +1411,129 @@ export interface V2RequestOptions extends SamsarRequestOptions {
1411
1411
  externalUser?: V2ExternalUserIdentity | null;
1412
1412
  webhookUrl?: string;
1413
1413
  }
1414
- export type V2StepVideoStage = 'prompt_generation' | 'image_generation' | 'speech_generation' | 'music_generation' | 'ai_video_generation' | 'lip_sync_generation' | 'sound_effect_generation' | 'video_generation';
1414
+ export type V2StepVideoStage = 'prompt_generation' | 'image_generation' | 'speech_generation' | 'music_generation' | 'audio_generation' | 'ai_video_generation' | 'lip_sync_generation' | 'sound_effect_generation' | 'narrator_avatar_generation' | 'delete_reflow' | 'timeline_reflowed' | 'transcript_generation' | 'frame_generation' | 'video_generation';
1415
1415
  export type V2StepVideoStatus = 'INIT' | 'PENDING' | 'COMPLETED' | 'FAILED' | string;
1416
+ export interface VideoSessionPreviewAsset {
1417
+ status?: V2StepVideoStatus;
1418
+ url?: string | null;
1419
+ editStatus?: string | null;
1420
+ description?: string | null;
1421
+ [key: string]: unknown;
1422
+ }
1423
+ export interface VideoSessionLayerPreview {
1424
+ stage?: V2StepVideoStage | 'user_video' | string;
1425
+ type?: 'image' | 'video' | 'audio' | string;
1426
+ url?: string | null;
1427
+ [key: string]: unknown;
1428
+ }
1429
+ export interface VideoSessionPreviewLayer {
1430
+ index: number;
1431
+ id?: string | null;
1432
+ startTime: number;
1433
+ endTime?: number | null;
1434
+ duration?: number | null;
1435
+ status?: string | null;
1436
+ prompt?: string | null;
1437
+ videoPrompt?: string | null;
1438
+ aiVideoType?: string | null;
1439
+ baseImageType?: string | null;
1440
+ soundEffectPrompt?: string | null;
1441
+ image?: VideoSessionPreviewAsset;
1442
+ aiVideo?: VideoSessionPreviewAsset | null;
1443
+ lipSyncVideo?: VideoSessionPreviewAsset | null;
1444
+ soundEffectVideo?: VideoSessionPreviewAsset | null;
1445
+ userVideo?: VideoSessionPreviewAsset | null;
1446
+ preview?: VideoSessionLayerPreview | null;
1447
+ [key: string]: unknown;
1448
+ }
1449
+ export interface VideoSessionPreviewAudioLayer {
1450
+ index: number;
1451
+ id?: string | null;
1452
+ type?: string;
1453
+ status?: V2StepVideoStatus;
1454
+ startTime: number;
1455
+ endTime?: number | null;
1456
+ duration?: number | null;
1457
+ sourceTrimStartTime?: number | null;
1458
+ prompt?: string | null;
1459
+ url?: string | null;
1460
+ remoteAudioLinks?: string[];
1461
+ volume?: number | null;
1462
+ isEnabled?: boolean | null;
1463
+ defaultSelected?: boolean | null;
1464
+ speaker?: string | null;
1465
+ provider?: string | null;
1466
+ speakerCharacterName?: string | null;
1467
+ lyrics?: string | null;
1468
+ connectedLayerId?: string | null;
1469
+ connectedLayerIndex?: number | null;
1470
+ audioBindingMode?: string | null;
1471
+ bindToLayer?: boolean | null;
1472
+ addSubtitles?: boolean | null;
1473
+ subtitleFont?: string | null;
1474
+ subtitleWordAnimation?: string | null;
1475
+ transcriptAlignment?: Record<string, unknown> | null;
1476
+ [key: string]: unknown;
1477
+ }
1478
+ export interface VideoSessionPreviewGlobalVideo {
1479
+ index: number;
1480
+ id?: string | null;
1481
+ type?: 'video' | string;
1482
+ source?: string | null;
1483
+ title?: string | null;
1484
+ status?: V2StepVideoStatus;
1485
+ startTime: number;
1486
+ endTime?: number | null;
1487
+ duration?: number | null;
1488
+ url?: string | null;
1489
+ framesPerSecond?: number | null;
1490
+ [key: string]: unknown;
1491
+ }
1492
+ export interface VideoSessionPreviewResult {
1493
+ url?: string | null;
1494
+ remoteURL?: string | null;
1495
+ videoLink?: string | null;
1496
+ hasSubtitles?: boolean;
1497
+ hasFooter?: boolean;
1498
+ language?: string | null;
1499
+ [key: string]: unknown;
1500
+ }
1501
+ export interface VideoStatusDetailedSession {
1502
+ id?: string | null;
1503
+ requestId?: string | null;
1504
+ type?: 'video' | string;
1505
+ routeType?: 'express' | 'step' | string;
1506
+ aspectRatio?: string | null;
1507
+ framesPerSecond?: number | null;
1508
+ duration?: number;
1509
+ language?: string | null;
1510
+ languageString?: string | null;
1511
+ hasSubtitles?: boolean;
1512
+ hasFooter?: boolean;
1513
+ inputPrompt?: string | null;
1514
+ generationType?: string | null;
1515
+ provider?: string | null;
1516
+ currentStage?: V2StepVideoStage | string;
1517
+ previewStage?: V2StepVideoStage | string;
1518
+ completedStages?: Array<V2StepVideoStage | string>;
1519
+ stages?: Record<string, V2StepVideoStatus | unknown>;
1520
+ layers?: VideoSessionPreviewLayer[];
1521
+ audioLayers?: VideoSessionPreviewAudioLayer[];
1522
+ globalAudioLayers?: VideoSessionPreviewAudioLayer[];
1523
+ globalVideos?: VideoSessionPreviewGlobalVideo[];
1524
+ result?: VideoSessionPreviewResult;
1525
+ createdAt?: string | null;
1526
+ updatedAt?: string | null;
1527
+ [key: string]: unknown;
1528
+ }
1529
+ export interface GlobalStatusDetailedResponse extends GlobalStatusResponse {
1530
+ status_detail_schema?: 'video_session_preview.v1' | string;
1531
+ session?: VideoStatusDetailedSession | null;
1532
+ }
1533
+ export interface ExternalStatusDetailedResponse extends ExternalStatusResponse {
1534
+ status_detail_schema?: 'video_session_preview.v1' | string;
1535
+ session?: VideoStatusDetailedSession | null;
1536
+ }
1416
1537
  export interface V2StepVideoState {
1417
1538
  enabled?: boolean;
1418
1539
  route_type?: 'text_to_video' | 'image_to_video' | string | null;
@@ -1443,6 +1564,10 @@ export interface V2StepVideoStatusResponse extends GlobalStatusResponse {
1443
1564
  current_step_resources?: V2StepVideoResourceBlock | null;
1444
1565
  completed_step_resources?: Record<string, V2StepVideoResourceBlock>;
1445
1566
  }
1567
+ export interface V2StepVideoDetailedStatusResponse extends V2StepVideoStatusResponse {
1568
+ status_detail_schema?: 'video_session_preview.v1' | string;
1569
+ session?: VideoStatusDetailedSession | null;
1570
+ }
1446
1571
  export interface V2StepVideoCreateResponse extends CreateVideoResponse {
1447
1572
  status?: V2StepVideoStatus;
1448
1573
  step?: V2StepVideoState;
@@ -1824,6 +1949,8 @@ export declare class SamsarClient {
1824
1949
  createV2StepVideoFromImage(input: CreateV2StepImageToVideoInput, options?: V2RequestOptions): Promise<SamsarResult<V2StepVideoCreateResponse>>;
1825
1950
  createV2StepImageToVideo(input: CreateV2StepImageToVideoInput, options?: V2RequestOptions): Promise<SamsarResult<V2StepVideoCreateResponse>>;
1826
1951
  getV2StepVideoStatus(requestId: string, options?: V2RequestOptions): Promise<SamsarResult<V2StepVideoStatusResponse>>;
1952
+ getV2StepVideoStatusDetailed(requestId: string, options?: V2RequestOptions): Promise<SamsarResult<V2StepVideoDetailedStatusResponse>>;
1953
+ getV2StepVideoDetailedStatus(requestId: string, options?: V2RequestOptions): Promise<SamsarResult<V2StepVideoDetailedStatusResponse>>;
1827
1954
  processNextV2StepVideo(requestId: string, options?: V2RequestOptions): Promise<SamsarResult<V2StepVideoStatusResponse>>;
1828
1955
  translateV2Video(input: TranslateVideoInput, options?: V2RequestOptions): Promise<SamsarResult<TranslateVideoResponse | ExternalRequestResponse>>;
1829
1956
  cloneV2Video(input: CloneVideoInput, options?: V2RequestOptions): Promise<SamsarResult<CloneVideoResponse>>;
@@ -1836,6 +1963,12 @@ export declare class SamsarClient {
1836
1963
  getV2Status(requestId: string, options?: V2RequestOptions & {
1837
1964
  queryParams?: QueryParams;
1838
1965
  }): Promise<SamsarResult<GlobalStatusResponse | ExternalStatusResponse>>;
1966
+ getV2StatusDetailed(requestId: string, options?: V2RequestOptions & {
1967
+ queryParams?: QueryParams;
1968
+ }): Promise<SamsarResult<GlobalStatusDetailedResponse | ExternalStatusDetailedResponse>>;
1969
+ getV2DetailedStatus(requestId: string, options?: V2RequestOptions & {
1970
+ queryParams?: QueryParams;
1971
+ }): Promise<SamsarResult<GlobalStatusDetailedResponse | ExternalStatusDetailedResponse>>;
1839
1972
  /**
1840
1973
  * Create a new video generation job from text.
1841
1974
  */
@@ -2211,6 +2344,12 @@ export declare class SamsarClient {
2211
2344
  getExternalStatus(requestId: string, options?: SamsarRequestOptions & {
2212
2345
  queryParams?: QueryParams;
2213
2346
  }): Promise<SamsarResult<ExternalStatusResponse>>;
2347
+ /**
2348
+ * Retrieve external-user status plus normalized video-session preview data.
2349
+ */
2350
+ getExternalStatusDetailed(requestId: string, options?: SamsarRequestOptions & {
2351
+ queryParams?: QueryParams;
2352
+ }): Promise<SamsarResult<ExternalStatusDetailedResponse>>;
2214
2353
  /**
2215
2354
  * Retrieve the status of an image request (maps to GET /image/status).
2216
2355
  */
package/dist/index.js CHANGED
@@ -631,6 +631,16 @@ export class SamsarClient {
631
631
  }
632
632
  return this.getV2(`video/step/${encodeURIComponent(normalizedRequestId)}/status`, options);
633
633
  }
634
+ async getV2StepVideoStatusDetailed(requestId, options) {
635
+ const normalizedRequestId = getTrimmedString(requestId);
636
+ if (!normalizedRequestId) {
637
+ throw new Error('requestId is required');
638
+ }
639
+ return this.getV2(`video/step/${encodeURIComponent(normalizedRequestId)}/status_detailed`, options);
640
+ }
641
+ async getV2StepVideoDetailedStatus(requestId, options) {
642
+ return this.getV2StepVideoStatusDetailed(requestId, options);
643
+ }
634
644
  async processNextV2StepVideo(requestId, options) {
635
645
  const normalizedRequestId = getTrimmedString(requestId);
636
646
  if (!normalizedRequestId) {
@@ -695,6 +705,22 @@ export class SamsarClient {
695
705
  queryParams,
696
706
  });
697
707
  }
708
+ async getV2StatusDetailed(requestId, options) {
709
+ const queryParams = {
710
+ ...(options?.externalUser
711
+ ? buildExternalUserQuery(options.externalUser, { requireProvider: false })
712
+ : {}),
713
+ ...(options?.queryParams ?? {}),
714
+ };
715
+ return this.getStatus(requestId, {
716
+ ...options,
717
+ path: this.buildV2Url('status_detailed'),
718
+ queryParams,
719
+ });
720
+ }
721
+ async getV2DetailedStatus(requestId, options) {
722
+ return this.getV2StatusDetailed(requestId, options);
723
+ }
698
724
  /**
699
725
  * Create a new video generation job from text.
700
726
  */
@@ -1960,6 +1986,16 @@ export class SamsarClient {
1960
1986
  });
1961
1987
  return response;
1962
1988
  }
1989
+ /**
1990
+ * Retrieve external-user status plus normalized video-session preview data.
1991
+ */
1992
+ async getExternalStatusDetailed(requestId, options) {
1993
+ const response = await this.getStatus(requestId, {
1994
+ ...options,
1995
+ path: 'external_users/status_detailed',
1996
+ });
1997
+ return response;
1998
+ }
1963
1999
  /**
1964
2000
  * Retrieve the status of an image request (maps to GET /image/status).
1965
2001
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "samsar-js",
3
- "version": "0.48.27",
3
+ "version": "0.48.28",
4
4
  "description": "TypeScript client for the Samsar Processor API routes.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",