@stack0/sdk 0.5.18 → 0.6.1

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.
@@ -551,6 +551,14 @@ interface CdnUsageRequest {
551
551
  environment?: CdnEnvironment;
552
552
  periodStart?: Date | string;
553
553
  periodEnd?: Date | string;
554
+ /**
555
+ * Virtual folder path to scope the stats to, e.g. "/customers/acme". Covers the folder
556
+ * itself and everything nested under it — the same scoping as `getStorageUsage`. Use
557
+ * this to meter bandwidth per tenant when each tenant uploads under its own folder.
558
+ * Folder-scoped stats only cover assets that still exist; deleting an asset removes
559
+ * its serving history, so a period total can shrink.
560
+ */
561
+ folder?: string;
554
562
  }
555
563
  interface CdnUsageResponse {
556
564
  periodStart: Date;
@@ -563,6 +571,12 @@ interface CdnUsageResponse {
563
571
  storageFormatted: string;
564
572
  estimatedCostCents: number;
565
573
  estimatedCostFormatted: string;
574
+ /**
575
+ * Echoes the folder the stats cover, null when the whole project or org was counted.
576
+ * When metering a tenant, check this echo — a server that predates folder scoping
577
+ * ignores the parameter and silently returns org-wide numbers.
578
+ */
579
+ folder: string | null;
566
580
  }
567
581
  interface CdnUsageHistoryRequest {
568
582
  projectSlug?: string;
@@ -947,6 +961,107 @@ interface ListMergeJobsResponse {
947
961
  total: number;
948
962
  hasMore: boolean;
949
963
  }
964
+ type RenderStatus = TranscodingStatus;
965
+ type RenderOutputFormat = "mp4" | "webm";
966
+ /**
967
+ * The declarative video spec.
968
+ *
969
+ * Typed loosely on purpose. The authoritative schema lives in
970
+ * `@stack0/video-spec`, which also ships worked examples and the timing engine;
971
+ * restating its shape here would create a second description of one contract
972
+ * that silently drifts. Install that package for full types and validation:
973
+ *
974
+ * ```typescript
975
+ * import { validateSpec, prankWithDemoExample } from '@stack0/video-spec'
976
+ * ```
977
+ */
978
+ type VideoSpec = Record<string, unknown>;
979
+ /**
980
+ * How the finished video is encoded.
981
+ *
982
+ * There is no quality or aspect ratio here: the spec's canvas declares width,
983
+ * height and fps, so scale is the only encode-side lever left.
984
+ */
985
+ interface RenderOutputConfig {
986
+ /** Container and codec: mp4/h264 or webm/vp8 (default: mp4) */
987
+ format?: RenderOutputFormat;
988
+ /** Multiplier on the spec's canvas, 0.1-4 (default: 1). Cost scales with the square of this. */
989
+ scale?: number;
990
+ /** Custom filename for the output */
991
+ filename?: string;
992
+ }
993
+ /**
994
+ * Request to render a video spec
995
+ */
996
+ interface CreateRenderJobRequest {
997
+ /** Project slug to create the render job in */
998
+ projectSlug: string;
999
+ /** The video spec: scenes, layers, timing and media. Data, not code. */
1000
+ spec: VideoSpec;
1001
+ /** Output configuration */
1002
+ output?: RenderOutputConfig;
1003
+ /** Webhook URL for completion notification */
1004
+ webhookUrl?: string;
1005
+ }
1006
+ /**
1007
+ * Request to list render jobs
1008
+ */
1009
+ interface ListRenderJobsRequest {
1010
+ projectSlug: string;
1011
+ /** Filter by status */
1012
+ status?: RenderStatus;
1013
+ /** Maximum number of results (default: 20, max: 100) */
1014
+ limit?: number;
1015
+ /** Offset for pagination */
1016
+ offset?: number;
1017
+ }
1018
+ /**
1019
+ * Render job response
1020
+ */
1021
+ interface RenderJob {
1022
+ id: string;
1023
+ organizationId: string;
1024
+ projectId: string;
1025
+ environment: "sandbox" | "production";
1026
+ /** The submitted spec, with media references resolved to URLs */
1027
+ spec: VideoSpec;
1028
+ outputFormat: RenderOutputFormat;
1029
+ outputScale: number;
1030
+ outputFilename: string | null;
1031
+ outputAssetId: string | null;
1032
+ status: RenderStatus;
1033
+ progress: number | null;
1034
+ errorMessage: string | null;
1035
+ startedAt: Date | null;
1036
+ completedAt: Date | null;
1037
+ /** Resolved from the spec at submission, before a single frame renders */
1038
+ width: number | null;
1039
+ height: number | null;
1040
+ fps: number | null;
1041
+ durationInFrames: number | null;
1042
+ outputDurationSeconds: number | null;
1043
+ webhookUrl: string | null;
1044
+ createdAt: Date;
1045
+ updatedAt: Date | null;
1046
+ }
1047
+ /**
1048
+ * Render job with output asset details
1049
+ */
1050
+ interface RenderJobWithOutput extends RenderJob {
1051
+ outputAsset: {
1052
+ id: string;
1053
+ cdnUrl: string;
1054
+ directUrl: string;
1055
+ filename: string;
1056
+ size: number;
1057
+ duration: number | null;
1058
+ } | null;
1059
+ }
1060
+ interface ListRenderJobsResponse {
1061
+ jobs: RenderJob[];
1062
+ total: number;
1063
+ hasMore: boolean;
1064
+ }
950
1065
  type ImportJobStatus = "pending" | "validating" | "importing" | "completed" | "failed" | "cancelled";
951
1066
  type ImportAuthType = "iam_credentials" | "role_assumption";
952
1067
  type ImportPathMode = "preserve" | "flatten";
@@ -1954,6 +2069,78 @@ declare class CDN {
1954
2069
  }>;
1955
2070
  private convertMergeJobDates;
1956
2071
  private convertMergeJobWithOutputDates;
2072
+ /**
2073
+ * Render a declarative video spec into a video asset
2074
+ *
2075
+ * The spec describes scenes, layers, timing and media as data. There are no
2076
+ * compositions to write and no code to upload — Stack0 owns the renderer.
2077
+ *
2078
+ * `@stack0/video-spec` has the full types, validation and worked examples;
2079
+ * validating locally before you POST turns a round trip into a type error.
2080
+ *
2081
+ * @example
2082
+ * ```typescript
2083
+ * const job = await cdn.createRenderJob({
2084
+ * projectSlug: 'my-project',
2085
+ * spec: {
2086
+ * canvas: { width: 1080, height: 1920, fps: 30 },
2087
+ * audio: [{ src: musicAssetId, volume: 0.34 }],
2088
+ * scenes: [
2089
+ * {
2090
+ * id: 'hook',
2091
+ * duration: 2.5,
2092
+ * layers: [
2093
+ * { type: 'image', src: afterImageAssetId, zoom: { from: 1, to: 1.06 } },
2094
+ * { type: 'caption', text: 'i told my mom\nthe kitchen exploded', position: 'upperThird' },
2095
+ * ],
2096
+ * },
2097
+ * {
2098
+ * // No duration: the thread derives its own length from the messages
2099
+ * id: 'payoff',
2100
+ * layers: [
2101
+ * {
2102
+ * type: 'messageThread',
2103
+ * recipient: 'Mom',
2104
+ * imageSrc: afterImageAssetId,
2105
+ * messages: [
2106
+ * { sender: 'recipient', text: 'you home?', history: true },
2107
+ * { sender: 'user', text: '[IMAGE]' },
2108
+ * { sender: 'recipient', text: 'WHAT IS THAT' },
2109
+ * ],
2110
+ * },
2111
+ * ],
2112
+ * },
2113
+ * ],
2114
+ * },
2115
+ * webhookUrl: 'https://your-app.com/webhook',
2116
+ * });
2117
+ * console.log(job.durationInFrames); // known before rendering starts
2118
+ * ```
2119
+ */
2120
+ createRenderJob(request: CreateRenderJobRequest): Promise<RenderJob>;
2121
+ /**
2122
+ * Get a render job by ID with output asset details
2123
+ *
2124
+ * @example
2125
+ * ```typescript
2126
+ * const job = await cdn.getRenderJob('job-id');
2127
+ * if (job.status === 'completed' && job.outputAsset) {
2128
+ * console.log(`Output video: ${job.outputAsset.cdnUrl}`);
2129
+ * }
2130
+ * ```
2131
+ */
2132
+ getRenderJob(jobId: string): Promise<RenderJobWithOutput>;
2133
+ /**
2134
+ * List render jobs with optional filters
2135
+ */
2136
+ listRenderJobs(request: ListRenderJobsRequest): Promise<ListRenderJobsResponse>;
2137
+ /**
2138
+ * Cancel a pending or processing render job
2139
+ */
2140
+ cancelRenderJob(jobId: string): Promise<{
2141
+ success: boolean;
2142
+ }>;
2143
+ private convertRenderJobDates;
1957
2144
  /**
1958
2145
  * Create an S3 import job to bulk import files from an external S3 bucket.
1959
2146
  * Requires Pro plan or higher.
@@ -2071,4 +2258,4 @@ declare class CDN {
2071
2258
  private convertImportFileDates;
2072
2259
  }
2073
2260
 
2074
- export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelImportResponse, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnStorageUsageBucket, type CdnStorageUsageRequest, type CdnStorageUsageResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type CompositeChromaKey, type CompositeConfig, type CompositePoint, type CompositeQuad, type CompositeRect, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateImportRequest, type CreateImportResponse, type CreateMergeJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GenerateGifRequest, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type GifStatus, type ImageVideoWatermarkOptions, type ImageWatermarkConfig, type ImageWatermarkPosition, type ImageWatermarkSizingMode, type ImportAuthType, type ImportError, type ImportFile, type ImportFileStatus, type ImportJob, type ImportJobStatus, type ImportJobSummary, type ImportPathMode, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListGifsRequest, type ListImportFilesRequest, type ListImportFilesResponse, type ListImportsRequest, type ListImportsResponse, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeAspectRatio, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type RetryImportResponse, type StreamingUrls, type TextOverlay, type TextOverlayShadow, type TextOverlayStroke, type TextVideoWatermarkOptions, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadFromUrlRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoGif, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
2261
+ export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelImportResponse, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnStorageUsageBucket, type CdnStorageUsageRequest, type CdnStorageUsageResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type CompositeChromaKey, type CompositeConfig, type CompositePoint, type CompositeQuad, type CompositeRect, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateImportRequest, type CreateImportResponse, type CreateMergeJobRequest, type CreateRenderJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GenerateGifRequest, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type GifStatus, type ImageVideoWatermarkOptions, type ImageWatermarkConfig, type ImageWatermarkPosition, type ImageWatermarkSizingMode, type ImportAuthType, type ImportError, type ImportFile, type ImportFileStatus, type ImportJob, type ImportJobStatus, type ImportJobSummary, type ImportPathMode, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListGifsRequest, type ListImportFilesRequest, type ListImportFilesResponse, type ListImportsRequest, type ListImportsResponse, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListRenderJobsRequest, type ListRenderJobsResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeAspectRatio, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type RenderJob, type RenderJobWithOutput, type RenderOutputConfig, type RenderOutputFormat, type RenderStatus, type RetryImportResponse, type StreamingUrls, type TextOverlay, type TextOverlayShadow, type TextOverlayStroke, type TextVideoWatermarkOptions, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadFromUrlRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoGif, type VideoOutputFormat, type VideoQuality, type VideoSpec, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
@@ -551,6 +551,14 @@ interface CdnUsageRequest {
551
551
  environment?: CdnEnvironment;
552
552
  periodStart?: Date | string;
553
553
  periodEnd?: Date | string;
554
+ /**
555
+ * Virtual folder path to scope the stats to, e.g. "/customers/acme". Covers the folder
556
+ * itself and everything nested under it — the same scoping as `getStorageUsage`. Use
557
+ * this to meter bandwidth per tenant when each tenant uploads under its own folder.
558
+ * Folder-scoped stats only cover assets that still exist; deleting an asset removes
559
+ * its serving history, so a period total can shrink.
560
+ */
561
+ folder?: string;
554
562
  }
555
563
  interface CdnUsageResponse {
556
564
  periodStart: Date;
@@ -563,6 +571,12 @@ interface CdnUsageResponse {
563
571
  storageFormatted: string;
564
572
  estimatedCostCents: number;
565
573
  estimatedCostFormatted: string;
574
+ /**
575
+ * Echoes the folder the stats cover, null when the whole project or org was counted.
576
+ * When metering a tenant, check this echo — a server that predates folder scoping
577
+ * ignores the parameter and silently returns org-wide numbers.
578
+ */
579
+ folder: string | null;
566
580
  }
567
581
  interface CdnUsageHistoryRequest {
568
582
  projectSlug?: string;
@@ -947,6 +961,107 @@ interface ListMergeJobsResponse {
947
961
  total: number;
948
962
  hasMore: boolean;
949
963
  }
964
+ type RenderStatus = TranscodingStatus;
965
+ type RenderOutputFormat = "mp4" | "webm";
966
+ /**
967
+ * The declarative video spec.
968
+ *
969
+ * Typed loosely on purpose. The authoritative schema lives in
970
+ * `@stack0/video-spec`, which also ships worked examples and the timing engine;
971
+ * restating its shape here would create a second description of one contract
972
+ * that silently drifts. Install that package for full types and validation:
973
+ *
974
+ * ```typescript
975
+ * import { validateSpec, prankWithDemoExample } from '@stack0/video-spec'
976
+ * ```
977
+ */
978
+ type VideoSpec = Record<string, unknown>;
979
+ /**
980
+ * How the finished video is encoded.
981
+ *
982
+ * There is no quality or aspect ratio here: the spec's canvas declares width,
983
+ * height and fps, so scale is the only encode-side lever left.
984
+ */
985
+ interface RenderOutputConfig {
986
+ /** Container and codec: mp4/h264 or webm/vp8 (default: mp4) */
987
+ format?: RenderOutputFormat;
988
+ /** Multiplier on the spec's canvas, 0.1-4 (default: 1). Cost scales with the square of this. */
989
+ scale?: number;
990
+ /** Custom filename for the output */
991
+ filename?: string;
992
+ }
993
+ /**
994
+ * Request to render a video spec
995
+ */
996
+ interface CreateRenderJobRequest {
997
+ /** Project slug to create the render job in */
998
+ projectSlug: string;
999
+ /** The video spec: scenes, layers, timing and media. Data, not code. */
1000
+ spec: VideoSpec;
1001
+ /** Output configuration */
1002
+ output?: RenderOutputConfig;
1003
+ /** Webhook URL for completion notification */
1004
+ webhookUrl?: string;
1005
+ }
1006
+ /**
1007
+ * Request to list render jobs
1008
+ */
1009
+ interface ListRenderJobsRequest {
1010
+ projectSlug: string;
1011
+ /** Filter by status */
1012
+ status?: RenderStatus;
1013
+ /** Maximum number of results (default: 20, max: 100) */
1014
+ limit?: number;
1015
+ /** Offset for pagination */
1016
+ offset?: number;
1017
+ }
1018
+ /**
1019
+ * Render job response
1020
+ */
1021
+ interface RenderJob {
1022
+ id: string;
1023
+ organizationId: string;
1024
+ projectId: string;
1025
+ environment: "sandbox" | "production";
1026
+ /** The submitted spec, with media references resolved to URLs */
1027
+ spec: VideoSpec;
1028
+ outputFormat: RenderOutputFormat;
1029
+ outputScale: number;
1030
+ outputFilename: string | null;
1031
+ outputAssetId: string | null;
1032
+ status: RenderStatus;
1033
+ progress: number | null;
1034
+ errorMessage: string | null;
1035
+ startedAt: Date | null;
1036
+ completedAt: Date | null;
1037
+ /** Resolved from the spec at submission, before a single frame renders */
1038
+ width: number | null;
1039
+ height: number | null;
1040
+ fps: number | null;
1041
+ durationInFrames: number | null;
1042
+ outputDurationSeconds: number | null;
1043
+ webhookUrl: string | null;
1044
+ createdAt: Date;
1045
+ updatedAt: Date | null;
1046
+ }
1047
+ /**
1048
+ * Render job with output asset details
1049
+ */
1050
+ interface RenderJobWithOutput extends RenderJob {
1051
+ outputAsset: {
1052
+ id: string;
1053
+ cdnUrl: string;
1054
+ directUrl: string;
1055
+ filename: string;
1056
+ size: number;
1057
+ duration: number | null;
1058
+ } | null;
1059
+ }
1060
+ interface ListRenderJobsResponse {
1061
+ jobs: RenderJob[];
1062
+ total: number;
1063
+ hasMore: boolean;
1064
+ }
950
1065
  type ImportJobStatus = "pending" | "validating" | "importing" | "completed" | "failed" | "cancelled";
951
1066
  type ImportAuthType = "iam_credentials" | "role_assumption";
952
1067
  type ImportPathMode = "preserve" | "flatten";
@@ -1954,6 +2069,78 @@ declare class CDN {
1954
2069
  }>;
1955
2070
  private convertMergeJobDates;
1956
2071
  private convertMergeJobWithOutputDates;
2072
+ /**
2073
+ * Render a declarative video spec into a video asset
2074
+ *
2075
+ * The spec describes scenes, layers, timing and media as data. There are no
2076
+ * compositions to write and no code to upload — Stack0 owns the renderer.
2077
+ *
2078
+ * `@stack0/video-spec` has the full types, validation and worked examples;
2079
+ * validating locally before you POST turns a round trip into a type error.
2080
+ *
2081
+ * @example
2082
+ * ```typescript
2083
+ * const job = await cdn.createRenderJob({
2084
+ * projectSlug: 'my-project',
2085
+ * spec: {
2086
+ * canvas: { width: 1080, height: 1920, fps: 30 },
2087
+ * audio: [{ src: musicAssetId, volume: 0.34 }],
2088
+ * scenes: [
2089
+ * {
2090
+ * id: 'hook',
2091
+ * duration: 2.5,
2092
+ * layers: [
2093
+ * { type: 'image', src: afterImageAssetId, zoom: { from: 1, to: 1.06 } },
2094
+ * { type: 'caption', text: 'i told my mom\nthe kitchen exploded', position: 'upperThird' },
2095
+ * ],
2096
+ * },
2097
+ * {
2098
+ * // No duration: the thread derives its own length from the messages
2099
+ * id: 'payoff',
2100
+ * layers: [
2101
+ * {
2102
+ * type: 'messageThread',
2103
+ * recipient: 'Mom',
2104
+ * imageSrc: afterImageAssetId,
2105
+ * messages: [
2106
+ * { sender: 'recipient', text: 'you home?', history: true },
2107
+ * { sender: 'user', text: '[IMAGE]' },
2108
+ * { sender: 'recipient', text: 'WHAT IS THAT' },
2109
+ * ],
2110
+ * },
2111
+ * ],
2112
+ * },
2113
+ * ],
2114
+ * },
2115
+ * webhookUrl: 'https://your-app.com/webhook',
2116
+ * });
2117
+ * console.log(job.durationInFrames); // known before rendering starts
2118
+ * ```
2119
+ */
2120
+ createRenderJob(request: CreateRenderJobRequest): Promise<RenderJob>;
2121
+ /**
2122
+ * Get a render job by ID with output asset details
2123
+ *
2124
+ * @example
2125
+ * ```typescript
2126
+ * const job = await cdn.getRenderJob('job-id');
2127
+ * if (job.status === 'completed' && job.outputAsset) {
2128
+ * console.log(`Output video: ${job.outputAsset.cdnUrl}`);
2129
+ * }
2130
+ * ```
2131
+ */
2132
+ getRenderJob(jobId: string): Promise<RenderJobWithOutput>;
2133
+ /**
2134
+ * List render jobs with optional filters
2135
+ */
2136
+ listRenderJobs(request: ListRenderJobsRequest): Promise<ListRenderJobsResponse>;
2137
+ /**
2138
+ * Cancel a pending or processing render job
2139
+ */
2140
+ cancelRenderJob(jobId: string): Promise<{
2141
+ success: boolean;
2142
+ }>;
2143
+ private convertRenderJobDates;
1957
2144
  /**
1958
2145
  * Create an S3 import job to bulk import files from an external S3 bucket.
1959
2146
  * Requires Pro plan or higher.
@@ -2071,4 +2258,4 @@ declare class CDN {
2071
2258
  private convertImportFileDates;
2072
2259
  }
2073
2260
 
2074
- export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelImportResponse, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnStorageUsageBucket, type CdnStorageUsageRequest, type CdnStorageUsageResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type CompositeChromaKey, type CompositeConfig, type CompositePoint, type CompositeQuad, type CompositeRect, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateImportRequest, type CreateImportResponse, type CreateMergeJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GenerateGifRequest, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type GifStatus, type ImageVideoWatermarkOptions, type ImageWatermarkConfig, type ImageWatermarkPosition, type ImageWatermarkSizingMode, type ImportAuthType, type ImportError, type ImportFile, type ImportFileStatus, type ImportJob, type ImportJobStatus, type ImportJobSummary, type ImportPathMode, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListGifsRequest, type ListImportFilesRequest, type ListImportFilesResponse, type ListImportsRequest, type ListImportsResponse, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeAspectRatio, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type RetryImportResponse, type StreamingUrls, type TextOverlay, type TextOverlayShadow, type TextOverlayStroke, type TextVideoWatermarkOptions, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadFromUrlRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoGif, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
2261
+ export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelImportResponse, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnStorageUsageBucket, type CdnStorageUsageRequest, type CdnStorageUsageResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type CompositeChromaKey, type CompositeConfig, type CompositePoint, type CompositeQuad, type CompositeRect, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateImportRequest, type CreateImportResponse, type CreateMergeJobRequest, type CreateRenderJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GenerateGifRequest, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type GifStatus, type ImageVideoWatermarkOptions, type ImageWatermarkConfig, type ImageWatermarkPosition, type ImageWatermarkSizingMode, type ImportAuthType, type ImportError, type ImportFile, type ImportFileStatus, type ImportJob, type ImportJobStatus, type ImportJobSummary, type ImportPathMode, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListGifsRequest, type ListImportFilesRequest, type ListImportFilesResponse, type ListImportsRequest, type ListImportsResponse, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListRenderJobsRequest, type ListRenderJobsResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeAspectRatio, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type RenderJob, type RenderJobWithOutput, type RenderOutputConfig, type RenderOutputFormat, type RenderStatus, type RetryImportResponse, type StreamingUrls, type TextOverlay, type TextOverlayShadow, type TextOverlayStroke, type TextVideoWatermarkOptions, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadFromUrlRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoGif, type VideoOutputFormat, type VideoQuality, type VideoSpec, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
package/dist/cdn/index.js CHANGED
@@ -1005,6 +1005,7 @@ var CDN = class {
1005
1005
  const params = new URLSearchParams();
1006
1006
  if (request.projectSlug) params.set("projectSlug", request.projectSlug);
1007
1007
  if (request.environment) params.set("environment", request.environment);
1008
+ if (request.folder) params.set("folder", request.folder);
1008
1009
  if (request.periodStart) {
1009
1010
  const date = request.periodStart instanceof Date ? request.periodStart.toISOString() : request.periodStart;
1010
1011
  params.set("periodStart", date);
@@ -1370,6 +1371,112 @@ var CDN = class {
1370
1371
  return this.convertMergeJobDates(job);
1371
1372
  }
1372
1373
  // ============================================================================
1374
+ // Video Render Methods
1375
+ // ============================================================================
1376
+ /**
1377
+ * Render a declarative video spec into a video asset
1378
+ *
1379
+ * The spec describes scenes, layers, timing and media as data. There are no
1380
+ * compositions to write and no code to upload — Stack0 owns the renderer.
1381
+ *
1382
+ * `@stack0/video-spec` has the full types, validation and worked examples;
1383
+ * validating locally before you POST turns a round trip into a type error.
1384
+ *
1385
+ * @example
1386
+ * ```typescript
1387
+ * const job = await cdn.createRenderJob({
1388
+ * projectSlug: 'my-project',
1389
+ * spec: {
1390
+ * canvas: { width: 1080, height: 1920, fps: 30 },
1391
+ * audio: [{ src: musicAssetId, volume: 0.34 }],
1392
+ * scenes: [
1393
+ * {
1394
+ * id: 'hook',
1395
+ * duration: 2.5,
1396
+ * layers: [
1397
+ * { type: 'image', src: afterImageAssetId, zoom: { from: 1, to: 1.06 } },
1398
+ * { type: 'caption', text: 'i told my mom\nthe kitchen exploded', position: 'upperThird' },
1399
+ * ],
1400
+ * },
1401
+ * {
1402
+ * // No duration: the thread derives its own length from the messages
1403
+ * id: 'payoff',
1404
+ * layers: [
1405
+ * {
1406
+ * type: 'messageThread',
1407
+ * recipient: 'Mom',
1408
+ * imageSrc: afterImageAssetId,
1409
+ * messages: [
1410
+ * { sender: 'recipient', text: 'you home?', history: true },
1411
+ * { sender: 'user', text: '[IMAGE]' },
1412
+ * { sender: 'recipient', text: 'WHAT IS THAT' },
1413
+ * ],
1414
+ * },
1415
+ * ],
1416
+ * },
1417
+ * ],
1418
+ * },
1419
+ * webhookUrl: 'https://your-app.com/webhook',
1420
+ * });
1421
+ * console.log(job.durationInFrames); // known before rendering starts
1422
+ * ```
1423
+ */
1424
+ async createRenderJob(request) {
1425
+ const response = await this.http.post("/cdn/video/render", request);
1426
+ return this.convertRenderJobDates(response);
1427
+ }
1428
+ /**
1429
+ * Get a render job by ID with output asset details
1430
+ *
1431
+ * @example
1432
+ * ```typescript
1433
+ * const job = await cdn.getRenderJob('job-id');
1434
+ * if (job.status === 'completed' && job.outputAsset) {
1435
+ * console.log(`Output video: ${job.outputAsset.cdnUrl}`);
1436
+ * }
1437
+ * ```
1438
+ */
1439
+ async getRenderJob(jobId) {
1440
+ const response = await this.http.get(`/cdn/video/render/${jobId}`);
1441
+ return this.convertRenderJobDates(response);
1442
+ }
1443
+ /**
1444
+ * List render jobs with optional filters
1445
+ */
1446
+ async listRenderJobs(request) {
1447
+ const params = new URLSearchParams();
1448
+ params.set("projectSlug", request.projectSlug);
1449
+ if (request.status) params.set("status", request.status);
1450
+ if (request.limit) params.set("limit", request.limit.toString());
1451
+ if (request.offset) params.set("offset", request.offset.toString());
1452
+ const response = await this.http.get(`/cdn/video/render?${params.toString()}`);
1453
+ return {
1454
+ ...response,
1455
+ jobs: response.jobs.map((job) => this.convertRenderJobDates(job))
1456
+ };
1457
+ }
1458
+ /**
1459
+ * Cancel a pending or processing render job
1460
+ */
1461
+ async cancelRenderJob(jobId) {
1462
+ return this.http.post(`/cdn/video/render/${jobId}/cancel`, {});
1463
+ }
1464
+ convertRenderJobDates(job) {
1465
+ if (typeof job.createdAt === "string") {
1466
+ job.createdAt = new Date(job.createdAt);
1467
+ }
1468
+ if (job.updatedAt && typeof job.updatedAt === "string") {
1469
+ job.updatedAt = new Date(job.updatedAt);
1470
+ }
1471
+ if (job.startedAt && typeof job.startedAt === "string") {
1472
+ job.startedAt = new Date(job.startedAt);
1473
+ }
1474
+ if (job.completedAt && typeof job.completedAt === "string") {
1475
+ job.completedAt = new Date(job.completedAt);
1476
+ }
1477
+ return job;
1478
+ }
1479
+ // ============================================================================
1373
1480
  // S3 Import Methods
1374
1481
  // ============================================================================
1375
1482
  /**