- Introduced a new contract for script returns, requiring an object with `output`, `context`, and `skipRemaining` fields. - Refactored existing scripts to align with the new return structure, ensuring compatibility with the updated context management. - Added utility functions for normalizing context and step results, improving the handling of script execution context. - Updated various scripts (e.g., fetch-binary, fetch-html, fetch-http) to return structured output and context, enhancing data flow and usability. - Improved error handling for script returns, ensuring clearer feedback when invalid structures are returned. This update significantly enhances the flexibility and clarity of script interactions within workflows.
38 lines
922 B
YAML
38 lines
922 B
YAML
name: time and comic to ntfy
|
|
description: >
|
|
Fan-in from two scripts (current time + monkeyuser comic), then send to ntfy.
|
|
scripts:
|
|
- id: time
|
|
script: get-current-time.js
|
|
|
|
- id: comic
|
|
script: fetch-html.js
|
|
config:
|
|
url: "https://www.monkeyuser.com/"
|
|
outputVar: "httpResponse"
|
|
selector: ".comic img"
|
|
jsonata: |
|
|
{"url": "https://www.monkeyuser.com" & [attributes.src][0], "title": [attributes.title][0]}
|
|
|
|
- id: compose
|
|
script: jsonata.js
|
|
needs: [time, comic]
|
|
config:
|
|
expression: |
|
|
{
|
|
"title": data.comic.httpResponse.title,
|
|
"message": data.time.datetime & " " & data.comic.httpResponse.title,
|
|
"attach": data.comic.httpResponse.url
|
|
}
|
|
|
|
- id: notify
|
|
script: ntfy.js
|
|
needs: [compose]
|
|
config:
|
|
url: https://ntfy.sh/jerapah-flow
|
|
|
|
triggers:
|
|
- type: HTTP
|
|
method: POST
|
|
path: /time-and-comic
|