-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Rendex: add Markdown rendering, content extraction, render links, and Watch suite #21270
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
Open
Dan425953
wants to merge
4
commits into
PipedreamHQ:master
Choose a base branch
from
Dan425953:feat/rendex-watch-markdown-extract
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5555d15
feat(rendex): add Markdown rendering, content extraction, hosted rend…
Dan425953 2b6bc2d
fix(rendex): add action annotations, bump render-to-image, paginate w…
Dan425953 cd5bd4e
feat(rendex): expand capture params, watch render knobs, and add acco…
Dan425953 df82ab6
fix(rendex): address review — validate cookie objects, preserve clear…
Dan425953 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
components/rendex/actions/create-render-link/create-render-link.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import rendex from "../../rendex.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "rendex-create-render-link", | ||
| name: "Create Render Link", | ||
| description: "Mint a signed, hosted render URL for a page or HTML — ideal for `og:image` tags. The returned URL serves the rendered image/PDF directly. [See the documentation](https://rendex.dev/docs/api-reference).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| rendex, | ||
| url: { | ||
| type: "string", | ||
| label: "URL", | ||
| description: "The page URL to render. Provide either `url` or `html`.", | ||
| optional: true, | ||
| }, | ||
| html: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "html", | ||
| ], | ||
| }, | ||
| format: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "format", | ||
| ], | ||
| }, | ||
| width: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "width", | ||
| ], | ||
| }, | ||
| height: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "height", | ||
| ], | ||
| }, | ||
| fullPage: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "fullPage", | ||
| ], | ||
| }, | ||
| expiresIn: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "expiresIn", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const hasHtml = Boolean(this.html); | ||
| const hasUrl = Boolean(this.url); | ||
| if (hasHtml === hasUrl) { | ||
| throw new ConfigurationError("Provide exactly one of `html` or `url`."); | ||
| } | ||
|
|
||
| const response = await this.rendex.createRenderLink({ | ||
| $, | ||
| data: { | ||
| url: hasUrl | ||
| ? this.url | ||
| : undefined, | ||
| html: hasHtml | ||
| ? this.html | ||
| : undefined, | ||
| format: this.format, | ||
| width: this.width, | ||
| height: this.height, | ||
| fullPage: this.fullPage, | ||
| expiresIn: this.expiresIn, | ||
| }, | ||
| }); | ||
|
|
||
| const data = response.data; | ||
| $.export("$summary", `Created render link (expires ${data?.expiresAt})`); | ||
| return data; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import rendex from "../../rendex.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "rendex-create-watch", | ||
| name: "Create Watch", | ||
| description: "Create a watch that monitors a page for visual or text changes. [See the documentation](https://rendex.dev/docs/watch).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| props: { | ||
| rendex, | ||
| url: { | ||
| type: "string", | ||
| label: "URL", | ||
| description: "The page URL to monitor for changes.", | ||
| }, | ||
| name: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "name", | ||
| ], | ||
| }, | ||
| intervalMinutes: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "intervalMinutes", | ||
| ], | ||
| }, | ||
| diffMode: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "diffMode", | ||
| ], | ||
| }, | ||
| threshold: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "threshold", | ||
| ], | ||
| }, | ||
| webhookUrl: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "webhookUrl", | ||
| ], | ||
| }, | ||
| notifyEmail: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "notifyEmail", | ||
| ], | ||
| }, | ||
| paused: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "paused", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.rendex.createWatch({ | ||
| $, | ||
| data: { | ||
| url: this.url, | ||
| name: this.name, | ||
| intervalMinutes: this.intervalMinutes, | ||
| diffMode: this.diffMode, | ||
| threshold: this.threshold !== undefined | ||
| ? Number(this.threshold) | ||
| : undefined, | ||
| webhookUrl: this.webhookUrl, | ||
| notifyEmail: this.notifyEmail, | ||
| paused: this.paused, | ||
| }, | ||
| }); | ||
|
|
||
| const watch = response.data; | ||
| $.export("$summary", `Created watch ${watch?.id}`); | ||
| return watch; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import rendex from "../../rendex.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "rendex-delete-watch", | ||
| name: "Delete Watch", | ||
| description: "Delete a watch and its run history. [See the documentation](https://rendex.dev/docs/watch).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| rendex, | ||
| watchId: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "watchId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| await this.rendex.deleteWatch(this.watchId, { | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Deleted watch ${this.watchId}`); | ||
| return { | ||
| success: true, | ||
| watchId: this.watchId, | ||
| }; | ||
| }, | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
52 changes: 52 additions & 0 deletions
52
components/rendex/actions/extract-content/extract-content.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import rendex from "../../rendex.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "rendex-extract-content", | ||
| name: "Extract Content", | ||
| description: "Extract the readable content of a page as Markdown, JSON, or HTML. [See the documentation](https://rendex.dev/docs/api-reference).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| rendex, | ||
| url: { | ||
| type: "string", | ||
| label: "URL", | ||
| description: "The page URL to extract content from.", | ||
| }, | ||
| extractFormat: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "extractFormat", | ||
| ], | ||
| }, | ||
| waitForSelector: { | ||
| type: "string", | ||
| label: "Wait For Selector", | ||
| description: "Wait until this CSS selector is present before extracting.", | ||
| optional: true, | ||
| }, | ||
| timeout: { | ||
| type: "integer", | ||
| label: "Timeout (seconds)", | ||
| description: "Maximum time to wait for the page to load (5–60).", | ||
| optional: true, | ||
| min: 5, | ||
| max: 60, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.rendex.extract({ | ||
| $, | ||
| data: { | ||
| url: this.url, | ||
| extractFormat: this.extractFormat, | ||
| waitForSelector: this.waitForSelector, | ||
| timeout: this.timeout, | ||
| }, | ||
| }); | ||
|
|
||
| const data = response.data; | ||
| $.export("$summary", `Extracted content from ${this.url}`); | ||
| return data; | ||
| }, | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import rendex from "../../rendex.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "rendex-get-watch", | ||
| name: "Get Watch", | ||
| description: "Retrieve a single watch by its ID. [See the documentation](https://rendex.dev/docs/watch).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| props: { | ||
| rendex, | ||
| watchId: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "watchId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.rendex.getWatch(this.watchId, { | ||
| $, | ||
| }); | ||
|
|
||
| const watch = response.data; | ||
| $.export("$summary", `Retrieved watch ${this.watchId}`); | ||
| return watch; | ||
| }, | ||
| }; | ||
43 changes: 43 additions & 0 deletions
43
components/rendex/actions/list-watch-runs/list-watch-runs.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import rendex from "../../rendex.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "rendex-list-watch-runs", | ||
| name: "List Watch Runs", | ||
| description: "List the run history for a watch (most recent first). [See the documentation](https://rendex.dev/docs/watch).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| props: { | ||
| rendex, | ||
| watchId: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "watchId", | ||
| ], | ||
| }, | ||
| limit: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "limit", | ||
| ], | ||
| }, | ||
| cursor: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "cursor", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.rendex.listRuns(this.watchId, { | ||
| $, | ||
| params: { | ||
| limit: this.limit, | ||
| cursor: this.cursor, | ||
| }, | ||
| }); | ||
|
|
||
| const data = response.data; | ||
| $.export("$summary", `Retrieved ${data?.items?.length ?? 0} run(s)`); | ||
| return data; | ||
| }, | ||
| }; | ||
49 changes: 49 additions & 0 deletions
49
components/rendex/actions/render-markdown/render-markdown.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import rendex from "../../rendex.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "rendex-render-markdown", | ||
| name: "Render Markdown", | ||
| description: "Render a Markdown string to an image or PDF via Rendex — clean default typography, no CSS required. Returns base64-encoded data with metadata. [See the documentation](https://rendex.dev/docs/api-reference#post-screenshot-json).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| rendex, | ||
| markdown: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "markdown", | ||
| ], | ||
| }, | ||
| format: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "format", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if (!this.markdown) { | ||
| throw new ConfigurationError("`markdown` is required."); | ||
| } | ||
|
|
||
| const data = { | ||
| markdown: this.markdown, | ||
| format: this.format || "png", | ||
| }; | ||
|
|
||
| const response = await this.rendex.renderJson({ | ||
| $, | ||
| data, | ||
| }); | ||
|
|
||
| const result = response.data; | ||
| $.export("$summary", `Successfully rendered ${result?.format || "image"} from Markdown (${result?.bytesSize ?? "unknown"} bytes)`); | ||
| return result; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import rendex from "../../rendex.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "rendex-run-watch", | ||
| name: "Run Watch Now", | ||
| description: "Trigger an immediate check for a watch. The run is queued and its diff result is produced asynchronously — poll **List Watch Runs** for the completed run. [See the documentation](https://rendex.dev/docs/watch).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| props: { | ||
| rendex, | ||
| watchId: { | ||
| propDefinition: [ | ||
| rendex, | ||
| "watchId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.rendex.runWatch(this.watchId, { | ||
| $, | ||
| }); | ||
|
|
||
| const result = response.data; | ||
| $.export("$summary", `Queued run ${result?.runId} for watch ${this.watchId}`); | ||
| return result; | ||
| }, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.