From 9dc426ea0f5b84f4dbf4260b20e7f88e07b4ba5e Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Wed, 16 Oct 2024 23:39:14 -0600 Subject: [PATCH] Moar fragments! --- src/index.tsx | 176 ++++++++++++++++++++++----------------- src/operations/shots.gql | 9 -- src/operations/video.gql | 52 ++++++++---- 3 files changed, 135 insertions(+), 102 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 247c3e1..78d67ce 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2483,18 +2483,6 @@ export type GetShotsWithMetadataFilterResultQuery = { createdAt?: any | null; updatedAt?: any | null; user?: { __typename?: "UserGQL"; id: number } | null; - video?: { - __typename?: "VideoGQL"; - id: number; - stream?: { - __typename?: "UploadStreamGQL"; - resolution: { - __typename?: "VideoResolutionGQL"; - width?: number | null; - height?: number | null; - }; - } | null; - } | null; cueObjectFeatures?: { __typename?: "CueObjectFeaturesGQL"; cueObjectDistance?: number | null; @@ -2551,18 +2539,6 @@ export type GetShotsWithMetadataQuery = { createdAt?: any | null; updatedAt?: any | null; user?: { __typename?: "UserGQL"; id: number } | null; - video?: { - __typename?: "VideoGQL"; - id: number; - stream?: { - __typename?: "UploadStreamGQL"; - resolution: { - __typename?: "VideoResolutionGQL"; - width?: number | null; - height?: number | null; - }; - } | null; - } | null; cueObjectFeatures?: { __typename?: "CueObjectFeaturesGQL"; cueObjectDistance?: number | null; @@ -2612,18 +2588,6 @@ export type GetShotsByIdsQuery = { createdAt?: any | null; updatedAt?: any | null; user?: { __typename?: "UserGQL"; id: number } | null; - video?: { - __typename?: "VideoGQL"; - id: number; - stream?: { - __typename?: "UploadStreamGQL"; - resolution: { - __typename?: "VideoResolutionGQL"; - width?: number | null; - height?: number | null; - }; - } | null; - } | null; cueObjectFeatures?: { __typename?: "CueObjectFeaturesGQL"; cueObjectDistance?: number | null; @@ -2666,18 +2630,6 @@ export type ShotWithAllFeaturesFragment = { createdAt?: any | null; updatedAt?: any | null; user?: { __typename?: "UserGQL"; id: number } | null; - video?: { - __typename?: "VideoGQL"; - id: number; - stream?: { - __typename?: "UploadStreamGQL"; - resolution: { - __typename?: "VideoResolutionGQL"; - width?: number | null; - height?: number | null; - }; - } | null; - } | null; cueObjectFeatures?: { __typename?: "CueObjectFeaturesGQL"; cueObjectDistance?: number | null; @@ -3101,6 +3053,62 @@ export type GetMedianRunForVideoQuery = { getVideo: { __typename?: "VideoGQL"; id: number; medianRun?: number | null }; }; +export type StreamWithEndFramesFragment = { + __typename?: "UploadStreamGQL"; + id: string; + streamSegmentType: StreamSegmentTypeEnum; + segmentEndFrames: Array; + resolution: { + __typename?: "VideoResolutionGQL"; + width?: number | null; + height?: number | null; + }; + segments: Array<{ + __typename?: "UploadSegmentGQL"; + uploaded: boolean; + valid: boolean; + segmentIndex: number; + endFrameIndex?: number | null; + framesPerSecond?: number | null; + }>; +}; + +export type PlaylistWithSegmentStartTimesFragment = { + __typename?: "HLSPlaylistGQL"; + segmentDurations: Array; + segmentStartTimes: Array; +}; + +export type VideoDurationDataFragment = { + __typename?: "VideoGQL"; + id: number; + framesPerSecond: number; + playlist?: { + __typename?: "HLSPlaylistGQL"; + segmentDurations: Array; + segmentStartTimes: Array; + } | null; + stream?: { + __typename?: "UploadStreamGQL"; + id: string; + streamSegmentType: StreamSegmentTypeEnum; + segmentEndFrames: Array; + resolution: { + __typename?: "VideoResolutionGQL"; + width?: number | null; + height?: number | null; + }; + segments: Array<{ + __typename?: "UploadSegmentGQL"; + uploaded: boolean; + valid: boolean; + segmentIndex: number; + endFrameIndex?: number | null; + framesPerSecond?: number | null; + }>; + } | null; +}; + export type GetVideoForClipTimesQueryVariables = Exact<{ videoId: Scalars["Int"]["input"]; }>; @@ -3121,6 +3129,11 @@ export type GetVideoForClipTimesQuery = { id: string; streamSegmentType: StreamSegmentTypeEnum; segmentEndFrames: Array; + resolution: { + __typename?: "VideoResolutionGQL"; + width?: number | null; + height?: number | null; + }; segments: Array<{ __typename?: "UploadSegmentGQL"; uploaded: boolean; @@ -3331,15 +3344,6 @@ export const ShotWithAllFeaturesFragmentDoc = gql` id } falsePositiveScore - video { - id - stream { - resolution { - width - height - } - } - } createdAt updatedAt cueObjectFeatures { @@ -3387,6 +3391,44 @@ export const VideoStreamMetadataFragmentDoc = gql` } } `; +export const PlaylistWithSegmentStartTimesFragmentDoc = gql` + fragment PlaylistWithSegmentStartTimes on HLSPlaylistGQL { + segmentDurations + segmentStartTimes @client + } +`; +export const StreamWithEndFramesFragmentDoc = gql` + fragment StreamWithEndFrames on UploadStreamGQL { + id + streamSegmentType + segmentEndFrames @client + resolution { + width + height + } + segments { + uploaded + valid + segmentIndex + endFrameIndex + framesPerSecond + } + } +`; +export const VideoDurationDataFragmentDoc = gql` + fragment VideoDurationData on VideoGQL { + id + framesPerSecond + playlist { + ...PlaylistWithSegmentStartTimes + } + stream { + ...StreamWithEndFrames + } + } + ${PlaylistWithSegmentStartTimesFragmentDoc} + ${StreamWithEndFramesFragmentDoc} +`; export const GetAggregatedShotMetricsDocument = gql` query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) { getAggregatedShotMetrics(aggregateInput: $aggregateInput) { @@ -5491,26 +5533,10 @@ export type GetMedianRunForVideoQueryResult = Apollo.QueryResult< export const GetVideoForClipTimesDocument = gql` query GetVideoForClipTimes($videoId: Int!) { getVideo(videoId: $videoId) { - id - framesPerSecond - playlist { - segmentDurations - segmentStartTimes - } - stream { - id - streamSegmentType - segmentEndFrames - segments { - uploaded - valid - segmentIndex - endFrameIndex - framesPerSecond - } - } + ...VideoDurationData } } + ${VideoDurationDataFragmentDoc} `; /** diff --git a/src/operations/shots.gql b/src/operations/shots.gql index 327a941..a04d574 100644 --- a/src/operations/shots.gql +++ b/src/operations/shots.gql @@ -90,15 +90,6 @@ fragment ShotWithAllFeatures on ShotGQL { id } falsePositiveScore - video { - id - stream { - resolution { - width - height - } - } - } createdAt updatedAt cueObjectFeatures { diff --git a/src/operations/video.gql b/src/operations/video.gql index f86ac63..5d44ff8 100644 --- a/src/operations/video.gql +++ b/src/operations/video.gql @@ -229,26 +229,42 @@ query GetMedianRunForVideo($videoId: Int!) { } } +fragment StreamWithEndFrames on UploadStreamGQL { + id + streamSegmentType + segmentEndFrames @client + resolution { + width + height + } + segments { + uploaded + valid + segmentIndex + endFrameIndex + framesPerSecond + } +} + +fragment PlaylistWithSegmentStartTimes on HLSPlaylistGQL { + segmentDurations + segmentStartTimes @client +} + +fragment VideoDurationData on VideoGQL { + id + framesPerSecond + playlist { + ...PlaylistWithSegmentStartTimes + } + stream { + ...StreamWithEndFrames + } +} + query GetVideoForClipTimes($videoId: Int!) { getVideo(videoId: $videoId) { - id - framesPerSecond - playlist { - segmentDurations - segmentStartTimes - } - stream { - id - streamSegmentType - segmentEndFrames - segments { - uploaded - valid - segmentIndex - endFrameIndex - framesPerSecond - } - } + ...VideoDurationData } }