Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions app/client/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,23 @@ module.exports = {
],
roots: ["<rootDir>/src"],
transform: {
"^.+\\.(png|js|ts|tsx)$": "ts-jest",
"^.+\\.(png|js|ts|tsx)$": [
"ts-jest",
{
isolatedModules: true,
diagnostics: {
ignoreCodes: [1343],
},
astTransformers: {
before: [
{
path: "node_modules/ts-jest-mock-import-meta",
options: { metaObjectReplacement: { url: "https://www.url.com" } },
},
],
},
}
],
},
testEnvironment: "jsdom",
testTimeout: 9000,
Expand Down Expand Up @@ -52,22 +68,10 @@ module.exports = {
"<rootDir>/node_modules/@blueprintjs/select/lib/esnext",
"@appsmith/ads": "<rootDir>/node_modules/@appsmith/ads",
"^canvas$": "jest-canvas-mock",
"^entities/(.*)$": "<rootDir>/src/entities/$1", // Match 'entities/*'

},
globals: {
"ts-jest": {
isolatedModules: true,
diagnostics: {
ignoreCodes: [1343],
},
astTransformers: {
before: [
{
path: "node_modules/ts-jest-mock-import-meta",
options: { metaObjectReplacement: { url: "https://www.url.com" } },
},
],
},
},
APPSMITH_FEATURE_CONFIGS: {
sentry: {
dsn: parseConfig("__APPSMITH_SENTRY_DSN__"),
Expand Down
8 changes: 4 additions & 4 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
"@types/deep-diff": "^1.0.0",
"@types/dom-view-transitions": "^1.0.5",
"@types/downloadjs": "^1.4.2",
"@types/jest": "^27.4.1",
"@types/jest": "^29.5.3",
"@types/jshint": "^2.12.0",
"@types/lodash": "^4.14.120",
"@types/mixpanel-browser": "^2.50.1",
Expand Down Expand Up @@ -329,9 +329,9 @@
"eslint-plugin-testing-library": "^6.2.0",
"factory.ts": "^0.5.1",
"husky": "^8.0.0",
"jest": "^27.4.1",
"jest": "^29.6.1",
"jest-canvas-mock": "^2.3.1",
"jest-environment-jsdom": "^27.4.1",
"jest-environment-jsdom": "^29.6.1",
"jest-styled-components": "^7.0.8",
"json5": "^2.2.3",
"knip": "^5.30.2",
Expand All @@ -354,7 +354,7 @@
"redux-devtools-extension": "^2.13.8",
"redux-mock-store": "^1.5.4",
"redux-saga-test-plan": "^4.0.6",
"ts-jest": "29.1.0",
"ts-jest": "^29.1.0",
"ts-jest-mock-import-meta": "^0.12.0",
"ts-node": "^10.9.1",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz"
Expand Down
4 changes: 2 additions & 2 deletions app/client/packages/ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"@rollup/plugin-commonjs": "^22.0.0",
"@types/escodegen": "^0.0.7",
"@types/lodash": "^4.14.120",
"acorn": "^8.8.0",
"acorn-walk": "^8.2.0",
"acorn": "8.14.0",
"acorn-walk": "8.3.4",
"astravel": "^0.6.1",
"astring": "^1.7.5",
"escodegen": "^2.0.0",
Expand Down
21 changes: 8 additions & 13 deletions app/client/packages/ast/src/actionCreator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const setCallbackFunctionField = (
currentValueAstWithComments,
0,
undefined,
(type, node) => isCallExpressionNode(node),
(_type, node) => isCallExpressionNode(node),
);

if (found) {
Expand Down Expand Up @@ -717,7 +717,7 @@ export const replaceActionInQuery = (
});

simple(astWithComments, {
CallExpression(node) {
CallExpression(node: Node) {
if (
isCallExpressionNode(node) &&
isMemberExpressionNode(node.callee) &&
Expand Down Expand Up @@ -800,16 +800,13 @@ export function canTranslateToUI(
simple(astWithComments, {
ConditionalExpression(node) {
if (
// @ts-expect-error: types not matched
isCallExpressionNode(node.consequent) ||
// @ts-expect-error: types not matched
isCallExpressionNode(node.alternate)
) {
canTranslate = false;
}
},
LogicalExpression(node) {
// @ts-expect-error: types not matched
if (isCallExpressionNode(node.left) || isCallExpressionNode(node.right)) {
canTranslate = false;
}
Expand Down Expand Up @@ -912,12 +909,10 @@ export function getMainAction(
ExpressionStatement(node) {
simple(node, {
CallExpression(node) {
// @ts-expect-error: types not matched
if (node.callee.type === NodeTypes.Identifier) {
mainAction = generate(node, { comments: true }).trim();
} else {
mainAction =
// @ts-expect-error: types not matched
generate(node.callee, { comments: true }).trim() + "()";
}
},
Expand Down Expand Up @@ -989,7 +984,7 @@ export function getThenCatchBlocksFromQuery(
astWithComments,
0,
undefined,
function (type, node) {
function (_type, node) {
if (isCallExpressionNode(node)) {
if (isMemberExpressionNode(node.callee)) {
if (node.callee.object === rootCallExpression) {
Expand Down Expand Up @@ -1020,7 +1015,7 @@ export function getThenCatchBlocksFromQuery(
}

const secondBlockType = firstBlockType === "then" ? "catch" : "then";
const secondBlock = findNodeAt(ast, 0, undefined, function (type, node) {
const secondBlock = findNodeAt(ast, 0, undefined, function (_type, node) {
if (isCallExpressionNode(node)) {
if (isMemberExpressionNode(node.callee)) {
if (node.callee.object === firstBlock) {
Expand Down Expand Up @@ -1073,7 +1068,7 @@ export function setThenBlockInQuery(
astWithComments,
0,
undefined,
function (type, node) {
function (_type, node) {
if (isCallExpressionNode(node)) {
if (isMemberExpressionNode(node.callee)) {
if (node.callee.object === rootCallExpression) {
Expand Down Expand Up @@ -1117,7 +1112,7 @@ export function setThenBlockInQuery(
astWithComments,
0,
undefined,
function (type, node) {
function (_type, node) {
if (isCallExpressionNode(node)) {
if (isMemberExpressionNode(node.callee)) {
if (node.callee.object === rootCallExpression) {
Expand Down Expand Up @@ -1393,7 +1388,7 @@ function findNodeWithCalleeAndProperty(
) {
if (!ast || !callee || !property) return undefined;

return findNodeAt(ast, 0, undefined, function (type, node) {
return findNodeAt(ast, 0, undefined, function (_type, node) {
if (isCallExpressionNode(node)) {
if (isMemberExpressionNode(node.callee)) {
if (node.callee.object === callee) {
Expand Down Expand Up @@ -1431,7 +1426,7 @@ export function getFunctionParams(code: string, evaluationVersion: number) {

export function getQueryParam(
code: string,
number: number,
_number: number,
evaluationVersion: number,
) {
try {
Expand Down
2 changes: 1 addition & 1 deletion app/client/packages/ast/src/jsObject/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const parseJSObject = (code: string) => {
let JSObjectProperties: NodeWithLocation<PropertyNode>[] = [];

simple(ast, {
ExportDefaultDeclaration(node) {
ExportDefaultDeclaration(node: Node) {
if (
!isExportDefaultDeclarationNode(node) ||
!isObjectExpression(node.declaration)
Expand Down
3 changes: 3 additions & 0 deletions app/client/packages/git/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.eslintrc.base.json"]
}
15 changes: 15 additions & 0 deletions app/client/packages/git/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@appsmith/git",
"description": "This package contains all the git related functionality for Appsmith UI",
"private": true,
"version": "1.0.0",
"main": "src/index.ts",
"scripts": {
"lint": "yarn g:lint",
"prettier": "yarn g:prettier",
"test:unit": "yarn g:jest --passWithNoTests"
},
"dependencies": {
"@reduxjs/toolkit": "^2.3.0"
}
}
26 changes: 26 additions & 0 deletions app/client/packages/git/src/actions/commitActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction";
import type { GitArtifactPayloadAction } from "../types";

export const commitInitAction = createSingleArtifactAction((state) => {
state.commit.loading = true;
state.commit.error = null;

return state;
});

export const commitSuccessAction = createSingleArtifactAction((state) => {
state.commit.loading = false;

return state;
});

export const commitErrorAction = createSingleArtifactAction(
(state, action: GitArtifactPayloadAction<{ error: string }>) => {
const { error } = action.payload;

state.commit.loading = false;
state.commit.error = error;

return state;
},
);
26 changes: 26 additions & 0 deletions app/client/packages/git/src/actions/connectActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction";
import type { GitArtifactPayloadAction } from "../types";

export const connectInitAction = createSingleArtifactAction((state) => {
state.connect.loading = true;
state.connect.error = null;

return state;
});

export const connectSuccessAction = createSingleArtifactAction((state) => {
state.connect.loading = false;

return state;
});

export const connectErrorAction = createSingleArtifactAction(
(state, action: GitArtifactPayloadAction<{ error: string }>) => {
const { error } = action.payload;

state.connect.loading = false;
state.connect.error = error;

return state;
},
);
29 changes: 29 additions & 0 deletions app/client/packages/git/src/actions/fetchBranchesActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { GitArtifactPayloadAction, GitBranches } from "../types";
import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction";

export const fetchBranchesInitAction = createSingleArtifactAction((state) => {
state.branches.loading = true;
state.branches.error = null;

return state;
});

export const fetchBranchesSuccessAction = createSingleArtifactAction(
(state, action: GitArtifactPayloadAction<{ branches: GitBranches }>) => {
state.branches.loading = false;
state.branches.value = action.payload.branches;

return state;
},
);

export const fetchBranchesErrorAction = createSingleArtifactAction(
(state, action: GitArtifactPayloadAction<{ error: string }>) => {
const { error } = action.payload;

state.branches.loading = false;
state.branches.error = error;

return state;
},
);
29 changes: 29 additions & 0 deletions app/client/packages/git/src/actions/fetchMetadataActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { GitArtifactPayloadAction, GitMetadata } from "../types";
import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction";

export const fetchMetadataInitAction = createSingleArtifactAction((state) => {
state.metadata.loading = true;
state.metadata.error = null;

return state;
});

export const fetchMetadataSuccessAction = createSingleArtifactAction(
(state, action: GitArtifactPayloadAction<{ metadata: GitMetadata }>) => {
state.metadata.loading = false;
state.metadata.value = action.payload.metadata;

return state;
},
);

export const fetchMetadataErrorAction = createSingleArtifactAction(
(state, action: GitArtifactPayloadAction<{ error: string }>) => {
const { error } = action.payload;

state.metadata.loading = false;
state.metadata.error = error;

return state;
},
);
29 changes: 29 additions & 0 deletions app/client/packages/git/src/actions/fetchStatusActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { GitArtifactPayloadAction, GitStatus } from "../types";
import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction";

export const fetchStatusInitAction = createSingleArtifactAction((state) => {
state.status.loading = true;
state.status.error = null;

return state;
});

export const fetchStatusSuccessAction = createSingleArtifactAction(
(state, action: GitArtifactPayloadAction<{ status: GitStatus }>) => {
state.status.loading = false;
state.status.value = action.payload.status;

return state;
},
);

export const fetchStatusErrorAction = createSingleArtifactAction(
(state, action: GitArtifactPayloadAction<{ error: string }>) => {
const { error } = action.payload;

state.status.loading = false;
state.status.error = error;

return state;
},
);
Loading