muxinc / mux-node-sdk

Official Mux API wrapper for Node projects, supporting both Mux Data and Mux Video.
https://mux.com/for/node
Apache License 2.0
156 stars 60 forks source link

Asset.created_at type is wrong. #422

Open ryanleecode opened 4 months ago

ryanleecode commented 4 months ago

The webhook passes it as a number but in the types its defined as a string.

ParseError: ((JsonString <-> unknown) <-> { readonly type: "video.asset.ready"; readonly id: string; readonly data: ({ readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } <-> { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: ("preparing" | "ready" | "errored" <-> "ready"); readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: ({ readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } <-> never) | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined }) } | { readonly type: "video.asset.errored"; readonly id: string; readonly data: ({ readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } <-> { readonly id: string; readonly status: ("preparing" | "ready" | "errored" <-> "errored"); readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined }) } | { readonly id: string; readonly type: string & Brand<"video.asset.*">; readonly data: { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } })
└─ Type side transformation failure
   └─ { readonly type: "video.asset.ready"; readonly id: string; readonly data: ({ readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } <-> { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: ("preparing" | "ready" | "errored" <-> "ready"); readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: ({ readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } <-> never) | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined }) } | { readonly type: "video.asset.errored"; readonly id: string; readonly data: ({ readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } <-> { readonly id: string; readonly status: ("preparing" | "ready" | "errored" <-> "errored"); readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined }) } | { readonly id: string; readonly type: string & Brand<"video.asset.*">; readonly data: { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } }
      ├─ Union member
      │  └─ { readonly type: "video.asset.ready"; readonly id: string; readonly data: ({ readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } <-> { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: ("preparing" | "ready" | "errored" <-> "ready"); readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: ({ readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } <-> never) | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined }) }
      │     └─ ["data"]
      │        └─ ({ readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } <-> { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: ("preparing" | "ready" | "errored" <-> "ready"); readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: ({ readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } <-> never) | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined })
      │           └─ Encoded side transformation failure
      │              └─ { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined }
      │                 └─ ["created_at"]
      │                    └─ Expected a string, actual 1717971887
      └─ Union member
         └─ { readonly id: string; readonly type: string & Brand<"video.asset.*">; readonly data: { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined } }
            └─ ["data"]
               └─ { readonly id: string; readonly created_at: string; readonly encoding_tier: "smart" | "baseline"; readonly master_access: "temporary" | "none"; readonly max_resolution_tier: "1080p" | "1440p" | "2160p"; readonly mp4_support: "standard" | "none" | "capped-1080p" | "audio-only" | "audio-only,capped-1080p"; readonly status: "preparing" | "ready" | "errored"; readonly aspect_ratio?: string | undefined; readonly duration?: number | undefined; readonly errors?: { readonly messages?: ReadonlyArray<string> | undefined; readonly type?: string | undefined } | undefined; readonly ingest_type?: "on_demand_url" | "on_demand_direct_upload" | "on_demand_clip" | "live_rtmp" | "live_srt" | undefined; readonly is_live?: boolean | undefined; readonly live_stream_id?: string | undefined; readonly max_stored_frame_rate?: number | undefined; readonly max_stored_resolution?: "Audio only" | "SD" | "HD" | "FHD" | "UHD" | undefined; readonly normalize_audio?: boolean | undefined; readonly passthrough?: string | undefined; readonly per_title_encode?: boolean | undefined; readonly playback_ids?: ReadonlyArray<{ readonly id: string; readonly policy: "public" | "signed" }> | undefined; readonly resolution_tier?: "audio-only" | "720p" | "1080p" | "1440p" | "2160p" | undefined; readonly source_asset_id?: string | undefined; readonly test?: boolean | undefined; readonly upload_id?: string | undefined }
                  └─ ["created_at"]
                     └─ Expected a string, actual 1717971887
philcluff commented 4 months ago

Hey @ryanleecode, thanks for raising this - we're discussing internally to what might be the best way to address this issue.

Thanks.