Commit Graph

3325 Commits

Author SHA1 Message Date
Shrikant Sharat Kandula
76de6761d6
chore: Use queryBuilder for count op (#31328) 2024-03-02 18:46:08 +05:30
Nidhi
6dd8b4995c
chore: Split companion to package import (#31394) 2024-03-01 11:29:51 +05:30
Shrikant Sharat Kandula
458f3c332d
chore: Remove mongoTemplate from custom action repo impl (#31369)
1. We remove the `mongoTemplate` and replace it with `mongoOperations`,
which we get from the base impl class anyway. One less thing to port.

2. We also move the actual _publish_ logic to a separate protected
method so it can be reused in the EE repo impl class, which has this
logic duplicated.
2024-03-01 10:28:18 +05:30
Shrikant Sharat Kandula
45b81f95e2
chore: Remove upsert in setting last release notes version (#31324)
Instead of `upsert`, we `update` first, which is arguably the most used
operation in this context, and if that fails, then we attempt an insert.

We're not expecting a performance hit, since most operations here would
be an actual `update` only.
2024-02-29 12:18:27 +05:30
Shrikant Sharat Kandula
e387aa2f4a
chore: No upsert when saving datasource structure (#31320)
Instead of `upsert`, we `update` first, which is arguably the most used
operation in this context, and if that fails, then we attempt an insert.

We're not expecting a performance hit, since most operations here would
be an actual `update` only.


cherry picked from commit 75d2f2a8c4,
which was accidentally pushed to `release` branch.
2024-02-29 12:17:57 +05:30
Shrikant Sharat Kandula
2eb14cad7c
ci: Collect failed server tests from Surefire reports (#31366)
The current `TestResultLoggerExtension` extension only finds failed
tests from the server module, and not from any of the plugin or other
modules.

To fix this, this PR collects failed tests using the Surefire XML test
reports already generated by the `mvn test` command.
2024-02-29 07:10:39 +05:30
Shrikant Sharat Kandula
9f3ac2c561
chore: Revert Upgrade Mockito and surefire plugin (#31073) (#31334)
This reverts commit 5647916478.

This seems to have broken our ability to re-run failed tests on server
workflow. We'll bring the changes back after we figure out how to not
lose that capability.
2024-02-28 14:49:41 +05:30
Nilesh Sarupriya
f715cfd502
chore: code split for entity search (#31332)
## Description
> Code split for entity search.
> 1. Move the methods to SearchEntityHelper to be readily available for
re-use.
> 2. Rename SearchEntitySolutionTest -> SearchEntitySolutionCETest

#### PR fixes following issue(s)
Fixes [[Task]: Add search functionality for workflows
#30843](https://github.com/appsmithorg/appsmith/issues/30843)

#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing
>
#### How Has This Been Tested?
> None, as this is just a refactor.

#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Improved code efficiency in search functionality by centralizing the
logic for creating pageable and sort objects.
- **Tests**
	- Renamed a test class to better reflect its purpose.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
2024-02-28 14:12:59 +05:30
Abhijeet
d25ae858e9
fix: Add as a query param for workspace invite email as per updated format after homepage revamp (#31295)
#### PR fixes following issue(s)
Fixes https://github.com/appsmithorg/appsmith/issues/31280

#### Media
<img width="1471" alt="Screenshot 2024-02-27 at 11 04 33 AM"
src="https://github.com/appsmithorg/appsmith/assets/41686026/a7b574fb-5a9e-4be5-a3f1-18afd3f4f956">

#### Type of change
- Bug fix (non-breaking change which fixes an issue)

## Testing
>
#### How Has This Been Tested?
- [x] Manual
- [x] JUnit
- [ ] Jest
- [ ] Cypress

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Modified the way workspace URLs are constructed to enhance link
handling.
- **Tests**
- Added tests to ensure the reliability of workspace invite URL
generation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-28 02:22:08 -06:00
Sumit Kumar
3e29634cbb
chore: enable Micrometer metrics conditionally (#31204) 2024-02-28 13:42:55 +05:30
Shrikant Sharat Kandula
e2d226f127 Revert "chore: Use queryBulider for count op"
This reverts commit 70cd65ec7d.
2024-02-28 11:09:53 +05:30
Shrikant Sharat Kandula
70cd65ec7d chore: Use queryBulider for count op 2024-02-28 10:58:56 +05:30
Shrikant Sharat Kandula
21b0a5ebfb
chore: Fix for CVE-2024-1597 (#31301)
This should get rid of the vulnerable Postgres driver version.
2024-02-28 10:32:58 +05:30
Shrikant Sharat Kandula
e7573a7b81 Revert "chore: No upsert when saving datasource structure"
This reverts commit 75d2f2a8c4.
2024-02-27 22:00:13 +05:30
Shrikant Sharat Kandula
75d2f2a8c4 chore: No upsert when saving datasource structure 2024-02-27 21:58:13 +05:30
Shrikant Sharat Kandula
be027e8434
chore: Remove ineffectual user change handler (#31286)
This whole flow is not affecting anything. At the end, in the repo
methods, the change is applied to a `Workspace.userRoles` field, which
doesn't even exist today. Effectively making this flow ineffectual and
unnecessary.
2024-02-27 20:02:58 +05:30
Shrikant Sharat Kandula
e1f9f13dc4
chore: Replace remaining Q* usage with Fields (#31299)
Continuation of https://github.com/appsmithorg/appsmith/pull/31269.

We're not removing QueryDSL itself in this PR. That will happen after we
remove uses on the EE repo as well.
2024-02-27 17:39:05 +05:30
Shrikant Sharat Kandula
d59c8344c7
chore: Remove mongoTemplate in BaseService (#31283)
The `BaseService` keeps references to a `ReactiveMongoTemplate`, a
`MongoConverter` and a `Scheduler`.

For the first two, they shouldn't be directly used at all in Service
classes, that's an abstraction leak. That's what repositories are for.

The third one isn't really used anywhere in `BaseService` at all.

This PR removes all three of these from `BaseService`.
2024-02-27 16:48:02 +05:30
Shrikant Sharat Kandula
8f5efc94b5
chore: Remove simple mongoOperations uses in repo classes (#31285)
Replace simple uses of `mongoOperations` in repo classes with equivalent
operations using `queryBuilder` API.
2024-02-27 12:25:36 +05:30
sneha122
c9582f5e21
chore: instrumentation added for generate crud create action (#31277)
## Description

This PR adds `create_NEWACTION` instrumentation for generate crud flow.
Today generate crud flow is handled by `/crud` API, this API is
responsible for creating actions, widgets and everything that is needed
for generating crud app. When actions are created in generate crud flow,
`create_NEWACTION` event is triggered, we wanted to add details like
`isUserCreated` and `accelerator` to this event, which will help us in
segregation of actions based on whether they were created manually or by
generate crud accelerator.

In this PR, we are passing the event context of generate crud when
calling create action function, this context is then eventually added to
the event properties.

**Test cases:**
- When generate crud flow is triggered, `create_NEWACTION` event should
have two more props `isUserCreated: false` and `accelerator:
"generate-crud`
- When actions are created by any other method, these two properties
wont be there.

#### PR fixes following issue(s)
Fixes #31171 
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced a new event type `GENERATE_PAGE` for enhanced analytics and
event tracking capabilities.
- **Refactor**
- Modified analytics properties generation across various services to
include context-specific information, improving the accuracy and
relevance of analytics data collected.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2024-02-27 11:50:20 +05:30
Shrikant Sharat Kandula
b5e9ce8718
chore: Use Lombok's FieldNameConstants instead of QueryDSL (#31269)
QueryDSL will be replaced with Lombok's `FieldNameConstants` here. Why?

1. QueryDSL with JPA on relational databases doesn't lend itself very
well to nested data structures. But with MongoDB, it works quite well.
So we've come to rely on it quite a bit. Since we intend to move towards
a more flat, relation-ed and normalized DB design once we get to
Postgres, dealing with nested data structures should be seen as
temporary.

2. We only use QueryDSL for field name constants, and absolutely nothing
else. QueryDSL is a far more capable and powerful system, and is
overkill for this purpose. Lombok's annotation is exactly tuned for this
purpose and is more concise and easy-to-use.

3. QueryDSL query generation current doesn't work in IntelliJ, but
Lombok's does. So this will free us up from having to run a Maven build
when sometimes switching branches.

**PS**: This PR doesn't remove QueryDSL entirely. Only a part of it.
That'd become a much bigger PR and I'm already uncomfortable with the
size of this PR. Once this is merged, I'll open further PRs until we
completely remove QueryDSL.

**PPS**: QueryDSL is a powerful querying mechanism that we don't use
today. Perhaps once we're comfortable with Postgres in the future, we
will very likely revisit.
2024-02-26 16:33:07 +05:30
Shrikant Sharat Kandula
a97c41ac43
chore: Add updateFirstAndFind to Fluent repo API (#31165) 2024-02-26 15:40:00 +05:30
Shrikant Sharat Kandula
aeee1fa697
chore: Remove mongoOperations use in Application repo (#31181)
Porting `CustomApplicationRepositoryCEImpl` to use the Bridge API, where
possible, and not use `mongoOperations` at all.
2024-02-26 14:34:06 +05:30
Shrikant Sharat Kandula
a690d15990
chore: Remove leaks of UpdateResult outside of repository layer (#31166)
This is a MongoDB-specific API class that won't be available with
Postgres, and we don't use its contents much either.
2024-02-26 11:22:32 +05:30
Shrikant Sharat Kandula
5647916478
chore: Upgrade Mockito and surefire plugin (#31073)
Upgrading Mockito ahead of upgrading Spring itself.
2024-02-25 00:24:51 +05:30
Trisha Anand
9c97aa2f0d
feat: Adding UserAgent Tag in databricks datasource configuration, a recommended practice (#31195)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added the ability to set a user agent tag for Databricks connections,
with "Appsmith" as the default value.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-22 10:53:35 +05:30
Nirmal Sarswat
0dce1ee470
fix: Add missing policies field in Appsmith AI Default datasource (#31102)
## Description
Add missing fields in Appsmith AI Default datasource

#### Type of change
- Bug fix (non-breaking change which fixes an issue)

## Testing
#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced tracking for creation and update times (`createdAt` and
`updatedAt`) for Actions and Datasources to enhance data management and
auditing capabilities.
- Enhanced the default Appsmith AI Datasources with necessary fields and
default permission groups to ensure seamless operation and access
control.
- **Refactor**
- Consolidated and refined migration scripts to add missing fields and
configurations to Appsmith AI Datasources, improving their functionality
and reliability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-16 21:07:13 +05:30
Shrikant Sharat Kandula
712a28e059
fix: Signup error redirect to wrong path (#31179)
On signup failure, we need to redirect the client to same signup page
they were on, for the error message to show up. So instead of
redirecting to the homepage, we get the path from the incoming request
and use that.
2024-02-16 14:19:30 +05:30
Shrikant Sharat Kandula
91fea4fbe0
chore: use repo method to update workspace (#30998)
Reducing our use of `mongoTemplate` and kind-of undoing
https://github.com/appsmithorg/appsmith/pull/22549.
2024-02-16 10:08:21 +05:30
Shrikant Sharat Kandula
1cb53c4e8e
chore: Introducing the Bridge API (#31147)
The Bridge API is an alternative to building `Criteria` objects for
running operations on the database.

**Why do we need/want this?** The Bridge API will have the same
interface in Appsmith MongoDB, and in Appsmith Postgres. This means when
we write a function that uses the Bridge API to run a query, we enjoy
the guarantee that the function will work with both MongoDB and
Postgres.

**Why is that important?** As new features are being developed, and
changes made, the Postgres branch is having to play catch-up in porting
the queries to Postgres. But with this, that won't be necessary.
Besides, the diff between MongoDB and Postgres versions of Appsmith
would be significantly smaller with this.

**What conditions will be supported?** The Bridge API is intentionally
non-exhaustive. It is intended to replace the most commonly used
criteria definitions. For the rest, falling back to the way we used to
build Criteria is just fine. We're only changing the ladder used to get
to the ceiling. The hammers to break the ceiling to go further, is still
there.

**Can I start using it?** Yes please. I'm only adding one condition
here, but I have changes for ~4 more (`in`, `isNull`, etc.) that I'll be
pushing as PRs next up. I'm also only using it in one place in this PR.
I'll start moving more direct uses of Criteria API to the Bridge API in
future PRs.

**Why does Bridge have `.equal()` instead of `.where().is()`?** Two
reasons. One, an API like `.equal` is easier to implement, and since the
Bridge API is code that we will have to maintain, I voted for
simplicity. Two, once we move to Postgres, we'll be using the
`CriteriaBuilder` API, which uses the `.equal()` style, so might as well
get used it. 🙂
2024-02-16 05:46:04 +05:30
Manish Kumar
2a1ba8083c
chore: aforce issue for multipart file upload (#30376)
## Description
> small change to fix the issue of file uploads

Fixes https://github.com/appsmithorg/appsmith/issues/30451

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Increased the maximum in-memory size for multipart requests to 150MB,
enhancing file upload capabilities.
- Added the ability to control the max size of multipart files in
request objects.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-15 21:25:40 +07:00
Nidhi
4dd9d77c8b
chore: Refactored importables to be artifact agnostic (#31123) 2024-02-15 19:42:35 +05:30
Shrikant Sharat Kandula
7d55eaabfb
chore: Remove mongoOperations in updateById method (#31141) 2024-02-15 19:25:21 +05:30
Shrikant Sharat Kandula
565dab4a62
fix: Request referer shouldn't influence redirect URL (#31155)
The form signup API responds in a failure state, with a redirection URL.
That URL blindly uses the `Referer` header as passed-in. This shows up a
security issue in a few places, although it's not very exploitable.


![shot-2024-02-15-11-13-01](https://github.com/appsmithorg/appsmith/assets/120119/9c4ea8b4-d028-4cbd-a348-f2483fad0f49)

Nonetheless, we don't need the host to show up in the redirection URL at
all. The signup success API is already using a redirect URL without
host, for example.


![shot-2024-02-15-11-11-41](https://github.com/appsmithorg/appsmith/assets/120119/5eb62c42-cf09-4c1f-8269-775f26af2dce)

With the changes in this PR, the failure response also uses a host-less
redirect.


![shot-2024-02-15-11-14-04](https://github.com/appsmithorg/appsmith/assets/120119/d0640ea2-f934-4f57-ade4-189964d6d11a)
2024-02-15 19:24:34 +05:30
Shrikant Sharat Kandula
1278287609
chore: Remove mongoOperations in two more methods (#31136)
It's doing exactly the same thing, but with a lot of the code
duplicated.
2024-02-15 13:37:25 +05:30
Nilansh Bansal
96ba97a1b2
fix: added escaping logic for html reserved characters (#31133)
## Description
> This PR adds escaping logic for HTML reserved characters `&quot;` and
`&#34;`. Both of these characters were getting unescaped to double
quotes (") leading to a JSON parse error.
> I have updated the code to escape these with a backslash before
getting converted.

[ref](https://theappsmith.slack.com/archives/C0341RERY4R/p1707900321201109?thread_ts=1707510761.277959&cid=C0341RERY4R)
#### PR fixes following issue(s)
Fixes #31056 


#### Type of change
- Bug fix (non-breaking change which fixes an issue)

## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [x] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced data handling to ensure JSON validity by escaping double
quotes in certain outputs.
- **Tests**
- Added test cases to verify the new escaping logic for JSON and HTML
characters.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-15 11:36:34 +05:30
Shrikant Sharat Kandula
5c879230fc
chore: Fluent API for update methods (#31104) 2024-02-15 10:25:24 +05:30
Manish Kumar
0d77289e9c
chore: added split for permission provider (#31111) 2024-02-14 14:43:14 +05:30
Nilesh Sarupriya
c267965090
chore: refactor curl import API to support context type (#30934)
## Description

Support curl imports for different contexts. 

### Server changes

Previous API: 

`/api/v1/import?type=CURL&pageId={pageId}&name=Api2&workspaceId={workspaceId}`

New API: 
With context type, it will create for the specific context.

`/api/v1/import?type=CURL&contextId={contextId}&name=Api1&workspaceId={workspaceId}&contextType={contextType}`

Without context type, it will create for the page.

`/api/v1/import?type=CURL&contextId={contextId}&name=Api1&workspaceId={workspaceId}`

### Client changes
- Integrate api changes for curl import. Updated request params type and
interfaces for the saga functions
- Updated the form value types for the curl import editor



#### PR fixes following issue(s)
Fixes [[Task]: Curl Import isn't
working.](https://github.com/appsmithorg/appsmith/issues/30933)

#### Media
> N/A

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing
>
#### How Has This Been Tested?
- [x] Manual (using postman)
- [x] JUnit (existing test cases should work)

#### Test Plan
> N/A

#### Issues raised during DP testing
> None

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Enhanced API import functionality with a new context-aware mechanism,
allowing for more flexible integration within different parts of the
application.
- Updated various components and services to support the new contextId
and contextType parameters for improved data handling and redirection
logic.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
Co-authored-by: Ayush Pahwa <ayushpahwa96@gmail.com>
2024-02-14 12:18:30 +05:30
Manish Kumar
a5f3ff9ba0
chore: deleted import and export Application file (#31084) 2024-02-13 15:22:27 +05:30
Shrikant Sharat Kandula
99f919303d
chore: Don't expect .save() to return given object (#31049)
The `.save()` method currently returns the given object as is. But with
Hibernate, it returns the corresponding object from the persistence
store, if any, which _may_ be different. This is causing some very hard
to debug and subtle bugs.

This fix here, to just ignore the result of `.save()` is not a permanent
fix, it's just a workaround that works well in both worlds, MongoDB and
Hibernate. Once we move though, we may need to revisit.



![shot-2024-02-12-07-14-37](https://github.com/appsmithorg/appsmith/assets/120119/095d32fc-5009-4203-b906-df3d34a40818)
2024-02-13 09:47:05 +05:30
Sumit Kumar
334da091f6
chore: link Micrometer traces and metrics with NewRelic (#30957) 2024-02-13 00:21:42 +05:30
Shrikant Sharat Kandula
cdc5a358bb
chore: Remove InsertManyResult and BulkWriteResult (#31037)
These are MongoDB specific data structures and we don't actually use the
data we get in them. This PR removes their references entirely.
2024-02-12 13:33:44 +05:30
Shrikant Sharat Kandula
632c8a7b69
chore: use common function for building query (#31018)
The query execution methods, `queryAllExecute`, `queryOneExecute` etc.,
aren't using the same function to build the `Query` object. This PR
fixes it by using the common function.

But the common function has a problem. Check this out, this is the
current implementation:

```java
Query query = new Query();
criterias.stream().forEach(criteria -> query.addCriteria(criteria));
if (aclPermission == null) {
    query.addCriteria(new Criteria().andOperator(notDeleted()));
} else {
    query.addCriteria(new Criteria().andOperator(notDeleted(), userAcl(permissionGroups, aclPermission)));
}

if (!isEmpty(projectionFieldNames)) {
    projectionFieldNames.stream().forEach(fieldName -> query.fields().include(fieldName));
}

return query;
```

Here, we use `addCriteria` to add each of the criteria items given to
us, into the `query`. After that, we use `.andOperator` to add the
not-deleted and permission checks.

Looks good on the surface. Let's take an example. If the given criteria
list has `fieldName = "abc"` as the condition, this will end up in the
final query as (pseudo-code representation):

```javascript
{
	fieldName: "abc",
	$and: {
		$and: {
			deleted: false or missing,
			deletedAt: null
		},
		policies: {
			$elemMatch: permission check here,
		}
	}
}
```

Perfectly working query. Now, what if the incoming criteria list is a
little more complex, and has an `or` condition in it. This is what we
end up with:

```javascript
{
	$or: {
		field1: "val",
		field2: "val"
	},
	$and: {
		$and: {
			deleted: false or missing,
			deletedAt: null
		},
		policies: {
			$elemMatch: permission check here,
		}
	}
}
```

We end up with a `$or` and `$and` next to each other. This doesn't make
sense to MongoDB.

The way the query is built in the `queryAllExecute` method previously,
actually doesn't fall into this. That's the version we're changing the
common method into now. This is what it looks like:

```java
final ArrayList<Criteria> criteriaList = new ArrayList<>(criterias);
criteriaList.add(notDeleted());

final Criteria permissionCriteria = userAcl(permissionGroups, aclPermission);
if (permissionCriteria != null) {
    criteriaList.add(permissionCriteria);
}

final Query query = new Query(new Criteria().andOperator(criteriaList.toArray(new Criteria[0])));

if (!isEmpty(projectionFieldNames)) {
    query.fields().include(projectionFieldNames.toArray(new String[0]));
}

return query;
```

With this, the resulting query looks something like this:

```javascript
{
	$and: {
		$or: {
			field1: "val",
			field2: "val"
		},
		$and: {
			deleted: false or missing,
			deletedAt: null
		},
		policies: {
			$elemMatch: permission check here,
		}
	}
}
```

This isn't new code. This is how we've been building the query for
`queryAll` today. By moving this to the common method, we have this
resilient query building for `queryOne` and `queryFirst` as well.
2024-02-12 12:58:42 +05:30
Nidhi
2147b9fcea
chore: Moved datasource exportable to appropriate package (#31046) 2024-02-12 11:52:23 +05:30
Nidhi
010699e379
chore: CE companion to pkg export (#31039) 2024-02-12 11:29:59 +05:30
Nidhi
54091e255c
chore: Split changes for interface difference in generalizing exportable flow (#31017) 2024-02-09 16:18:49 +05:30
Shrikant Sharat Kandula
88c95b434b
chore: remove BaseDomain on WorkspacePlugin (take 2) (#31009)
Same as https://github.com/appsmithorg/appsmith/pull/30958, now with a
brand new migration to clean up!

The migration take 1.2 seconds on release and 0.1 seconds on
production-representative databases.
2024-02-09 13:03:07 +05:30
Manish Kumar
d1d13807e1
chore: Start Consumption for import and export (#30819) 2024-02-09 12:58:17 +05:30
Shrikant Sharat Kandula
ca5631e02c
test: Fix user used for test (#31012)
The test has a `@WithUserDetails(value = "admin@solutiontest.com")`
annotation, which means that's the logged-in user for the test's scope.
But the setup method calls `inviteUserToWorkspaceWithViewAccess`, which
tries to invite `usertest@usertest.com` and `admin@solutiontest.com` to
a just-created workspace. But since the workspace was just created by
`admin@solutiontest.com`, that user is already an admin on the workpace.
So we get this error:

```
com.appsmith.server.exceptions.AppsmithException: The user admin@solutiontest.com has already been added to the workspace with role Administrator - Source Workspace. To change the role, please navigate to `Manage users` page.
```

The test method's doesn't even get called. This error is from the
`setup` phase.

This PR fixes it by using `api_user` for the session instead of
`admin@solutiontest.com`.
2024-02-09 11:51:54 +05:30