-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: git api - adding new apis (#38681)
## Description - Introduces new api contracts for git - Adds feature flag `release_git_api_contracts_enabled` Fixes #38500 ## Automation /ok-to-test tags="@tag.Git" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12810595516> > Commit: 8f05bbf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12810595516&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Git` > Spec: > <hr>Thu, 16 Jan 2025 15:05:20 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **New Features** - Introduced a new feature flag `release_git_api_contracts_enabled` - Added support for enhanced Git API contract handling - **Improvements** - Updated type definitions for Git-related operations - Refined request and response handling for Git artifacts - Improved type safety for Git references and branches - **Changes** - Modified several Git-related request and saga functions to support new API contracts - Updated artifact type enum values to use lowercase representations - Introduced new interfaces for Git references and branches - **Technical Updates** - Added conditional logic for feature flag-based request processing - Restructured type definitions across multiple Git-related modules <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
73 changed files
with
997 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
app/client/src/git/components/BranchList/hooks/useFilteredBranches.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { GitBranch, GitRef } from "git/types"; | ||
|
||
export default function refToBranchList(refs: GitRef[]): GitBranch[] { | ||
return refs.map((ref) => ({ | ||
branchName: ref.refName, | ||
default: ref.default, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { AxiosPromise } from "axios"; | ||
import { GIT_BASE_URL } from "./constants"; | ||
import Api from "api/Api"; | ||
import type { GitArtifactType } from "git/constants/enums"; | ||
import type { | ||
CheckoutRefRequestParams, | ||
CheckoutRefResponse, | ||
} from "./checkoutRefRequest.types"; | ||
import checkoutBranchRequestOld from "./checkoutBranchRequest"; | ||
|
||
async function checkoutRefRequestNew( | ||
artifactType: GitArtifactType, | ||
refArtifactid: string, | ||
params: CheckoutRefRequestParams, | ||
): AxiosPromise<CheckoutRefResponse> { | ||
return Api.post( | ||
`${GIT_BASE_URL}/${artifactType}/${refArtifactid}/checkout-ref`, | ||
params, | ||
); | ||
} | ||
|
||
export default async function checkoutRefRequest( | ||
artifactType: GitArtifactType, | ||
refArtifactid: string, | ||
params: CheckoutRefRequestParams, | ||
isNew: boolean, | ||
) { | ||
if (isNew) { | ||
return checkoutRefRequestNew(artifactType, refArtifactid, params); | ||
} else { | ||
const checkoutBranchParams = { | ||
branchName: params.refName, | ||
}; | ||
|
||
return checkoutBranchRequestOld(refArtifactid, checkoutBranchParams); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { ApiResponse } from "api/types"; | ||
import type { GitArtifact } from "git/store/types"; | ||
|
||
export interface CheckoutRefRequestParams { | ||
refType: "branch" | "tag"; | ||
refName: string; | ||
message?: string; | ||
} | ||
|
||
export type CheckoutRefResponseData = GitArtifact; | ||
|
||
export type CheckoutRefResponse = ApiResponse<CheckoutRefResponseData>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { AxiosPromise } from "axios"; | ||
import { GIT_BASE_URL } from "./constants"; | ||
import Api from "api/Api"; | ||
import type { GitArtifactType } from "git/constants/enums"; | ||
import type { | ||
CreateRefRequestParams, | ||
CreateRefResponse, | ||
} from "./createRefRequest.types"; | ||
import createBranchRequestOld from "./createBranchRequest"; | ||
|
||
async function createRefRequestNew( | ||
artifactType: GitArtifactType, | ||
refArtifactId: string, | ||
params: CreateRefRequestParams, | ||
): AxiosPromise<CreateRefResponse> { | ||
return Api.post( | ||
`${GIT_BASE_URL}/${artifactType}/${refArtifactId}/create-ref`, | ||
params, | ||
); | ||
} | ||
|
||
export default async function createRefRequest( | ||
artifactType: GitArtifactType, | ||
refArtifactId: string, | ||
params: CreateRefRequestParams, | ||
isNew: boolean, | ||
) { | ||
if (isNew) { | ||
return createRefRequestNew(artifactType, refArtifactId, params); | ||
} else { | ||
const createBranchParams = { | ||
branchName: params.refName, | ||
}; | ||
|
||
return createBranchRequestOld(refArtifactId, createBranchParams); | ||
} | ||
} |
Oops, something went wrong.