Skip to content

Instantly share code, notes, and snippets.

View alexandramartinez's full-sized avatar
🐱
Fighting w/my cat

Alex Martinez alexandramartinez

🐱
Fighting w/my cat
View GitHub Profile
%dw 2.0
output application/json
---
payload map {
id: $.id as String,
title: $.title,
description: $.description,
dueDate: $.dueDate,
completed: $.completed
}
%dw 2.0
output application/java
var completed = attributes.queryParams.completed
var dueDate = attributes.queryParams.dueDate
var whereClause = if (isEmpty(completed) and isEmpty(dueDate)) "" else "WHERE " ++ (
[
("completed = $completed") if (!isEmpty(completed)),
("dueDate = $dueDate") if (!isEmpty(dueDate))
] joinBy " AND "
)
<sub-flow name="get-all-tasks-subflow">
<logger doc:name="Logger" doc:id="ndehql" message="Start - Get all tasks - HELLOOOOO" />
<ee:transform doc:name="create sql query" doc:id="fkcolw">
<ee:message>
<ee:set-payload doc:name="Set payload" doc:id="xhyrro" resource="dw/get-all-tasks-request.dwl" />
</ee:message>
</ee:transform>
<db:select doc:name="Select" doc:id="pigbzt" config-ref="Mysql_Database_Config">
<db:sql>
<![CDATA[#[payload]]]>
CREATE TABLE tasks(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
description VARCHAR(255),
dueDate VARCHAR(255),
completed BOOLEAN NOT NULL
);
version: '3'
services:
db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: mysqldb
MYSQL_USER: user
MYSQL_PASSWORD: password
ports:
openapi: 3.0.0
info:
version: 1.0.0
title: To-Do Task Management API
description: A simple API for managing to-do tasks. Supports full CRUD operations for tasks in a single-user context.
paths:
/tasks:
get:
summary: List all tasks
description: Retrieve a list of all tasks, with optional filtering by completion status and due date.
openapi: 3.0.0
info:
version: 1.0.0
title: Hotel Reservations API
description: API to manage hotel room bookings, check availability, and apply loyalty benefits.
x-sfdc:
agent:
topic:
name: Hotel_Room_Reservation
classificationDescription: This API allows agents to book, modify, and cancel hotel reservations, as well as apply loyalty upgrades.
@alexandramartinez
alexandramartinez / mulesoft-best-practices.mdc
Last active September 10, 2025 16:25
Use this Cursor Rules file for your MuleSoft project.
# MuleSoft Best Practices
The following rules apply for MuleSoft projects:
- All the global element configurations have to go inside a `global.xml` file unless a different name is provided for this file.
- Properties like `host` and `port` should not be hardcoded in the XML files. These values should be referenced from (a) properties file(s).
- Whenever a Mule Runtime version is added to the `pom.xml` file, this version has to match the version from the `mule-artifact.json` file (located at the root directory).
- Always make sure the properties files added to the project are being correctly configured with a Configuration Properties global element.
- When adding dependencies to the `pom.xml`, ensure the version is compatible with the Mule Runtime version specified in `mule-artifact.json` file (located at the root directory) AND is compatible with the Java version specified in the same file.
- Always verify connector compatibility by checking the official MuleSoft documentation at https://docs.mulesoft.com/r
<flow name="post:\chat:application\json:mac-ollama-api-config">
<logger doc:name="Logger" doc:id="ezzhif" message="#[payload]" />
<ms-aichain:chat-answer-prompt config-ref="MAC_Config" doc:id="mmoptd" doc:name="Chat answer prompt"></ms-aichain:chat-answer-prompt>
<ee:transform doc:name="Transform" doc:id="czdqgi">
<ee:message>
<ee:set-payload>
<![CDATA[output application/json
---
payload.response]]>
</ee:set-payload>
<ms-aichain:config configType="Configuration Json" filePath='#[mule.home ++ "/apps/" ++ app.name ++ "/llm-config.json"]' llmType="OLLAMA" modelName="llama3" name="MAC_Config"></ms-aichain:config>