Add getUploadLinks batch mutation (schema + operation)
All checks were successful
Tests / Tests (pull_request) Successful in 38s

Batched counterpart to getUploadLink: one validation pass server-side,
N locally-signed URLs per round-trip, already-acknowledged indexes
returned in alreadyUploaded. Schema grafted additively (a full
gql-export from BE master would drop schema entries belonging to
not-yet-merged BE branches).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dean Wenstrand
2026-07-23 00:31:18 -07:00
parent 1914b2f5c0
commit 0eb627479a
3 changed files with 248 additions and 0 deletions

View File

@@ -2391,6 +2391,12 @@ export type GetUploadLinkReturn = {
value: UploadLinkGetUploadLinkErrors;
};
export type GetUploadLinksReturn = {
__typename?: "GetUploadLinksReturn";
stream?: Maybe<UploadStreamGql>;
value: UploadLinkBatchGetUploadLinkErrors;
};
export type HlsPlaylistGql = {
__typename?: "HLSPlaylistGQL";
m3u8Text: Scalars["String"]["output"];
@@ -2547,6 +2553,7 @@ export type Mutation = {
getHlsInitUploadLink: GetUploadLinkReturn;
getProfileImageUploadLink: GetProfileUploadLinkReturn;
getUploadLink: GetUploadLinkReturn;
getUploadLinks: GetUploadLinksReturn;
grantManualEntitlement: UserSubscriptionStatusGql;
inviteUsersToChallenge: Array<ChallengeInvitation>;
markAllNotificationsAsRead: Scalars["Boolean"]["output"];
@@ -2731,6 +2738,11 @@ export type MutationGetUploadLinkArgs = {
videoId: Scalars["Int"]["input"];
};
export type MutationGetUploadLinksArgs = {
segmentIndexes: Array<Scalars["Int"]["input"]>;
videoId: Scalars["Int"]["input"];
};
export type MutationGrantManualEntitlementArgs = {
endsAt?: InputMaybe<Scalars["DateTime"]["input"]>;
reason?: InputMaybe<Scalars["String"]["input"]>;
@@ -3571,6 +3583,13 @@ export type SegmentStartTimesGql = {
segmentStartTimes: Array<Scalars["Float"]["output"]>;
};
export type SegmentUploadLink = {
__typename?: "SegmentUploadLink";
headers: Array<Maybe<Header>>;
segmentIndex: Scalars["Int"]["output"];
uploadUrl: Scalars["String"]["output"];
};
export type SerializedShotPathsGql = {
__typename?: "SerializedShotPathsGQL";
b64EncodedBuffer?: Maybe<Scalars["String"]["output"]>;
@@ -4111,6 +4130,16 @@ export type UploadLink = {
uploadUrl: Scalars["String"]["output"];
};
export type UploadLinkBatch = {
__typename?: "UploadLinkBatch";
alreadyUploaded: Array<Scalars["Int"]["output"]>;
links: Array<SegmentUploadLink>;
};
export type UploadLinkBatchGetUploadLinkErrors =
| GetUploadLinkErrors
| UploadLinkBatch;
export type UploadLinkGetProfileUploadLinkErrors =
| GetProfileUploadLinkErrors
| UploadLink;
@@ -9273,6 +9302,71 @@ export type GetUploadLinkMutation = {
};
};
export type GetUploadLinksMutationVariables = Exact<{
videoId: Scalars["Int"]["input"];
segmentIndexes: Array<Scalars["Int"]["input"]> | Scalars["Int"]["input"];
}>;
export type GetUploadLinksMutation = {
__typename?: "Mutation";
getUploadLinks: {
__typename?: "GetUploadLinksReturn";
value:
| {
__typename?: "GetUploadLinkErrors";
error:
| { __typename?: "InitUploadAlreadyCompletedErr" }
| {
__typename?: "MustHaveSetForUploadLinkErr";
resolution?: boolean | null;
framesPerSecond?: boolean | null;
}
| { __typename?: "NoInitForChunkedUploadErr" }
| {
__typename?: "ProcessingFailedErr";
processing: {
__typename?: "VideoProcessingGQL";
status: ProcessingStatusEnum;
errors: Array<{
__typename?: "VideoProcessingErrorGQL";
message: string;
}>;
};
}
| { __typename?: "SegmentAlreadyUploadedErr" }
| {
__typename?: "StorageLimitExceededErr";
reason: string;
tierName: string;
retainedStorageUsedBytes: any;
retainedStorageLimitBytes?: any | null;
remainingStorageBytes?: any | null;
}
| { __typename?: "TooManyInitUploadsErr" }
| { __typename?: "TooManyProfileImageUploadsErr" };
}
| {
__typename?: "UploadLinkBatch";
alreadyUploaded: Array<number>;
links: Array<{
__typename?: "SegmentUploadLink";
segmentIndex: number;
uploadUrl: string;
headers: Array<{
__typename?: "Header";
key: string;
value: string;
} | null>;
}>;
};
stream?: {
__typename?: "UploadStreamGQL";
id: string;
uploadCompletionCursor: number;
} | null;
};
};
export type GetHlsInitUploadLinkMutationVariables = Exact<{
videoId: Scalars["Int"]["input"];
}>;
@@ -19986,6 +20080,96 @@ export type GetUploadLinkMutationOptions = Apollo.BaseMutationOptions<
GetUploadLinkMutation,
GetUploadLinkMutationVariables
>;
export const GetUploadLinksDocument = gql`
mutation GetUploadLinks($videoId: Int!, $segmentIndexes: [Int!]!) {
getUploadLinks(videoId: $videoId, segmentIndexes: $segmentIndexes) {
value {
... on UploadLinkBatch {
links {
segmentIndex
uploadUrl
headers {
key
value
}
}
alreadyUploaded
}
... on GetUploadLinkErrors {
error {
... on MustHaveSetForUploadLinkErr {
resolution
framesPerSecond
}
... on ProcessingFailedErr {
processing {
status
errors {
message
}
}
}
... on StorageLimitExceededErr {
reason
tierName
retainedStorageUsedBytes
retainedStorageLimitBytes
remainingStorageBytes
}
}
}
}
stream {
id
uploadCompletionCursor
}
}
}
`;
export type GetUploadLinksMutationFn = Apollo.MutationFunction<
GetUploadLinksMutation,
GetUploadLinksMutationVariables
>;
/**
* __useGetUploadLinksMutation__
*
* To run a mutation, you first call `useGetUploadLinksMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useGetUploadLinksMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [getUploadLinksMutation, { data, loading, error }] = useGetUploadLinksMutation({
* variables: {
* videoId: // value for 'videoId'
* segmentIndexes: // value for 'segmentIndexes'
* },
* });
*/
export function useGetUploadLinksMutation(
baseOptions?: Apollo.MutationHookOptions<
GetUploadLinksMutation,
GetUploadLinksMutationVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useMutation<
GetUploadLinksMutation,
GetUploadLinksMutationVariables
>(GetUploadLinksDocument, options);
}
export type GetUploadLinksMutationHookResult = ReturnType<
typeof useGetUploadLinksMutation
>;
export type GetUploadLinksMutationResult =
Apollo.MutationResult<GetUploadLinksMutation>;
export type GetUploadLinksMutationOptions = Apollo.BaseMutationOptions<
GetUploadLinksMutation,
GetUploadLinksMutationVariables
>;
export const GetHlsInitUploadLinkDocument = gql`
mutation GetHlsInitUploadLink($videoId: Int!) {
getHlsInitUploadLink(videoId: $videoId) {

View File

@@ -54,6 +54,51 @@ mutation GetUploadLink($videoId: Int!, $segmentIndex: Int!) {
}
}
mutation GetUploadLinks($videoId: Int!, $segmentIndexes: [Int!]!) {
getUploadLinks(videoId: $videoId, segmentIndexes: $segmentIndexes) {
value {
... on UploadLinkBatch {
links {
segmentIndex
uploadUrl
headers {
key
value
}
}
alreadyUploaded
}
... on GetUploadLinkErrors {
error {
... on MustHaveSetForUploadLinkErr {
resolution
framesPerSecond
}
... on ProcessingFailedErr {
processing {
status
errors {
message
}
}
}
... on StorageLimitExceededErr {
reason
tierName
retainedStorageUsedBytes
retainedStorageLimitBytes
remainingStorageBytes
}
}
}
}
stream {
id
uploadCompletionCursor
}
}
}
mutation GetHlsInitUploadLink($videoId: Int!) {
getHlsInitUploadLink(videoId: $videoId) {
value {

View File

@@ -526,6 +526,24 @@ type GetUploadLinkReturn {
stream: UploadStreamGQL
}
type GetUploadLinksReturn {
value: UploadLinkBatchGetUploadLinkErrors!
stream: UploadStreamGQL
}
type SegmentUploadLink {
segmentIndex: Int!
uploadUrl: String!
headers: [Header]!
}
type UploadLinkBatch {
links: [SegmentUploadLink!]!
alreadyUploaded: [Int!]!
}
union UploadLinkBatchGetUploadLinkErrors = UploadLinkBatch | GetUploadLinkErrors
type HLSPlaylistGQL {
videoId: Int!
m3u8Text: String!
@@ -755,6 +773,7 @@ type Mutation {
expectedDurationSeconds: Float = null
): CreateUploadStreamReturn!
getUploadLink(videoId: Int!, segmentIndex: Int!): GetUploadLinkReturn!
getUploadLinks(videoId: Int!, segmentIndexes: [Int!]!): GetUploadLinksReturn!
getHlsInitUploadLink(videoId: Int!): GetUploadLinkReturn!
setSegmentDuration(
videoId: Int!