File tree Expand file tree Collapse file tree 7 files changed +35
-2
lines changed Expand file tree Collapse file tree 7 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -127,15 +127,26 @@ export type CommitParams = {
127127 */
128128 useXet ?: boolean ;
129129 // Credentials are optional due to custom fetch functions or cookie auth
130+
131+ /**
132+ * If queued, will not return commit information in the output
133+ */
134+ mode ?: "queued" | "immediate" ;
130135} & Partial < CredentialsParams > ;
131136
132137export interface CommitOutput {
133138 pullRequestUrl ?: string ;
134- commit : {
139+ /**
140+ * Unset if queued commit, or empty commit
141+ */
142+ commit ?: {
135143 oid : string ;
136144 url : string ;
137145 } ;
138- hookOutput : string ;
146+ /**
147+ * Unset if queued commit, or empty commit
148+ */
149+ hookOutput ?: string ;
139150}
140151
141152function isFileOperation ( op : CommitOperation ) : op is CommitBlob {
@@ -640,6 +651,7 @@ export async function* commitIter(params: CommitParams): AsyncGenerator<CommitPr
640651 summary : params . title ,
641652 description : params . description ,
642653 parentCommit : params . parentCommit ,
654+ mode : params . mode ,
643655 } satisfies ApiCommitHeader ,
644656 } ,
645657 ...( ( await Promise . all (
@@ -692,6 +704,11 @@ export async function* commitIter(params: CommitParams): AsyncGenerator<CommitPr
692704 throw await createApiError ( res ) ;
693705 }
694706
707+ if ( res . status === 202 ) {
708+ // Queued commit
709+ returnCallback ( { } ) ;
710+ }
711+
695712 const json = await res . json ( ) ;
696713
697714 returnCallback ( {
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export function deleteFile(
1313 branch ?: CommitParams [ "branch" ] ;
1414 isPullRequest ?: CommitParams [ "isPullRequest" ] ;
1515 parentCommit ?: CommitParams [ "parentCommit" ] ;
16+ mode ?: CommitParams [ "mode" ] ;
1617 } & CredentialsParams
1718) : Promise < CommitOutput > {
1819 return commit ( {
@@ -31,5 +32,6 @@ export function deleteFile(
3132 isPullRequest : params . isPullRequest ,
3233 parentCommit : params . parentCommit ,
3334 fetch : params . fetch ,
35+ mode : params . mode ,
3436 } ) ;
3537}
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export function deleteFiles(
1212 branch ?: CommitParams [ "branch" ] ;
1313 isPullRequest ?: CommitParams [ "isPullRequest" ] ;
1414 parentCommit ?: CommitParams [ "parentCommit" ] ;
15+ mode ?: CommitParams [ "mode" ] ;
1516 fetch ?: CommitParams [ "fetch" ] ;
1617 } & CredentialsParams
1718) : Promise < CommitOutput > {
@@ -29,5 +30,6 @@ export function deleteFiles(
2930 isPullRequest : params . isPullRequest ,
3031 parentCommit : params . parentCommit ,
3132 fetch : params . fetch ,
33+ mode : params . mode ,
3234 } ) ;
3335}
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export function uploadFile(
1616 useWebWorkers ?: CommitParams [ "useWebWorkers" ] ;
1717 abortSignal ?: CommitParams [ "abortSignal" ] ;
1818 useXet ?: CommitParams [ "useXet" ] ;
19+ mode ?: CommitParams [ "mode" ] ;
1920 } & Partial < CredentialsParams >
2021) : Promise < CommitOutput > {
2122 const path =
@@ -45,5 +46,6 @@ export function uploadFile(
4546 useWebWorkers : params . useWebWorkers ,
4647 abortSignal : params . abortSignal ,
4748 useXet : params . useXet ,
49+ mode : params . mode ,
4850 } ) ;
4951}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export async function* uploadFilesWithProgress(
3030 abortSignal ?: CommitParams [ "abortSignal" ] ;
3131 maxFolderDepth ?: CommitParams [ "maxFolderDepth" ] ;
3232 useXet ?: CommitParams [ "useXet" ] ;
33+ mode ?: CommitParams [ "mode" ] ;
3334 /**
3435 * Set this to true in order to have progress events for hashing
3536 */
@@ -53,6 +54,7 @@ export async function* uploadFilesWithProgress(
5354 useWebWorkers : params . useWebWorkers ,
5455 abortSignal : params . abortSignal ,
5556 useXet : params . useXet ,
57+ mode : params . mode ,
5658 fetch : async ( input , init ) => {
5759 if ( ! init ) {
5860 return fetch ( input ) ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export function uploadFiles(
1515 fetch ?: CommitParams [ "fetch" ] ;
1616 useWebWorkers ?: CommitParams [ "useWebWorkers" ] ;
1717 maxFolderDepth ?: CommitParams [ "maxFolderDepth" ] ;
18+ mode ?: CommitParams [ "mode" ] ;
1819 abortSignal ?: CommitParams [ "abortSignal" ] ;
1920 useXet ?: CommitParams [ "useXet" ] ;
2021 } & Partial < CredentialsParams >
@@ -37,5 +38,6 @@ export function uploadFiles(
3738 useWebWorkers : params . useWebWorkers ,
3839 abortSignal : params . abortSignal ,
3940 useXet : params . useXet ,
41+ mode : params . mode ,
4042 } ) ;
4143}
Original file line number Diff line number Diff line change @@ -143,6 +143,12 @@ export interface ApiCommitHeader {
143143 * - When committing on a branch: Will make sure that there were no intermediate commits
144144 */
145145 parentCommit ?: string ;
146+ /**
147+ * queued => commit is pending
148+ * immediate => commit is processed immediately
149+ * flush => all pending commits are processed and merged into one commit
150+ */
151+ mode ?: "queued" | "immediate" | "flush" ;
146152}
147153
148154export interface ApiCommitDeletedEntry {
You can’t perform that action at this time.
0 commit comments