Draft: Dsl platform improvements
Before assigning a reviewer go through the following checklist, and make sure to test your changes manually (if possible).
- Make sure to read the CONTRIBUTING.md for best practices and guidelines.
-
Make sure to put the merge request on
draft:if it's not ready. -
If this merge requests closes an issue, make sure the merge request description contains, closes #the-issue-number. -
If this merge request only relates to an issue, refer to the issue with refs #the-issue-number. - If there is no related issue, consider adding a description and add labels accordingly.
-
If this is a bug fix, consider adding regression tests. -
If this is blocked by another merge request, make sure to make itdepend.
array.range:
Creates an array with a specified size.
Useful for repeating something N times, or creating N items efficiently without funny business (e.g. recursive/self-triggering actions)
Examples:
- static: 5
- array.range: { root } # accepts a range from a remapper
# [0, 1, 2, 3, 4]
array.range: 3 # or a numeric literal as a range
# [0, 1, 2]
focus:
Changes the root in the context of remappers inside its do property.
Example:
# Get all customers, and for each customer, find the orders belonging to that customer.
# Assumes that `history: 0` is an array of all customers,
# and `history: 1` is an array of all orders.
- history: 0
- array.map:
focus:
on:
object.from:
currentCustomer:
array: item
allOrders:
history: 1
do:
object.from:
id:
prop: id
name:
prop: name
associatedOrders:
- root: null
- prop: allOrders
-
array.filter:
equals:
- prop: customerId
-
- root: null
- prop: currentCustomer
- prop: id
date.startOf / date.endOf:
Returns the start or end of a specified time unit for a given date. Operates in UTC.
Supported units:
- year - First/last moment of the year
- quarter - First/last moment of the quarter
- month - First/last moment of the month
- week - First/last moment of the week (Monday start)
- weekSun - First/last moment of the week (Sunday start)
Examples:
# Start of month
- static: "2025-11-21T12:00:00.000Z"
- date.startOf: month
# "2025-11-01T00:00:00.000Z"
# End of quarter
- static: "2025-11-21T12:00:00.000Z"
- date.endOf: quarter
# "2025-12-31T23:59:59.999Z"
# Start of week (Monday)
- static: "2025-11-21T12:00:00.000Z"
- date.startOf: week
# "2025-11-17T00:00:00.000Z"
Edited by Nikolay Gruychev