BassemE/mulesoft-documentation-embeddings huggingface dataset:
Runtime (dw::Runtime) | MuleSoft Documentation
# Runtime (dw::Runtime)
This module contains functions for interacting with the DataWeave runtime, which executes the language.
To use this module, you must import it to your DataWeave code, for example, by adding the line `import * from dw::Runtime` to the header of your DataWeave script.
## Functions
Name | Description  
---|---  
| Returns an array of all `DataFormatDescriptor` values that are installed in the current instance of DataWeave. _Experimental:_ This function is an experimental feature that is subject to change or removal from future versions.  
Evaluates a script with the specified context and returns the result of that evaluation. _Experimental:_ This function is an experimental feature that is subject to change or removal from future versions.  
Evaluates the script at the specified URL. _Experimental:_ This function is an experimental feature that is subject to change or removal from future versions.  
Throws an exception with the specified message.  
Produces an error with the specified message if the expression in the evaluator returns `true`. Otherwise, the function returns the value.  
findDataFormatDescriptorByMime | Returns the `DataFormatDescriptor` based on the `dw::module::Mime::MimeType` specified or `null` if there is no `DataFormatDescriptor` for the given `MimeType`. _Experimental:_ This function is an experimental feature that is subject to change or removal from future versions.  
Returns the location of a given value, or `null` if the location can’t be traced back to a DataWeave file.  
| Returns the location string of a given value.  
Returns the result of the `orElse` argument if the `previous` argument to `try` fails. Otherwise, the function returns the value of the `previous` argument.  
Function to use with `try` to chain multiple `try` requests.  
Returns the value of the property with the specified name or `null` if the property is not defined.  
Returns all the properties configured for the DataWeave runtime, which executes the language.  
Runs the input script under the provided context and executes the script in the current runtime. _Experimental:_ This function is an experimental feature that is subject to change or removal from future versions.  
Runs the script at the specified URL. _Experimental:_ This function is an experimental feature that is subject to change or removal from future versions.  
Evaluates the delegate function and returns an object with `success: true` and `result` if the delegate function succeeds, or an object with `success: false` and `error` if the delegate function throws an exception.  
Returns the DataWeave version that is currently running.  
Stops the execution for the specified timeout period (in milliseconds).  
## Types
  *
Deployment Error When Configuring API Autodiscovery | MuleSoft Documentation
# Deployment Error When Configuring API Autodiscovery
When you configure Mule Gateway for API autodiscovery, you might receive the following "failed to deploy artifact" error:
```
org.mule.runtime.deployment.model.api.DeploymentException: Failed to deploy artifact [accounts]
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: org.mule.runtime.deployment.model.api.DeploymentInitException: PropertyNotFoundException: Couldn't find configuration property
value for key ${apiId} from properties provider Domain properties - within
resolver Deployment properties trying to process key apiId - within
resolver global-properties configuration attributes trying to process key apiId - within resolver environment properties provider trying to process key apiId - within resolver Deployment properties trying to process key apiId - within resolver External files trying to process key apiId - within resolver Deployment properties trying to process key apiId
```

## Cause
This issue occurs if you did not add the `apiId` property in the `config.properties` file, and failed to modify the value for the `apiId` attribute in the `api-gateway:autodiscovery` element. The Autodiscovery process runs on a specific instance of API Manager. For that reason, you must specify a valid `apiId` of type `long`.
If you deployed a proxy application through API Manager or downloaded the auto-generated proxy, this setting is automatically configured.
## Solution
To resolve this issue:
  1. Navigate to the config.properties file and append the following property and value pair:
```
apiId=[your-specific-value]
```

  2. In your <api-gateway:autodiscovery> element, set the `apiID` attribute to the `apiId` property in the config.properties file:
```
apiId=${apiId}
```



## See Also
Set Configuration Properties
Configuring Global EDIFACT Receive Settings | MuleSoft Documentation
# Configuring Global EDIFACT Receive Settings
When EDIFACT messages received from your partners do not contain a UNA segment, Partner Manager uses the delimiters specified in the **Global EDIFACT settings: Receive from partners** window to parse the received EDIFACT payloads. You define these settings in the host organization’s profile:
Setting | Description | Default Value  
---|---|---  
Data element separator | Data element separator character  
Component separator | Component element separator character  
Repetition separator | Repetition separator character  
Segment terminator | Segment terminator character  
Release character | Release character  
## See Also
Configuring and Managing a Host Profile
Configuring a Network Proxy for PDK | MuleSoft Documentation
# Configuring a Network Proxy for PDK
If you use a network proxy to connect to the internet, you might have to define the network proxy for the software tools used by Flex Gateway Policy Development Kit (PDK). Besides Docker, all tools downloaded in PDK prerequisites accept the `HTTP_PROXY` and `HTTPS_PROXY` environment variables.
To configure your environment variable, refer to Configure a Network Proxy.
To use Docker with a network proxy, see Configure a Network Proxy for Docker.
Depending on your network proxy, you might have to define the domains the PDK tools access in your proxy’s allowlist.   
---  
## Configure a Network Proxy
Configure your `HTTP_PROXY` or `HTTPS_PROXY` environment variables by running one of the following commands after replacing the variable values with your information:
  * `HTTP_PROXY`:
```
export HTTP_PROXY=<proxy-method>://<proxy-server>:<proxy-port>
```

  * `HTTPS_PROXY`:
```
export HTTPS_PROXY=<proxy-method>://<proxy-server>:<proxy-port>
```

  * If your network proxy requires authentication, use the following command:
```
export HTTPS_PROXY=<proxy-method>://<username>:<password>@<proxy-server>:<proxy-port>
```



## Configure a Network Proxy for Docker
Integration testing and the debugging environment require Docker.
Docker requires access to the internet to pull Docker images. To configure a network proxy for Docker, refer to the following Docker documentation for your relevant use case:
  *   *   * Docker Desktop on Windows
  *
Coverage | MuleSoft Documentation
# Coverage
Anypoint Code Builder 
Anypoint Studio 
The MUnit Coverage feature provides a measurement of how much of a Mule application has been executed by a set of MUnit tests by counting the amount of event processors executed. This allows you to obtain a quality standard for your application, and provides metrics for:
  * Application overall coverage: An average of the items below.
  * Resource coverage: Refers to each Mule configuration file under src/main/mule.
  * Flow coverage: Refers to any of the following components: Flows, Sub-flows, and Batch jobs.


Coverage report runs only for EE edition runtimes. If your application has a `requiredProduct` of a Mule CE runtime you will see the following message: **Coverage is a EE only feature and you’ve selected to run over CE**. To run against an EE runtime see Specifying the Runtime Product.
The following is a coverage report sample in JSON format. Use the code callouts below to understand each field in the report:
MUnit Coverage - sample JSON report
```
{
 "coverage": 75.0, **(1)**
 "requiredApplicationCoverage": 40.0, **(2)**
 "requiredResourceCoverage": 30.0,  **(2)**
 "requiredFlowCoverage": 25.0,    **(2)**
 "flowCount": 3,       **(3)**
 "processorCount": 4,    **(4)**
 "coveredProcessorCount": 3, **(5)**
 "files": [ {
  "name": "file1.xml", **(6)**
  "flowCount": 1,   **(7)**
  "coverage": 100.0,  **(8)**
  "processorCount": 2, **(9)**
  "weight": 50.0,   **(10)**
  "flows": [ {
   "name": "file1Flow1", **(11)**
   "type": "FLOW",    **(12)**
   "coverage": 100.0,  **(13)**
   "messageProcessorCount": 2, **(14)**
   "coveredProcessorCount": 2, **(15)**
   "lines": [ { **(16)**
    "lineNumber": 11,
    "covered": true
   }, {
    "lineNumber": 12,
    "covered": true
   } ]
  } ]
 }, {
  "name": "file2.xml",
  "flowCount": 2,
  "coverage": 50.0,
  "processorCount": 2,
  "weight": 50.0,
  "flows": [ {
   "name": "file2Flow2",
   "type": "SCOPE",
   "coverage": 100.0,
   "messageProcessorCount": 1,
   "coveredProcessorCount": 1,
   "lines": [ {
    "lineNumber": 10,
    "covered": true
   } ]
  }, {
   "name": "file2Flow1",
   "type": "SCOPE",
   "coverage": 0.0,
   "messageProcessorCount": 1,
   "coveredProcessorCount": 0,
   "lines": [ {
    "lineNumber": 7,
    "covered": false
   } ]
  } ]
 } ]
}
```

Coverage percentage of the whole application.  
---  
Required coverages for application, resources, and flows. If not configured, they default to -1.  
Amount of flows in the application.  
Amount of event processors in the application.  
Amount of covered event processors.  
Name of that file.  
Amount of flows in that file.  
Coverage percentage of that file.  
Amount of event processors in that file.  
Contribution of that file to the coverage percentage of the whole application.  
Name of the flow.  
Type of the top level element. Other type of top level element in coverage is error-handler.  
Coverage percentage of that flow.  
Amount of event processors in that flow.  
Amount of event processors covered in that flow.  
XML line numbers containing event processors in that file, and whether they were covered or not.  
## See Also
  *
Apache Cassandra Connector 4.1 | MuleSoft Documentation
# Apache Cassandra Connector 4.1
Anypoint Connector for Apache Cassandra (Apache Cassandra Connector) creates connectivity between Apache Cassandra databases and third-party applications, systems, services such as SAP, PeopleSoft, or Workday, as well as other databases across the enterprise.
Apache Cassandra is an open source distributed NoSQL database intended to manage large amounts of product, customer, and employee data, which implements the DataStax Java Driver for Apache Cassandra 3.10.1.
## Before You Begin
To use this connector, you must be familiar with:
  * The Apache Cassandra API
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements and global elements in a Mule flow
  * Creating a Mule app using Anypoint Studio (Studio)


Before creating an app, you must have:
  * Credentials to access the Apache Cassandra target resource
  * Anypoint Studio version 4.1.1 or later
  * Mule Enterprise Edition and the entitlements necessary to use this software


## Next
Now that you’ve started, try using Anypoint Studio to configure the Cassandra connector.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * MuleSoft Help Center
uuid | MuleSoft Documentation
# uuid
## uuid(): String
Returns a v4 UUID using random numbers as the source.
### Example
This example generates a random v4 UUID.
#### Source
```
%dw 2.0
output application/json
---
uuid()
```

#### Output
```
"7cc64d24-f2ad-4d43-8893-fa24a0789a99"
```
Filtering Search Results | MuleSoft Documentation
# Filtering Search Results
Cloud IDE 
Desktop IDE 
**Open Beta Release** : The **cloud IDE is in open beta**. Any use of Anypoint Code Builder in its beta state is subject to the applicable beta services terms and conditions, available from the IDE.
When implementing an API, use the advanced search filters to find API specifications in Exchange.
To search for an API using the search filters:
  1. In the activity bar of the IDE, click the (**Anypoint Code Builder**) icon.
  2. From **Quick Actions** , click **Implement an API** :
  3. Select **Show Filters** to display the search filters:
Anypoint Code Builder supports the following filters for your API assets:
     * Tag
Keyword or term that describes a specific search.
     * Type
The list of asset types depends on which types are available in a business group, such as:
       * GraphQL API
A schema definition that contains the object types and definitions used to interact with the API through the GraphQL specification. GraphQL enables you to query an API that supports this language in a much more flexible way than REST.
       * REST APIs
RAML or OAS files that specify APIs referenced by an HTTP Request connector to expose metadata.
     * Category/Industry
Specific groupings of assets set by the administrator of a business group or an organization owner.
     * Organization
Business groups for which you have permission to view their assets.
The search filters display the business group from which to retrieve your API in the **Organization** column:
  4. Click **Add Asset** to add the selected API specification to the Mule application project.
Cryptography Module | MuleSoft Documentation
# Cryptography Module
Cryptography Module provides cryptography capabilities to a Mule application. Its main features include:
  * Symmetric encryption and decryption of messages.
  * Asymmetric encryption and decryption of messages.
  * Message signing and signature validation of signed messages.


The module supports these strategies to encrypt and sign your messages:
  * JCE Provides cryptography capabilities of Java Cryptography Extension.
  * PGP Provides signing and encryption using Pretty Good Privacy.
  * XML Provides signing and encryption of XML documents or elements.


Additionally, the module offers two general operations to calculate and validate stream checksums. For details, refer to Cryptography Module Reference 2.0
## See Also
  * Introduction to Anypoint Connectors
  * Salesforce Help Center
Microsoft Power BI Connector 1.0 | MuleSoft Documentation
# Microsoft Power BI Connector 1.0
Anypoint Connector for Microsoft Power BI (Power BI Connector) synchronizes data and automates business processes between Power BI and third-party applications, either on premises or in the cloud. Power BI is a suite of analytics tools designed to visualize data from various systems and garner insights.
For compatibility information and fixed issues, see the Microsoft Power BI Connector Release Notes.
## Before You Begin
To use this connector, you must be familiar with:
  * The Microsoft Power BI APIs
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements and global elements in a Mule flow
  * Creating a Mule app using Anypoint Studio (Studio)


Before creating an app, you must have:
  * Credentials to access the target resource
  * Anypoint Studio version 7.3.5 or later


## Common Use Cases for the Connector
Common use cases for Power BI Connector include the ability to automate business processes by integrating Power BI with other IT tools and systems in your organization, including:
  * Optimizing sales operations by analyzing your sales data (opportunities, leads, and so on) by feeding data from your CRM system to Power BI, and then using Power BI to visualize patterns and identify trends.
  * Getting a complete view of your customer by feeding data streams from all customer data stores (CRM, support, marketing, and so on) to Power BI and using Power BI to see a customer-centric view.
  * Increasing customer satisfaction and reducing attrition risk by notifying the relevant customer account team (using Slack, email, or another messaging system) when customer satisfaction drops below the threshold defined in Power BI.


## Authentication Types
Microsoft Power BI Connector uses the OAuth 2.0 authorization code grant connection type used in apps that are installed on a device to gain access to protected resources.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * Power BI Connector Reference
  * MuleSoft Help Center
tomorrow | MuleSoft Documentation
# tomorrow
## tomorrow(): Date
Returns the date for tomorrow as a `Date` type.
_Introduced in DataWeave version 2.4.0._
### Example
This example shows the output of `tomorrow` function.
#### Source
```
%dw 2.0
import tomorrow from dw::core::Dates
output application/json
---
tomorrow()
```

#### Output
Patching the Embedded Mule Runtime Engine Version | MuleSoft Documentation
# Patching the Embedded Mule Runtime Engine Version
Anypoint Code Builder 
Anypoint Studio 
Patching in MUnit is different from patching in Mule runtime engine. MUnit runs using an embedded Mule container, which downloads all required dependencies to start Mule based on a given version. To use a patched Mule version (for example, `4.3.0-20200727`), you must point MUnit to run specifically against it. You can do this from either Maven or Anypoint Studio.
## Patch MUnit Using Maven
By default, MUnit runs against the Mule version corresponding to the `minMuleVersion` defined in the `mule-artifact.json` file. You can override this version by using the `runtimeVersion` attribute of the `munit-maven-plugin` artifact configuration:
```
<plugin>
  <groupId>com.mulesoft.munit.tools</groupId>
  <artifactId>munit-maven-plugin</artifactId>
  <version>${munit.version}</version>
  <executions>
    <execution>
      <id>test</id>
      <phase>test</phase>
      <goals>
        <goal>test</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
   <runtimeVersion>4.3.0-20200727</runtimeVersion> **(1)**
  </configuration>
</plugin>
```

Be sure to replace the placeholder version in this example with your version, as provided by MuleSoft.  
---  
## Patch MUnit Using Studio
By default, MUnit runs in Anypoint Studio with the Mule runtime engine version of the project server. You can override this version by specifying the patched Mule version in the MUnit run configuration menu:
  1. In the menu bar, select **Run** and **Run Configurations**.
  2. Under **MUnit** , select your MUnit test file.
  3. In the **Mule Runtime Version** field under **Advanced Settings** , type the Mule patched version to use.


If you already set the `runtimeVersion` attribute in the POM file of your project, click **Load configuration from POM file** to automatically load this version into the **Mule Runtime Version** field.
## See Also
  * Mule Runtime Release Notes
  *
Configuring User Analytics | MuleSoft Documentation
# Configuring User Analytics
Use Google Analytics to gain valuable insights into how consumers are using your APIs and portal, identify areas for improvement, make data-driven decisions to optimize the user experience, and drive business success.
Google Analytics tracks the following data:
  * API usage metrics:
    * API instance access requests
    * API specification downloads
    * Most viewed API
    * Total number of calls made to an API
  * User engagement metrics:
    * Active users
    * Login events
  * API Console usage:
    * API requests
Measure the overall API usage and identity patterns in API consumption. Captures each time an API request is made through the API Console and the total number of API requests made.
    * API usage by endpoint
Identities popular endpoints and monitors usage trends to optimize API design and resource allocation. Captures each time an API request is made to a specific endpoint through the API console and the number of requests made to each API endpoint.


## Configure Google Analytics
To configure Google Analytics to send events from the portal:
  1. Set up a Google Analytics property using the instructions in the Set up the Analytics Google tag topic from the Google documentation.
  2. Navigate to the Builder.
  3. Click **Settings** > **Security & Privacy**.
  4. In the **Content Security Policy (CSP)** section, select **Relaxed CSP: Permit Access to Inline Scripts and Allowed Hosts**.
  5. From **Settings** , click **Advanced**.
  6. In the **Advanced** page, enter your Google Analytics Tracking ID.
  7. Select **Let Google Analytics access your Salesforce data for deeper insights into search activity**.
  8. Click **Edit Head Markup**.
  9. Add the following code and replace all instances of `G-TRACK_ID` with your Google Analytics Tracking ID:
```
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TRACK_ID"></script>
<script>
 window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments);}
 gtag('js', new Date());
 gtag('config', 'G-TRACK_ID');
 document.addEventListener('analyticsCustomEvent', function(e) {
   let detail = JSON.parse(JSON.stringify(e.detail));
   gtag('event', detail.eventName, detail.dimensions);
 });
</script>
```

  10. From **Setup** , click **Security & Privacy**.
  11. Confirm that the following URLs show in the **Trusted Sites for Scripts** section:
     * https://www.google-analytics.com
     * https://www.googletagmanager.com
  12. If the URLs are missing, add them by clicking **Add Trusted Site**.
  13. From **Setup** , click **Security** > **Trusted URLs**.
  14. Confirm that the same two URLs are in the list of the **Trusted URLs** section.
API Experience Hub can now start sending Google Analytics from the portal.
Adding Reviewers | MuleSoft Documentation
# Adding Reviewers
Add one or more reviewers to a document action to verify and correct the documents queued for review due to low confidence score values or missing required fields. You can add single Anypoint Platform users or teams as reviewers.
Add reviewers to a new document action while creating it or an existing document action by editing it.
## Before You Begin
Ensure you have any of the following Anypoint permissions: 

Manage Actions
    
Gives a user complete access to IDP and assigns reviewer permission by default for every document action. 

Build Actions
    
Enables a user to create, edit, publish, and execute document actions and assign reviewers to the actions.
## Add Reviewers to a New Document Action
To create a new document action and add reviewers:
  1. In the sidebar, click **Document Actions**.
  2. Click **Create New**.
  3. Select the type of document to use as a template, specify a name for your document action, and click **Create**.
  4. In the **Reviewers** panel, click **Edit**.
  5. Search for a user or team and click **Add**.
Repeat this step until you finish adding reviewers.
  6. Click **Apply**.


## Add Reviewers to an Existing Document Action
To edit an existing document action and add reviewers:
  1. In the navigation panel, click **Document Actions**.
  2. Click a document action to open its view page.
  3. In the **Reviewers** panel, click **Edit**.
  4. Search for a user or team and click **Add**.
Repeat this step until you finish adding reviewers.
  5. Click **Apply**.


## See Also
  * Publishing Document Actions
  * Analyzing Documents Using Pre-Built Schemas
  * Reviewing Processed Documents
Setting Up Monitoring for Runtime Fabric Deployments | MuleSoft Documentation
# Setting Up Monitoring for Runtime Fabric Deployments
Monitoring for applications deployed to Runtime Fabric is enabled by default.
## Supported Versions of Mule Runtime Engine
Run your Mule app on a supported Mule runtime version. For supported versions, see Mule Runtime Release Notes.
## Runtime Fabric Setup
Follow the instructions for Setting Up Runtime Fabric. After you install Runtime Fabric, applications that are running and deployed to Runtime Fabric appear in Monitoring.
### See Also
Monitoring Applications Deployed to Runtime Fabric.
Publishing Flex Gateway APIs | MuleSoft Documentation
# Publishing Flex Gateway APIs
Publishing an API consists of defining a client service and routing that service to a backend location. Flex Gateway enables you to publish APIs via Anypoint Platform (Connected Mode) or declarative configuration files (Local Mode).
To publish an API in Connected Mode, see Publishing Managed Gateway and Connected Mode APIs.
To publish an API in Local Mode, see Publishing Local Mode APIs.
## See Also
  * Flex Gateway Overview
  * Getting Started with Self-Managed Flex Gateway
Step 6. Operate the Deployed API | MuleSoft Documentation
# Step 6. Operate the Deployed API
MuleSoft provides tools to help you manage your deployed APIs.
To check the health of your API:
  1. From your Anypoint Platform organization, navigate to Runtime Manager.
  2. Select the Sandbox environment. If the Design environment is automatically displayed, switch to the Sandbox environment:
    1. Click the **Design** environment button.
    2. Click **Sandbox** , and then click the **Switch** button.
  3. Click the link for your deployed API proxy.


If you’ve sent a few test requests to the proxy, you can see the traffic in the form of Mule messages in the interface.
Other information you can obtain from Runtime Manager:
  * Click **Logs** to review every transaction for the selected app for the last 30 days (up to 100 MB).
  * Click **Settings** to review the settings for this app.
  * Click **Insight** to enable Anypoint Monitoring and Anypoint Visualizer.


## Developer Deep Dive
The more work your API does, the more data Runtime Manager can provide. To learn more, visit the Runtime Manager documentation.
Set Mail | MuleSoft Documentation
# Set Mail
With the _Set Mail_ action step, you can change the status of an e-mail. That is, you can mark it either as read or unread and/or move it to a different folder.
You can only use the Set Mail action step within the Read Mail Action Step. You enter the information required for the connection to the mail server in the Mail Session.
## Properties
**Change Read/ Unread Status** The e-mail is marked as either read or unread.
**Create folder if it does not exist** If the checkbox is selected, and no folder exists, then a folder is created.
**Move mail to folder** If the checkbox is selected, the e-mail is moved to a different folder.
**Read mail status** Indicates whether the e-mail is marked as read or unread.
**Target folder** Name of the target folder.
## Inbound Variables
**Mail Info** Is made available only by the Read Mail action step. This can be used to uniquely identify an e-mail.
**Target folder** Name of the target folder.
## Outbound Variables
**IsSucceeded** Indicates whether the action was carried out successfully.
## Wizard
See Properties.
Empty Login Page | MuleSoft Documentation
# Empty Login Page
If you cannot see the fields in the login component, run the diagnostics tool for the guest user in that Salesforce digital experience site.
Managing API Instance Versions | MuleSoft Documentation
# Managing API Instance Versions
After you publish new version details for an API definition to Exchange, you must update the **Asset version** of your deployed API instances in API Manager to reflect the changes.
The API Asset version can only be upgraded or downgraded within the same major version (minor and patch versions). If you need to upgrade to a different major version, you must create a new API Instance.
For more information about versions in Exchange, see Asset Versions.
To change the asset version of an API instance:
  1. Navigate to **Anypoint Platform** > **API Manager**.
  2. In **API Administration** , click the name of the API instance for which you want to change the version.
  3. Select **Actions** > **Change API specification**.
  4. In **Asset version** , select your desired version.
  5. Click **Change**.


## See Also
  *   * Granting Permission to Access an environment
  * Anypoint Exchange documentation
  * Create an Asset in Exchange
  * Delete an Asset in Exchange (also describes deprecating an asset)
  * About Exchange Portals
maxBy | MuleSoft Documentation
# maxBy
## maxBy<T>(@StreamCapable array: Array<T>, criteria: (item: T) -> Comparable): T | Null
Iterates over an array and returns the highest value of `Comparable` elements from it.
The items must be of the same type. `maxBy` throws an error if they are not, and the function returns `null` if the array is empty.
### Parameters
Name | Description  
---|---  
The input array.  
Expression for selecting an item from the array, where the item is a `Number`, `Boolean`, `DateTime`, `LocalDateTime`, `Date`, `LocalTime`, `Time`, or `TimeZone` data type. Can be referenced with `$`.  
### Example
This example returns the greatest numeric value within objects (key-value pairs) in an array. Notice that it uses `item.a` to select the value of the object. You can also write the same expression like this, using an anonymous parameter: `[ { "a" : 1 }, { "a" : 3 }, { "a" : 2 } ] maxBy $.a`
#### Source
```
%dw 2.0
output application/json
---
[ { "a" : 1 }, { "a" : 3 }, { "a" : 2 } ] maxBy ((item) -> item.a)
```

#### Output
### Example
This example gets the latest `DateTime`, `Date`, and `Time` from inputs defined in the variables `myDateTime1` and `myDateTime2`. It also shows that the function returns null on an empty array.
#### Source
```
%dw 2.0
var myDateTime1 = "2017-10-01T22:57:59-03:00"
var myDateTime2 = "2018-10-01T23:57:59-03:00"
output application/json
---
{
 myMaxBy: {
  byDateTime: [ myDateTime1, myDateTime2 ] maxBy ((item) -> item),
  byDate: [ myDateTime1 as Date, myDateTime2 as Date ] maxBy ((item) -> item),
  byTime: [ myDateTime1 as Time, myDateTime2 as Time ] maxBy ((item) -> item),
  emptyArray: [] maxBy ((item) -> item)
 }
}
```

#### Output
```
{
 "myMaxBy": {
  "byDateTime": "2018-10-01T23:57:59-03:00",
  "byDate": "2018-10-01",
  "byTime": "23:57:59-03:00",
  "emptyArray": null
 }
}
```
Flex Gateway Agent Policies | MuleSoft Documentation
# Flex Gateway Agent Policies
Policies enforce rules when Flex Gateway processes requests, enabling you to secure and govern your server instances. Flex Gateway includes A2A and MCP specific policies that provide enhanced security and control over agent interactions.
To apply a policy, see Applying Policies for Managed Flex Gateways and Connected Mode.
Flex Gateway MCP and A2A server instances also support other Flex Gateway policies to protect server instances through rate limiting, authentication, authorization, threat protection, monitoring, and logging. For more information about MuleSoft-provided policies, see the Inbound Policies Directory and Outbound Policies Directory.
To extend existing functionality or define new functionality, create custom policies based on your specific business requirements. For information about creating custom policies, see Flex Gateway Policy Development Kit (PDK) Overview.
All agent policies are inbound policies and are not supported as automated policies.   
---  
## SSE Policies
Both A2A and MCP support the following policies for Server-Sent Events (SSE) streaming:
Policy | Summary  
---|---  
Logs every SSE event while streaming  
## A2A Policies
Policy | Summary  
---|---  
| Rewrites the Agent Card URL to match the server instance public URL  
| Detects personally identifiable information (PII) in requests sent to the agent  
| Decorates prompts with context information  
| Validates agent requests to ensure they conform to the A2A specification  
## MCP Policies
Policy | Summary  
---|---  
MCP Attribute-Based Access Control | Controls access to tools, resources, and prompts based on user information such as Tiers, IP, Headers, or Claims  
| Validates MCP requests to ensure they conform to the MCP specification  
Adds MCP support to a Flex Gateway MCP server instance. This policy is required for your MCP server instance to function properly.  
## See Also
  *   * DataWeave Support in Flex Gateway Policies
Performing an HTTP Call | MuleSoft Documentation
# Performing an HTTP Call
To view an example policy project that makes HTTP calls, see Simple OAuth 2.0 Validation Policy Example.   
---  
To interact with external services, a policy can use HTTP calls. You can only make HTTP calls from the request filter or the response filter.
## Define the HTTP Service
Define your service as a parameter in your schema definition to make HTTP requests. To learn more about defining parameters, see Defining a Policy Schema Definition
The following code snippet provides an example schema definition for an external service:
```
properties:
   externalService:
     type: string
     format: service
   endpointPath:
     type: string
```

In the policy’s Rust source code, you can access the defined external service in the `Config` struct. To perform requests, call the HTTP client in your policy, for example:
```
let response = client
  .request(&config.external_service)
  .path(&config.endpoint_path)
  .headers(vec![("Content-Type", "application/json")])
  .body(r#"{"key": "value"}"#.as_bytes())
  .put().await?;
```

## Inject the HTTP Client Parameters to Enable Requests
To perform an HTTP call, either inject the `HTTPClient` into the `[entrypoint]` function or the wrapper functions:
  * To enable requests in the request and response filters, inject the client parameter into the `#[entrypoint]` function:
```
#[entrypoint]
async fn configure(launcher: Launcher, Configuration(bytes): Configuration, client: HttpClient) -> Result<()> {
  let config: Config = serde_json::from_slice(&bytes).unwrap();
  // Both request and the response handlers will use the client
  let filter = on_request(|request_state| request_filter(request_state, &config, &client))
    .on_response(|response_state, request_data| {
      response_filter(response_state, request_data, &config, &client)
    });
  launcher.launch(filter).await?;
  Ok(())
}
```

  * To enable requests only in the request or the response, inject the client parameters either in the `on_request` or `on_response` wrapper functions:
```
// Handler with the logic for incoming requests
​​async fn request_filter(state: RequestState, conf: &Config, client: HttpClient) {
 ...
}
#[entrypoint]
async fn configure(launcher: Launcher, Configuration(bytes): Configuration) -> Result<()> {
  let config: Config = serde_json::from_slice(&bytes).unwrap();
  // For incoming request events, using the on_request wrapper, inject the client and pass it to the request_filter handler
  launcher
    .launch(on_request(|request, client| {
      request_filter(request, &config, client)
    }))
    .await?;
  Ok(())
}
```



## See Also
  * Implementing Your Custom Policy Features in Rust
IBM MQ Connector Examples | MuleSoft Documentation
# IBM MQ Connector Examples
To fully benefit from using Anypoint Connector for IBM MQ (IBM MQ Connector), see the following examples of configuring the connector operations:
  * Manage Message Acknowledgments Configure IBM MQ Connector to manage different acknowledgment configurations, such as automatic acknowledgment on success, immediate acknowledgment, and manual acknowledgment.
  * Listen for New Messages Configure the **Listener** source with the JMS Connector to consume messages as they arrive at the destination.
  * Publish New Messages Configure the **Publish** operation to create a new JMS message and send it to the specified destination.
  * Consume Messages Configure the **Consume** operation to consume a message at any given time in the flow, from any given destination.
  * Publish Messages and Listen for Replies Configure the **Publish consume** operation to publish a message to any exchange, and then wait for a reply on a different destination.
  * Manage Transactions Configure IBM MQ Connector to manage transactional connections to execute a series of operations.
  * Configure Topic Subscription Configure topic subscriptions in IBM MQ Connector to control how subscriptions behave regarding the connection of the consumers and also how these consumers interact with each other.


## See Also
  * Introduction to Anypoint Connectors
  * MuleSoft Help Center
Configure Organization Settings | MuleSoft Documentation
# Configure Organization Settings
This topic is affected by the Anypoint Platform integration.
If you use an Anypoint account to login to RPA Manager, refer to the **Settings** documentation.
If you use an RPA account to login to RPA Manager, the **Settings** view enables you to configure the currency and decimal sign to show in RPA Manager modules and configure your Anypoint Platform credentials, which enables you to publish a process automation to Anypoint Exchange.
## Before You Begin
  * Ask an administrator to assign you the required privileges:
Action | Privilege  
---|---  
View configured settings for your organization. | Organization Management Open  
Add or modify settings for your organization. | Organization Management Administration  


## Configure Currency and Decimal Sign
To configure the currency and decimal sign to show in RPA Manager modules:
  1. In the **Organization Management** module, click **Settings**.
  2. Ensure you are in the **General** tab.
  3. Configure the following values:
     * **Currency**
The currency symbol RPA Manager shows in modules and dashboards.
     * **Decimal Sign**
The decimal sign RPA Manager uses to show fractional numbers in modules and dashboards.
  4. Click **Save**


## Configure Anypoint Platform Credentials
Before you can connect with your Anypoint Platform account, ensure that you have configured a Connected App in Access Management to enable the RPA Connection. See Configure a Connected App in Access Management for instructions on creating a Connected App.
To connect RPA Manager with your Anypoint Platform account:
  1. In the **Organization Management** module, click **Settings**.
  2. Select the **Anypoint** tab.
  3. Click **Configure Settings** and provide the following values:
     * **Client Id**
The Client Id of the Connected App in Access Management.
     * **Client Secret**
The Client Secret of the Connected App in Access Management.
     * **Domain**
The URL of your Anypoint Platform instance you connect to.
  4. Click **Next**.
  5. Select the **Anypoint Organization** to connect to.
  6. Click **Finish**.


## See Also
  * Publish a Process Automation to Anypoint Exchange
Connected Apps for End Users | MuleSoft Documentation
# Connected Apps for End Users
Delegate API access and sign in to third-party applications using your Anypoint Platform credentials. You can also view connected apps created in your root organization or business groups.
The organization administrator must set up and integrate the connected app before you can grant access to it. See Connected Apps for Developers.   
---  
To grant access to a connected app:
  1. In the **Authorize App** dialog, click **Grant Access**.
You can see which organization is requesting access to data and how the data is used. After you click **Grant Access** , the app is authorized to access the data indicated in the **Authorize App** dialog.


## Managing Third-party Apps
You can manage authorized third-party apps in your profile settings:
  1. Click your profile icon and select **Profile**.


The **Application Name** column lists the name of the app the user is sharing data with.
The **Scopes** column lists the token granted to the app and the permissions the connected app has.
If an organization administrator blocks an app, you can’t authorize the app to access your information.
Because most applications are developed by third parties, MuleSoft is not liable for how an app uses the data it’s requesting access to. You can navigate to the developer information link and contact the application’s admin if you have questions or concerns about the application.
outerJoin | MuleSoft Documentation
# outerJoin
## outerJoin<L <: Object, R <: Object>(left: Array<L>, right: Array<R>, leftCriteria: (leftValue: L) -> String, rightCriteria: (rightValue: R) -> String): Array<{ l?: L, r?: R }>
Joins two array of objects by a given `ID` criteria.
`outerJoin` returns an array with all the `left` items, merged by ID with the `right` items in cases where any exist, and it returns `right` items that are not present in the `left`.
_Introduced in DataWeave version 2.2.0._
### Parameters
Name | Description  
---|---  
The left-side array of objects.  
The right-side array of objects.  
`leftCriteria` | The criteria used to extract the ID for the left collection.  
`rightCriteria` | The criteria used to extract the ID for the right collection.  
### Example
This example shows how join behaves. Notice that the output includes objects where the values of the input `user.id` and `product.ownerId` match, and it includes objects where there is no match for the value of the `user.id` or `product.ownerId`.
#### Source
```
%dw 2.0
import * from dw::core::Arrays
var users = [{id: "1", name:"Mariano"},{id: "2", name:"Leandro"},{id: "3", name:"Julian"},{id: "5", name:"Julian"}]
var products = [{ownerId: "1", name:"DataWeave"},{ownerId: "1", name:"BAT"}, {ownerId: "3", name:"DataSense"}, {ownerId: "4", name:"SmartConnectors"}]
output application/json
---
outerJoin(users, products, (user) -> user.id, (product) -> product.ownerId)
```

#### Output
```
[
 {
  "l": {
   "id": "1",
   "name": "Mariano"
  },
  "r": {
   "ownerId": "1",
   "name": "DataWeave"
  }
 },
 {
  "l": {
   "id": "1",
   "name": "Mariano"
  },
  "r": {
   "ownerId": "1",
   "name": "BAT"
  }
 },
 {
  "l": {
   "id": "2",
   "name": "Leandro"
  }
 },
 {
  "l": {
   "id": "3",
   "name": "Julian"
  },
  "r": {
   "ownerId": "3",
   "name": "DataSense"
  }
 },
 {
  "l": {
   "id": "5",
   "name": "Julian"
  }
 },
 {
  "r": {
   "ownerId": "4",
   "name": "SmartConnectors"
  }
 }
]
```
generateBoundary | MuleSoft Documentation
# generateBoundary
## generateBoundary(len: Number = 70): String
Helper function for generating boundaries in `Multipart` data structures.
Security | MuleSoft Documentation
# Security
The module **must** follow all standard security best practices.
In particular, the following **should** be given special consideration:
  * Protect against XXE attacks
  * Always sanitize information from untrusted sources
  * When reading files from the local file system, make sure not to access secrets of the host environment nor enable path traversal
  * When possible, use CSRF tokens
  * When executing queries to a database, make correct use of PreparedStatement class to avoid SQL injection attacks.


## See Also
  * MuleSoft Help Center
  * Mule SDK Development Best Practices
Deprecate API Group Instances | MuleSoft Documentation
# Deprecate API Group Instances
You might want to deprecate an API Group instance if a more recent version of the group instance exists. Deprecating an API Group instance from API Manager does not deprecate the API Group asset in Exchange.
After an API Group instance is deprecated, no new contracts are accepted. To deprecate an asset in Exchange, see To deprecate asset.
## Task Prerequisites
Before you begin, ensure that you have the API Group Administrator permissions to be able to deprecate an API Groups instance.
To deprecate an API Group:
  1. Navigate to **Anypoint Platform** > **API Manager**.
  2. Click **API Groups**.
  3. Select the version of the API Group that you want to deprecate.
  4. Click **…​** > **Deprecate**.


## See Also
  *   *   * Publish API Groups to Exchange
  *
parseURI | MuleSoft Documentation
# parseURI
## parseURI(uri: String): URI
Parses a URL and returns a `URI` object.
The `isValid: Boolean` property in the output `URI` object indicates whether the parsing process succeeded. Every field in this object is optional, and a field will appear in the output only if it was present in the URL input.
### Parameters
Name | Description  
---|---  
The URI input.  
### Example
This example parses a URL.
#### Source
```
%dw 2.0
import * from dw::core::URL
output application/json
---
{
 'composition': parseURI('https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#footer')
}
```

#### Output
```
{
 "composition": {
  "isValid": true,
  "raw": "https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#footer",
  "host": "en.wikipedia.org",
  "authority": "en.wikipedia.org",
  "fragment": "footer",
  "path": "/wiki/Uniform_Resource_Identifier",
  "scheme": "https",
  "isAbsolute": true,
  "isOpaque": false
 }
}
```
User Management Overview | MuleSoft Documentation
# User Management Overview
This topic is affected by the Anypoint Platform integration.
If you use an Anypoint account to login to RPA Manager, refer to the Anypoint Access Management documentation.
In the **User Management** module, you manage the users of RPA Manager and RPA Builder:
  * Create and delete users.
  * Edit a user’s personal data.
  * Assign privileges or roles to a user that enable a user to work in specific modules.
  * Create roles to combine privileges.
  * License users for RPA Builder access.
  * Mark a user as project manager.
  * Assemble teams for task sharing.
  * Mark teams as centers of excellence.
  * Create user API keys to configure an API connector in MuleSoft Composer.
Credential Injection Basic Authentication Policy | MuleSoft Documentation
# Credential Injection Basic Authentication Policy
**Policy Name** | Credential Injection Basic Authentication  
---|---  
Injects a basic authorization header into outgoing requests  
Security  
**First Flex Gateway version available**  
**Returned Status Codes** | No return codes exist for this policy. Error codes are returned from the upstream service.  
## Summary
The Credential Injection Basic Authentication policy injects an `Authorization` header containing a username and password into outbound requests. The policy ensures that requests sent from Flex Gateway to an upstream service include the correct authentication headers. The Authorization header format is `Authorization: Basic <username:password>`.
The policy follows Basic HTTP authentication standards.
When an error occurs, the policy returns a `WWW-Authenticate` HTTP header field.
## Configuring Policy Parameters
### Flex Gateway Local Mode
In Local Mode, you apply the policy to your API via declarative configuration files. Refer to the following policy definition and table of parameters:
```
- policyRef:
  name: credential-injection-basic-auth-flex
 config:
  username: <string> // OPTIONAL
  password: <string> // OPTIONAL
  overwrite: <boolean> // OPTIONAL
  customHeader: <string> // OPTIONAL
```

Parameter | Required or Optional | Default Value | Description  
---|---|---|---  
The username for the basic authentication credentials.  
The password for the basic authentication credentials.  
When enabled, if the `Authorization` header is present, the policy overwrites it with the configured credentials.  
`customHeader` |  When configured, a custom header is injected instead of the `Authorization` header. If **Overwrite header** is enabled, the policy overwrites the custom header if present instead of the `Authorization` header.  
#### Resource Configuration Example
```
- policyRef:
  name: http-basic-authentication-flex
 config:
  username: chris
  password: admin
```

### Managed Flex Gateway and Flex Gateway Connected Mode
When you apply the policy to your API instance from the UI, the following parameters are displayed:
Parameter | Description | Required?  
---|---|---  
Username | The username for the basic authentication credentials. | Optional  
Password | The password for the basic authentication credentials. | Optional  
Overwrite header | When enabled, if the `Authorization` header is present, the policy overwrites it with the configured credentials. | Optional  
Custom Header | When configured, a custom header is injected instead of the `Authorization` header. If **Overwrite header** is enabled, the policy overwrites the custom header if present instead of the `Authorization` header. | Optional