chore: git mod - migrating apis for git (#37984)
## Description - Add application apis for git package Fixes #37823 ## 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/12194637717> > Commit: e72e02f75e0c58ad1306776b3246c6de2431e9bf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12194637717&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Git` > Spec: > <hr>Fri, 06 Dec 2024 08:23:16 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 - **New Features** - Introduced various asynchronous functions for Git operations, including: - `checkoutBranchRequest` - `commitRequest` - `connectRequest` - `createBranchRequest` - `deleteBranchRequest` - `fetchBranchesRequest` - `fetchGitMetadataRequest` - `fetchProtectedBranchesRequest` - `mergeRequest` - `pullRequest` - `toggleAutocommitRequest` - `triggerAutocommitRequest` - `updateGlobalConfigRequest` - `updateLocalConfigRequest` - `updateProtectedBranchesRequest` - Added new enumeration `AutocommitStatus` and interfaces to enhance type safety for Git operations. - **Bug Fixes** - Updated import paths for consistency and clarity across multiple files. - **Documentation** - Enhanced type definitions for various request and response structures. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
a4502261c7
commit
fd9efb81a7
|
|
@ -3,7 +3,7 @@ import {
|
|||
GitImportStep,
|
||||
GitOpsTab,
|
||||
GitSettingsTab,
|
||||
} from "../../enums";
|
||||
} from "../../constants/enums";
|
||||
import type {
|
||||
GitSingleArtifactAPIResponsesReduxState,
|
||||
GitSingleArtifactUIReduxState,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import { render, screen, fireEvent } from "@testing-library/react";
|
||||
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
||||
import QuickActions from ".";
|
||||
import { GitSettingsTab } from "git/enums";
|
||||
import { GitSettingsTab } from "../../constants/enums";
|
||||
import { GitSyncModalTab } from "entities/GitSync";
|
||||
import { theme } from "constants/DefaultTheme";
|
||||
import { ThemeProvider } from "styled-components";
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { GitSyncModalTab } from "entities/GitSync";
|
|||
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
||||
import type { GitMetadata, GitStatus } from "../../types";
|
||||
import { getPullBtnStatus } from "./helpers";
|
||||
import { GitSettingsTab } from "../../enums";
|
||||
import { GitSettingsTab } from "../../constants/enums";
|
||||
import ConnectButton from "./ConnectButton";
|
||||
import QuickActionButton from "./QuickActionButton";
|
||||
import AutocommitStatusbar from "./AutocommitStatusbar";
|
||||
|
|
|
|||
|
|
@ -25,3 +25,12 @@ export enum GitSettingsTab {
|
|||
General = "General",
|
||||
Branch = "Branch",
|
||||
}
|
||||
|
||||
export enum AutocommitStatus {
|
||||
IN_PROGRESS = "IN_PROGRESS",
|
||||
LOCKED = "LOCKED",
|
||||
PUBLISHED = "PUBLISHED",
|
||||
IDLE = "IDLE",
|
||||
NOT_REQUIRED = "NOT_REQUIRED",
|
||||
NON_GIT_APP = "NON_GIT_APP",
|
||||
}
|
||||
17
app/client/src/git/requests/checkoutBranchRequest.ts
Normal file
17
app/client/src/git/requests/checkoutBranchRequest.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import type {
|
||||
CheckoutBranchRequestParams,
|
||||
CheckoutBranchResponse,
|
||||
} from "./checkoutBranchRequest.types";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import Api from "api/Api";
|
||||
|
||||
export default async function checkoutBranchRequest(
|
||||
branchedApplicationId: string,
|
||||
params: CheckoutBranchRequestParams,
|
||||
): Promise<AxiosResponse<CheckoutBranchResponse>> {
|
||||
return Api.get(
|
||||
`${GIT_BASE_URL}/checkout-branch/app/${branchedApplicationId}`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
export interface CheckoutBranchRequestParams {
|
||||
branchName: string;
|
||||
}
|
||||
|
||||
export interface CheckoutBranchResponse {
|
||||
id: string; // applicationId
|
||||
baseId: string; // baseApplicationId
|
||||
}
|
||||
17
app/client/src/git/requests/commitRequest.ts
Normal file
17
app/client/src/git/requests/commitRequest.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import Api from "api/Api";
|
||||
import type {
|
||||
CommitRequestParams,
|
||||
CommitResponse,
|
||||
} from "./commitRequest.types";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export default async function commitRequest(
|
||||
branchedApplicationId: string,
|
||||
params: CommitRequestParams,
|
||||
): Promise<AxiosResponse<CommitResponse>> {
|
||||
return Api.post(
|
||||
`${GIT_BASE_URL}/commit/app/${branchedApplicationId}`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
6
app/client/src/git/requests/commitRequest.types.ts
Normal file
6
app/client/src/git/requests/commitRequest.types.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export interface CommitRequestParams {
|
||||
commitMessage: string;
|
||||
doPush: boolean;
|
||||
}
|
||||
|
||||
export type CommitResponse = string;
|
||||
14
app/client/src/git/requests/connectRequest.ts
Normal file
14
app/client/src/git/requests/connectRequest.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type {
|
||||
ConnectRequestParams,
|
||||
ConnectResponse,
|
||||
} from "./connectRequest.types";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export default async function connectRequest(
|
||||
baseApplicationId: string,
|
||||
params: ConnectRequestParams,
|
||||
): Promise<AxiosResponse<ConnectResponse>> {
|
||||
return Api.post(`${GIT_BASE_URL}/connect/app/${baseApplicationId}`, params);
|
||||
}
|
||||
24
app/client/src/git/requests/connectRequest.types.ts
Normal file
24
app/client/src/git/requests/connectRequest.types.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
export interface ConnectRequestParams {
|
||||
remoteUrl: string;
|
||||
gitProfile?: {
|
||||
authorName: string;
|
||||
authorEmail: string;
|
||||
useDefaultProfile?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ConnectResponse {
|
||||
id: string;
|
||||
baseId: string;
|
||||
gitApplicationMetadata: {
|
||||
branchName: string;
|
||||
browserSupportedRemoteUrl: string;
|
||||
defaultApplicationId: string;
|
||||
defaultArtifactId: string;
|
||||
defaultBranchName: string;
|
||||
isRepoPrivate: boolean;
|
||||
lastCommitedAt: string;
|
||||
remoteUrl: string;
|
||||
repoName: string;
|
||||
};
|
||||
}
|
||||
2
app/client/src/git/requests/constants.ts
Normal file
2
app/client/src/git/requests/constants.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export const GIT_BASE_URL = "/v1/git";
|
||||
export const APPLICATION_BASE_URL = "/v1/applications";
|
||||
17
app/client/src/git/requests/createBranchRequest.ts
Normal file
17
app/client/src/git/requests/createBranchRequest.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import type {
|
||||
CreateBranchRequestParams,
|
||||
CreateBranchResponse,
|
||||
} from "./createBranchRequest.types";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import Api from "api/Api";
|
||||
|
||||
export default async function createBranchRequest(
|
||||
branchedApplicationId: string,
|
||||
params: CreateBranchRequestParams,
|
||||
): Promise<AxiosResponse<CreateBranchResponse>> {
|
||||
return Api.post(
|
||||
`${GIT_BASE_URL}/create-branch/app/${branchedApplicationId}`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
8
app/client/src/git/requests/createBranchRequest.types.ts
Normal file
8
app/client/src/git/requests/createBranchRequest.types.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export interface CreateBranchRequestParams {
|
||||
branchName: string;
|
||||
}
|
||||
|
||||
export interface CreateBranchResponse {
|
||||
id: string; // applicationId
|
||||
baseId: string; // baseApplicationId
|
||||
}
|
||||
14
app/client/src/git/requests/deleteBranchRequest.ts
Normal file
14
app/client/src/git/requests/deleteBranchRequest.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import type {
|
||||
DeleteBranchRequestParams,
|
||||
DeleteBranchResponse,
|
||||
} from "./deleteBranchRequest.types";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import Api from "api/Api";
|
||||
|
||||
export default async function deleteBranchRequest(
|
||||
baseApplicationId: string,
|
||||
params: DeleteBranchRequestParams,
|
||||
): Promise<AxiosResponse<DeleteBranchResponse>> {
|
||||
return Api.delete(`${GIT_BASE_URL}/branch/app/${baseApplicationId}`, params);
|
||||
}
|
||||
8
app/client/src/git/requests/deleteBranchRequest.types.ts
Normal file
8
app/client/src/git/requests/deleteBranchRequest.types.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export interface DeleteBranchRequestParams {
|
||||
branchName: string;
|
||||
}
|
||||
|
||||
export interface DeleteBranchResponse {
|
||||
id: string; // applicationId
|
||||
baseId: string; // baseApplicationId
|
||||
}
|
||||
9
app/client/src/git/requests/discardRequest.ts
Normal file
9
app/client/src/git/requests/discardRequest.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export default async function discardRequest(
|
||||
branchedApplicationId: string,
|
||||
): Promise<AxiosResponse<void>> {
|
||||
return Api.put(`${GIT_BASE_URL}/discard/app/${branchedApplicationId}`);
|
||||
}
|
||||
10
app/client/src/git/requests/disconnectRequest.ts
Normal file
10
app/client/src/git/requests/disconnectRequest.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { DisconnectResponse } from "./disconnectRequest.types";
|
||||
import Api from "api/Api";
|
||||
|
||||
export default async function disconnectRequest(
|
||||
baseApplicationId: string,
|
||||
): Promise<AxiosResponse<DisconnectResponse>> {
|
||||
return Api.post(`${GIT_BASE_URL}/disconnect/app/${baseApplicationId}`);
|
||||
}
|
||||
3
app/client/src/git/requests/disconnectRequest.types.ts
Normal file
3
app/client/src/git/requests/disconnectRequest.types.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export interface DisconnectResponse {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { FetchAutocommitProgressResponse } from "./fetchAutocommitProgressRequest.types";
|
||||
|
||||
export default async function fetchAutocommitProgressRequest(
|
||||
baseApplicationId: string,
|
||||
): Promise<AxiosResponse<FetchAutocommitProgressResponse>> {
|
||||
return Api.get(
|
||||
`${GIT_BASE_URL}/auto-commit/progress/app/${baseApplicationId}`,
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import type { AutocommitStatus } from "../constants/enums";
|
||||
|
||||
export interface FetchAutocommitProgressResponse {
|
||||
autoCommitResponse: AutocommitStatus;
|
||||
progress: number;
|
||||
branchName: string;
|
||||
}
|
||||
21
app/client/src/git/requests/fetchBranchesRequest.ts
Normal file
21
app/client/src/git/requests/fetchBranchesRequest.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type {
|
||||
FetchBranchesRequestParams,
|
||||
FetchBranchesResponse,
|
||||
} from "./fetchBranchesRequest.types";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export default async function fetchBranchesRequest(
|
||||
branchedApplicationId: string,
|
||||
params?: FetchBranchesRequestParams,
|
||||
): Promise<AxiosResponse<FetchBranchesResponse>> {
|
||||
const queryParams = {} as FetchBranchesRequestParams;
|
||||
|
||||
if (params?.pruneBranches) queryParams.pruneBranches = true;
|
||||
|
||||
return Api.get(
|
||||
`${GIT_BASE_URL}/branch/app/${branchedApplicationId}`,
|
||||
queryParams,
|
||||
);
|
||||
}
|
||||
11
app/client/src/git/requests/fetchBranchesRequest.types.ts
Normal file
11
app/client/src/git/requests/fetchBranchesRequest.types.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export interface FetchBranchesRequestParams {
|
||||
pruneBranches: boolean;
|
||||
}
|
||||
|
||||
interface SingleBranch {
|
||||
branchName: string;
|
||||
createdFromLocal: string;
|
||||
default: boolean;
|
||||
}
|
||||
|
||||
export type FetchBranchesResponse = SingleBranch[];
|
||||
10
app/client/src/git/requests/fetchGitMetadataRequest.ts
Normal file
10
app/client/src/git/requests/fetchGitMetadataRequest.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { FetchGitMetadataResponse } from "./fetchGitMetadataRequest.types";
|
||||
|
||||
export default async function fetchGitMetadataRequest(
|
||||
baseApplicationId: string,
|
||||
): Promise<AxiosResponse<FetchGitMetadataResponse>> {
|
||||
return Api.get(`${GIT_BASE_URL}/metadata/app/${baseApplicationId}`);
|
||||
}
|
||||
15
app/client/src/git/requests/fetchGitMetadataRequest.types.ts
Normal file
15
app/client/src/git/requests/fetchGitMetadataRequest.types.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
export interface FetchGitMetadataResponse {
|
||||
branchName: string;
|
||||
defaultBranchName: string;
|
||||
remoteUrl: string;
|
||||
repoName: string;
|
||||
browserSupportedUrl?: string;
|
||||
isRepoPrivate?: boolean;
|
||||
browserSupportedRemoteUrl: string;
|
||||
defaultApplicationId: string;
|
||||
isProtectedBranch: boolean;
|
||||
autoCommitConfig: {
|
||||
enabled: boolean;
|
||||
};
|
||||
isAutoDeploymentEnabled?: boolean;
|
||||
}
|
||||
10
app/client/src/git/requests/fetchGlobalConfigRequest.ts
Normal file
10
app/client/src/git/requests/fetchGlobalConfigRequest.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { FetchGlobalConfigResponse } from "./fetchGlobalConfigRequest.types";
|
||||
|
||||
export default async function fetchGlobalConfigRequest(): Promise<
|
||||
AxiosResponse<FetchGlobalConfigResponse>
|
||||
> {
|
||||
return Api.get(`${GIT_BASE_URL}/profile/default`);
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
export interface FetchGlobalConfigResponse {
|
||||
authorName: string;
|
||||
authorEmail: string;
|
||||
}
|
||||
10
app/client/src/git/requests/fetchLocalConfigRequest.ts
Normal file
10
app/client/src/git/requests/fetchLocalConfigRequest.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import Api from "api/Api";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { FetchLocalConfigResponse } from "./fetchLocalConfigRequest.types";
|
||||
|
||||
export default async function fetchLocalConfigRequest(
|
||||
baseApplicationId: string,
|
||||
): Promise<AxiosResponse<FetchLocalConfigResponse>> {
|
||||
return Api.get(`${GIT_BASE_URL}/profile/app/${baseApplicationId}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
export interface FetchLocalConfigResponse {
|
||||
authorName: string;
|
||||
authorEmail: string;
|
||||
useGlobalProfile: boolean;
|
||||
}
|
||||
17
app/client/src/git/requests/fetchMergeStatusRequest.ts
Normal file
17
app/client/src/git/requests/fetchMergeStatusRequest.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import type {
|
||||
FetchMergeStatusRequestParams,
|
||||
FetchMergeStatusResponse,
|
||||
} from "./fetchMergeStatusRequest.types";
|
||||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
|
||||
export default async function fetchMergeStatusRequest(
|
||||
branchedApplicationId: string,
|
||||
params: FetchMergeStatusRequestParams,
|
||||
): Promise<AxiosResponse<FetchMergeStatusResponse>> {
|
||||
return Api.post(
|
||||
`${GIT_BASE_URL}/merge/status/app/${branchedApplicationId}`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
10
app/client/src/git/requests/fetchMergeStatusRequest.types.ts
Normal file
10
app/client/src/git/requests/fetchMergeStatusRequest.types.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export interface FetchMergeStatusRequestParams {
|
||||
sourceBranch: string;
|
||||
destinationBranch: string;
|
||||
}
|
||||
|
||||
export interface FetchMergeStatusResponse {
|
||||
isMergeAble: boolean;
|
||||
status: string; // merge status
|
||||
message: string;
|
||||
}
|
||||
10
app/client/src/git/requests/fetchProtectedBranchesRequest.ts
Normal file
10
app/client/src/git/requests/fetchProtectedBranchesRequest.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { FetchProtectedBranches } from "./fetchProtectedBranchesRequest.types";
|
||||
|
||||
export default async function fetchProtectedBranchesRequest(
|
||||
baseApplicationId: string,
|
||||
): Promise<AxiosResponse<FetchProtectedBranches>> {
|
||||
return Api.get(`${GIT_BASE_URL}/branch/app/${baseApplicationId}/protected`);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export type FetchProtectedBranches = string[];
|
||||
10
app/client/src/git/requests/fetchSSHKeyRequest.ts
Normal file
10
app/client/src/git/requests/fetchSSHKeyRequest.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import type { FetchSSHKeyResponse } from "./fetchSSHKeyRequest.types";
|
||||
import Api from "api/Api";
|
||||
import { APPLICATION_BASE_URL } from "./constants";
|
||||
|
||||
export default async function fetchSSHKeyRequest(
|
||||
baseApplicationId: string,
|
||||
): Promise<AxiosResponse<FetchSSHKeyResponse>> {
|
||||
return Api.get(`${APPLICATION_BASE_URL}/ssh-keypair/${baseApplicationId}`);
|
||||
}
|
||||
6
app/client/src/git/requests/fetchSSHKeyRequest.types.ts
Normal file
6
app/client/src/git/requests/fetchSSHKeyRequest.types.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export interface FetchSSHKeyResponse {
|
||||
publicKey: string;
|
||||
docUrl: string;
|
||||
isRegeneratedKey: boolean;
|
||||
regeneratedKey: boolean;
|
||||
}
|
||||
14
app/client/src/git/requests/fetchStatusRequest.ts
Normal file
14
app/client/src/git/requests/fetchStatusRequest.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import Api from "api/Api";
|
||||
import type {
|
||||
FetchStatusRequestParams,
|
||||
FetchStatusResponse,
|
||||
} from "./fetchStatusRequest.types";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export default async function fetchStatusRequest(
|
||||
branchedApplicationId: string,
|
||||
params: FetchStatusRequestParams,
|
||||
): Promise<AxiosResponse<FetchStatusResponse>> {
|
||||
return Api.get(`${GIT_BASE_URL}/status/app/${branchedApplicationId}`, params);
|
||||
}
|
||||
38
app/client/src/git/requests/fetchStatusRequest.types.ts
Normal file
38
app/client/src/git/requests/fetchStatusRequest.types.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
export interface FetchStatusRequestParams {
|
||||
compareRemote: boolean;
|
||||
}
|
||||
|
||||
export interface FetchStatusResponse {
|
||||
added: string[];
|
||||
aheadCount: number;
|
||||
behindCount: number;
|
||||
conflicting: string[];
|
||||
datasourcesAdded: string[];
|
||||
datasourcesModified: string[];
|
||||
datasourcesRemoved: string[];
|
||||
discardDocUrl: string;
|
||||
isClean: boolean;
|
||||
jsLibsAdded: string[];
|
||||
jsLibsModified: string[];
|
||||
jsLibsRemoved: string[];
|
||||
jsObjectsAdded: string[];
|
||||
jsObjectsModified: string[];
|
||||
jsObjectsRemoved: string[];
|
||||
migrationMessage: string;
|
||||
modified: string[];
|
||||
modifiedDatasources: number;
|
||||
modifiedJSLibs: number;
|
||||
modifiedJSObjects: number;
|
||||
modifiedModuleInstances: number;
|
||||
modifiedModules: number;
|
||||
modifiedPages: number;
|
||||
modifiedQueries: number;
|
||||
pagesAdded: string[];
|
||||
pagesModified: string[];
|
||||
pagesRemoved: string[];
|
||||
queriesAdded: string[];
|
||||
queriesModified: string[];
|
||||
queriesRemoved: string[];
|
||||
remoteBranch: string;
|
||||
removed: string[];
|
||||
}
|
||||
18
app/client/src/git/requests/generateSSHKeyRequest.ts
Normal file
18
app/client/src/git/requests/generateSSHKeyRequest.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import type {
|
||||
GenerateSSHKeyRequestParams,
|
||||
GenerateSSHKeyResponse,
|
||||
} from "./generateSSHKeyRequest.types";
|
||||
import { APPLICATION_BASE_URL, GIT_BASE_URL } from "./constants";
|
||||
import Api from "api/Api";
|
||||
|
||||
export default async function generateSSHKeyRequest(
|
||||
baseApplicationId: string,
|
||||
params: GenerateSSHKeyRequestParams,
|
||||
): Promise<AxiosResponse<GenerateSSHKeyResponse>> {
|
||||
const url = params.isImporting
|
||||
? `${GIT_BASE_URL}/import/keys?keyType=${params.keyType}`
|
||||
: `${APPLICATION_BASE_URL}/ssh-keypair/${baseApplicationId}?keyType=${params.keyType}`;
|
||||
|
||||
return params.isImporting ? Api.get(url) : Api.post(url);
|
||||
}
|
||||
11
app/client/src/git/requests/generateSSHKeyRequest.types.ts
Normal file
11
app/client/src/git/requests/generateSSHKeyRequest.types.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export interface GenerateSSHKeyRequestParams {
|
||||
keyType: string;
|
||||
isImporting: boolean;
|
||||
}
|
||||
|
||||
export interface GenerateSSHKeyResponse {
|
||||
publicKey: string;
|
||||
docUrl: string;
|
||||
isRegeneratedKey: boolean;
|
||||
regeneratedKey: boolean;
|
||||
}
|
||||
14
app/client/src/git/requests/importGitRequest.ts
Normal file
14
app/client/src/git/requests/importGitRequest.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type {
|
||||
ImportGitRequestParams,
|
||||
ImportGitResponse,
|
||||
} from "./importGitRequest.types";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export default async function importGitRequest(
|
||||
workspaceId: string,
|
||||
params: ImportGitRequestParams,
|
||||
): Promise<AxiosResponse<ImportGitResponse>> {
|
||||
return Api.post(`${GIT_BASE_URL}/import/${workspaceId}`, params);
|
||||
}
|
||||
24
app/client/src/git/requests/importGitRequest.types.ts
Normal file
24
app/client/src/git/requests/importGitRequest.types.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
export interface ImportGitRequestParams {
|
||||
remoteUrl: string;
|
||||
gitProfile?: {
|
||||
authorName: string;
|
||||
authorEmail: string;
|
||||
useDefaultProfile?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ImportGitResponse {
|
||||
id: string;
|
||||
baseId: string;
|
||||
gitApplicationMetadata: {
|
||||
branchName: string;
|
||||
browserSupportedRemoteUrl: string;
|
||||
defaultApplicationId: string;
|
||||
defaultArtifactId: string;
|
||||
defaultBranchName: string;
|
||||
isRepoPrivate: boolean;
|
||||
lastCommitedAt: string;
|
||||
remoteUrl: string;
|
||||
repoName: string;
|
||||
};
|
||||
}
|
||||
11
app/client/src/git/requests/mergeRequest.ts
Normal file
11
app/client/src/git/requests/mergeRequest.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import Api from "api/Api";
|
||||
import type { MergeRequestParams, MergeResponse } from "./mergeRequest.types";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export default async function mergeRequest(
|
||||
branchedApplicationId: string,
|
||||
params: MergeRequestParams,
|
||||
): Promise<AxiosResponse<MergeResponse>> {
|
||||
return Api.post(`${GIT_BASE_URL}/merge/app/${branchedApplicationId}`, params);
|
||||
}
|
||||
9
app/client/src/git/requests/mergeRequest.types.ts
Normal file
9
app/client/src/git/requests/mergeRequest.types.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export interface MergeRequestParams {
|
||||
sourceBranch: string;
|
||||
destinationBranch: string;
|
||||
}
|
||||
|
||||
export interface MergeResponse {
|
||||
isMergAble: boolean;
|
||||
status: string; // merge status
|
||||
}
|
||||
10
app/client/src/git/requests/pullRequest.ts
Normal file
10
app/client/src/git/requests/pullRequest.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { PullRequestResponse } from "./pullRequest.types";
|
||||
|
||||
export default async function pullRequest(
|
||||
branchedApplicationId: string,
|
||||
): Promise<AxiosResponse<PullRequestResponse>> {
|
||||
return Api.get(`${GIT_BASE_URL}/pull/app/${branchedApplicationId}`);
|
||||
}
|
||||
6
app/client/src/git/requests/pullRequest.types.ts
Normal file
6
app/client/src/git/requests/pullRequest.types.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export interface PullRequestResponse {
|
||||
mergeStatus: {
|
||||
isMergeAble: boolean;
|
||||
status: string; // pull merge status
|
||||
};
|
||||
}
|
||||
12
app/client/src/git/requests/toggleAutocommitRequest.ts
Normal file
12
app/client/src/git/requests/toggleAutocommitRequest.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { ToggleAutocommitResponse } from "./toggleAutocommitRequest.types";
|
||||
|
||||
export default async function toggleAutocommitRequest(
|
||||
baseApplicationId: string,
|
||||
): Promise<AxiosResponse<ToggleAutocommitResponse>> {
|
||||
return Api.patch(
|
||||
`${GIT_BASE_URL}/auto-commit/toggle/app/${baseApplicationId}`,
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export type ToggleAutocommitResponse = boolean;
|
||||
10
app/client/src/git/requests/triggerAutocommitRequest.ts
Normal file
10
app/client/src/git/requests/triggerAutocommitRequest.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { TriggerAutocommitResponse } from "./triggerAutocommitRequest.types";
|
||||
|
||||
export default async function triggerAutocommitRequest(
|
||||
branchedApplicationId: string,
|
||||
): Promise<AxiosResponse<TriggerAutocommitResponse>> {
|
||||
return Api.post(`${GIT_BASE_URL}/auto-commit/app/${branchedApplicationId}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import type { AutocommitStatus } from "../constants/enums";
|
||||
|
||||
export interface TriggerAutocommitResponse {
|
||||
autoCommitResponse: AutocommitStatus;
|
||||
progress: number;
|
||||
branchName: string;
|
||||
}
|
||||
13
app/client/src/git/requests/updateGlobalConfigRequest.ts
Normal file
13
app/client/src/git/requests/updateGlobalConfigRequest.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import type {
|
||||
UpdateGlobalConfigRequestParams,
|
||||
UpdateGlobalConfigResponse,
|
||||
} from "./updateGlobalConfigRequest.types";
|
||||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
|
||||
export default async function updateGlobalConfigRequest(
|
||||
params: UpdateGlobalConfigRequestParams,
|
||||
): Promise<AxiosResponse<UpdateGlobalConfigResponse>> {
|
||||
return Api.post(`${GIT_BASE_URL}/profile/default`, params);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
export interface UpdateGlobalConfigRequestParams {
|
||||
authorName: string;
|
||||
authorEmail: string;
|
||||
}
|
||||
|
||||
export interface UpdateGlobalConfigResponse {
|
||||
default: {
|
||||
authorName: string;
|
||||
authorEmail: string;
|
||||
};
|
||||
}
|
||||
14
app/client/src/git/requests/updateLocalConfigRequest.ts
Normal file
14
app/client/src/git/requests/updateLocalConfigRequest.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import type { AxiosResponse } from "axios";
|
||||
import type {
|
||||
UpdateLocalConfigRequestParams,
|
||||
UpdateLocalConfigResponse,
|
||||
} from "./updateLocalConfigRequest.types";
|
||||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
|
||||
export default async function updateLocalConfigRequest(
|
||||
baseApplicationId: string,
|
||||
params: UpdateLocalConfigRequestParams,
|
||||
): Promise<AxiosResponse<UpdateLocalConfigResponse>> {
|
||||
return Api.put(`${GIT_BASE_URL}/profile/app/${baseApplicationId}`, params);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
export interface UpdateLocalConfigRequestParams {
|
||||
authorName: string;
|
||||
authorEmail: string;
|
||||
useGlobalProfile: boolean;
|
||||
}
|
||||
|
||||
export interface UpdateLocalConfigResponse {
|
||||
[baseApplicationId: string]: {
|
||||
authorName: string;
|
||||
authorEmail: string;
|
||||
useGlobalProfile: boolean;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import Api from "api/Api";
|
||||
import { GIT_BASE_URL } from "./constants";
|
||||
import type {
|
||||
UpdateProtectedBranchesRequestParams,
|
||||
UpdateProtectedBranchesResponse,
|
||||
} from "./updateProtectedBranchesRequest.types";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export default async function updateProtectedBranchesRequest(
|
||||
baseApplicationId: string,
|
||||
params: UpdateProtectedBranchesRequestParams,
|
||||
): Promise<AxiosResponse<UpdateProtectedBranchesResponse>> {
|
||||
return Api.post(
|
||||
`${GIT_BASE_URL}/branch/app/${baseApplicationId}/protected`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
export interface UpdateProtectedBranchesRequestParams {
|
||||
branchNames: string[];
|
||||
}
|
||||
|
||||
export type UpdateProtectedBranchesResponse = string[];
|
||||
|
|
@ -5,7 +5,7 @@ import type {
|
|||
GitImportStep,
|
||||
GitOpsTab,
|
||||
GitSettingsTab,
|
||||
} from "./enums";
|
||||
} from "./constants/enums";
|
||||
|
||||
// These will be updated when contracts are finalized
|
||||
export type GitMetadata = Record<string, unknown>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user