Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Modules #2344

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5f87ca3
feat: Modules
harshilp24 Jun 25, 2024
7e3381d
..
harshilp24 Jun 25, 2024
11a8449
user-test-fixes
harshilp24 Jun 26, 2024
977322e
...
harshilp24 Jun 27, 2024
e93a601
..
harshilp24 Jul 2, 2024
e979cde
...
harshilp24 Jul 3, 2024
e54214c
...
harshilp24 Jul 4, 2024
f7b538a
..
harshilp24 Jul 4, 2024
72714e7
..
harshilp24 Jul 4, 2024
d25e62b
...
harshilp24 Jul 4, 2024
d2d0a5e
...
harshilp24 Jul 4, 2024
b24a3b1
..
harshilp24 Jul 8, 2024
9a2be93
...
harshilp24 Jul 9, 2024
e92d8ac
...
harshilp24 Jul 9, 2024
c878729
custom-login
harshilp24 Jul 11, 2024
c65f920
..
harshilp24 Jul 11, 2024
4a19340
..
harshilp24 Jul 11, 2024
9dd6319
..
harshilp24 Jul 11, 2024
6d76292
..
harshilp24 Jul 11, 2024
865046c
...
harshilp24 Jul 11, 2024
440e79d
..
harshilp24 Jul 12, 2024
9b09195
..
harshilp24 Jul 16, 2024
94d962d
...
harshilp24 Jul 16, 2024
5fbc0de
..
harshilp24 Jul 16, 2024
993ceed
...
harshilp24 Jul 16, 2024
abd71b1
custom-auth
harshilp24 Jul 16, 2024
d81aef6
..
harshilp24 Jul 16, 2024
f23de01
..
harshilp24 Jul 16, 2024
eb153db
...
harshilp24 Jul 22, 2024
d1da14d
..
harshilp24 Jul 22, 2024
8e367a2
..
harshilp24 Jul 22, 2024
7c50c7f
..
harshilp24 Jul 23, 2024
688b36c
...
harshilp24 Jul 24, 2024
ac1cad4
overview
harshilp24 Jul 24, 2024
fe7d53c
..
harshilp24 Jul 24, 2024
a975fae
...
harshilp24 Jul 28, 2024
d66b5c3
...
harshilp24 Jul 28, 2024
4349a3c
..
harshilp24 Aug 5, 2024
e6be569
callout
harshilp24 Jan 20, 2025
e2acb14
Merge branch 'main' into new-package-2
harshilp24 Jan 20, 2025
de545a0
..
harshilp24 Jan 20, 2025
afcc645
..
harshilp24 Jan 20, 2025
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
1 change: 1 addition & 0 deletions website/docs/advanced-concepts/custom-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_position: 1
description: In this guide, you'll learn how to implement a custom Auth flow using an API with JWTs.
---


# Integrate Custom Authentication

This guide walks you through the process of building custom authentication and integrating your Appsmith applications with any authentication provider.
Expand Down
1 change: 1 addition & 0 deletions website/docs/packages/how-to-guides/create-js-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ tags={[
This guide demonstrates how to use JS modules to refresh OAuth tokens across all apps, enabling you to renew and extend your authentication access.

## Create JS module

<div style={{ position: "relative", paddingBottom: "calc(50.520833333333336% + 41px)", height: "0", width: "100%" }}>
<iframe src="https://demo.arcade.software/3sTHVS5YLf5WTA05iplD?embed" frameborder="0" loading="lazy" webkitallowfullscreen mozallowfullscreen allowfullscreen style={{ position: "absolute", top: "0", left: "0", width: "100%", height: "100%", colorScheme: "light" }} title="Appsmith | Connect Data">
</iframe>
Expand Down
145 changes: 145 additions & 0 deletions website/docs/packages/how-to-guides/pass-date-between-modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
title: Pass data between modules
hide_title: true
---
<!-- vale off -->

<div className="tag-wrapper">
<h1>Pass data between modules</h1>

<Tags
tags={[
{ name: "Business", link: "https://www.appsmith.com/pricing", additionalClass: "business" }
]}
/>

</div>

<!-- vale on -->

This page shows how to pass data between a query and a JS module, which allows you to handle and manipulate data efficiently within your JS code.



## Prerequisites

A package that has already been created. For more information, see [Package and query modules tutorials](/packages/tutorial/query-module).

## Configure package

Follow these steps to set up JS and query modules within the package.

<div style={{ position: "relative", paddingBottom: "calc(50.520833333333336% + 41px)", height: "0", width: "100%" }}>
<iframe src="https://demo.arcade.software/xA1AYQZs2KIdFl5qwWD9?embed" frameborder="0" loading="lazy" webkitallowfullscreen mozallowfullscreen allowfullscreen style={{ position: "absolute", top: "0", left: "0", width: "100%", height: "100%", colorScheme: "light" }} title="Appsmith | Connect Data">
</iframe>
</div>


1. Create a new Query module to fetch data by clicking on the **+** icon in the top-left corner.


<dd>

*Example:* If you want to display product details in a chart widget based on the category selected by the user, you can create a SQL query like:

```sql
SELECT * FROM public."product"
WHERE category = `Apparel`;
```

</dd>

2. Create an **Input** from the right-side property pane to dynamically pass data to the query.

<dd>

*Example:* To dynamically pass category information to your query, use the `inputs` property as shown below:

```sql
SELECT * FROM public."product"
WHERE category = {{inputs.category}};
```

</dd>


3. Create a new JS module to run the query module and manipulate the query data:


<dd>

* To access the **Query module data in the JS module**, use the reference properties of the query module, like: `productData.data`.

* To pass data from the **JS module to Query modules**, you can pass parameters at runtime using `run()`, like `{{ productData.run({ id: product.category }) }}`.

* To access the **JS module data in the Query module**, create input parameters and use them inside the query, like `{{inputs.category}}`.



*Example:* If you want to visualize inventory data in a chart widget, this JS module fetches product details based on the selected category.

```js
export default {
async fetchProductsByCategory(categoryName) {
try {
// Pass category name to Query module
const productsData = await fetchProductsByCategoryQuery.run({ category: categoryName });

// Format product data for display
const formattedProductsData = productsData.map(product => {
return {
x: product.product_name,
y: product.stock,
// Add more fields as needed
};
});

return formattedProductsData; // Return formatted product data
} catch (error) {
console.error('Error fetching product data:', error);
throw error; // Propagate the error for handling elsewhere if needed
}
},
};
```

</dd>



3. Publish the package.

4. Open your App from the homepage and ensure that both the app and modules share the same workspace.

5. Select the *JS* tab on the Entity Explorer, add the JS module, and configure it to **Run on page load**.

6. Drag a Chart widget and configure the **Series data** property to display data from the JS module.

<dd>

*Example:*

```js
{{productModule1.fetchProductsByCategory.data}}
```

</dd>

7. Drag a Select widget and configure the **Source data** property to display a list of product categories.


8. Configure the **onOptionChange** event of the Select widget to run the JS module function when an option is selected.

<dd>

*Example:*

```js
{{productModule1.fetchProductsByCategory(Select1.selectedOptionValue);}}
```

</dd>




Loading
Loading