@nodetool-ai/automation-nodes 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/file-watch-match.d.ts +59 -0
- package/dist/lib/file-watch-match.d.ts.map +1 -0
- package/dist/lib/file-watch-match.js +99 -0
- package/dist/lib/file-watch-match.js.map +1 -0
- package/dist/lib/trigger-payload.d.ts +66 -0
- package/dist/lib/trigger-payload.d.ts.map +1 -0
- package/dist/lib/trigger-payload.js +112 -0
- package/dist/lib/trigger-payload.js.map +1 -0
- package/dist/nodes/lib-browser.d.ts +27 -0
- package/dist/nodes/lib-browser.d.ts.map +1 -0
- package/dist/nodes/lib-browser.js +68 -0
- package/dist/nodes/lib-browser.js.map +1 -0
- package/dist/nodes/lib-sqlite.d.ts +22 -0
- package/dist/nodes/lib-sqlite.d.ts.map +1 -0
- package/dist/nodes/lib-sqlite.js +48 -0
- package/dist/nodes/lib-sqlite.js.map +1 -0
- package/dist/nodes/triggers.d.ts +143 -0
- package/dist/nodes/triggers.d.ts.map +1 -0
- package/dist/nodes/triggers.js +600 -0
- package/dist/nodes/triggers.js.map +1 -0
- package/package.json +80 -0
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @nodetool-ai/automation-nodes
|
|
2
|
+
|
|
3
|
+
Browser, OS, filesystem, and automation nodes for [NodeTool](https://nodetool.ai).
|
|
4
|
+
|
|
5
|
+
Automate the local system from visual AI workflows: screenshot web pages, read
|
|
6
|
+
and write files, and schedule triggers.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @nodetool-ai/automation-nodes
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Nodes
|
|
15
|
+
|
|
16
|
+
**Browser** (`lib.browser.*`) — `Screenshot`, which drives a real page over CDP.
|
|
17
|
+
|
|
18
|
+
**SQLite** (`lib.sqlite.*`) — `GetDatabasePath`.
|
|
19
|
+
|
|
20
|
+
**Triggers** (`nodetool.triggers.*`) — `Wait`, `ManualTrigger`,
|
|
21
|
+
`IntervalTrigger`, `WebhookTrigger`, `FileWatchTrigger`.
|
|
22
|
+
|
|
23
|
+
## What moved to the sandbox
|
|
24
|
+
|
|
25
|
+
Fetching and crawling pages, Excel, OCR, and the TensorFlow.js models are no
|
|
26
|
+
longer nodes. Each is a sandbox pack a `nodetool.code.Code` node imports —
|
|
27
|
+
`fetch` plus `@nodetool-ai/sandbox-html`, `-xlsx`, `-ocr` and `-tfjs` — which is
|
|
28
|
+
one script instead of a chain of near-identical nodes. See
|
|
29
|
+
[packages/sandbox-packs](../sandbox-packs/README.md).
|
|
30
|
+
|
|
31
|
+
The `lib.sqlite.*` CRUD nodes went too, without a pack behind them: a database
|
|
32
|
+
is a file the host holds open across calls, which the sandbox's plain-data
|
|
33
|
+
boundary does not model. A workflow that needs to keep something between runs
|
|
34
|
+
writes it with `workspace.*`.
|
|
35
|
+
|
|
36
|
+
## Links
|
|
37
|
+
|
|
38
|
+
- [NodeTool](https://nodetool.ai)
|
|
39
|
+
- [GitHub](https://github.com/nodetool-ai/nodetool)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2026-09-28T09:19:10.493Z
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAKtC,cAAc,2BAA2B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./nodes/lib-browser.js";
|
|
2
|
+
export * from "./nodes/triggers.js";
|
|
3
|
+
export * from "./nodes/lib-sqlite.js";
|
|
4
|
+
// File-watch matching/debounce logic shared with the host file-watch adapter
|
|
5
|
+
// (packages/websocket/src/triggers/file-watch.ts) so both call sites stay in
|
|
6
|
+
// sync instead of duplicating pattern/debounce behavior.
|
|
7
|
+
export * from "./lib/file-watch-match.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAEtC,6EAA6E;AAC7E,6EAA6E;AAC7E,yDAAyD;AACzD,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared file-watch matching/debounce logic.
|
|
3
|
+
*
|
|
4
|
+
* Used by both `FileWatchTriggerNode` (`../nodes/triggers.ts`, the in-editor
|
|
5
|
+
* live-test path that runs inside a job) and the host file-watch adapter
|
|
6
|
+
* (`packages/websocket/src/triggers/file-watch.ts`, the production ingestion
|
|
7
|
+
* path that runs in the backend server process). One implementation means a
|
|
8
|
+
* pattern or debounce fix lands in both call sites at once instead of
|
|
9
|
+
* drifting apart.
|
|
10
|
+
*/
|
|
11
|
+
/** The filter a watcher applies before turning a raw fs event into an event. */
|
|
12
|
+
export interface FileWatchFilter {
|
|
13
|
+
/** Glob-ish include patterns (e.g. "*.txt"); "*" matches everything. */
|
|
14
|
+
patterns: string[];
|
|
15
|
+
/** Glob-ish patterns to exclude, checked before include patterns. */
|
|
16
|
+
ignorePatterns: string[];
|
|
17
|
+
/** Event types to react to ("created" | "modified" | "deleted" | "moved" | ...). */
|
|
18
|
+
events: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Minimal glob match against a filename: `*` matches any run of characters,
|
|
22
|
+
* `?` matches any single character, everything else is literal. `pattern ===
|
|
23
|
+
* "*"` is short-circuited since it is the common "match everything" case.
|
|
24
|
+
*/
|
|
25
|
+
export declare function matchesFileWatchPattern(filename: string, pattern: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* True when a changed file's basename passes the ignore/include pattern
|
|
28
|
+
* filter: ignore patterns are checked first (an ignored file is never
|
|
29
|
+
* processed even if an include pattern also matches it), then include
|
|
30
|
+
* patterns — no include pattern match means the file is skipped.
|
|
31
|
+
*/
|
|
32
|
+
export declare function shouldProcessFileWatchPath(filePath: string, filter: Pick<FileWatchFilter, "patterns" | "ignorePatterns">): boolean;
|
|
33
|
+
/** True when an event type is one the watcher cares about. */
|
|
34
|
+
export declare function isWatchedFileEvent(eventType: string, events: string[]): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Per-path debounce: tracks the last time each path fired and suppresses a
|
|
37
|
+
* repeat for the same path within `debounceMs`. One instance per watcher (a
|
|
38
|
+
* node run, or one per registration in the host adapter) — state is scoped to
|
|
39
|
+
* that watcher, not shared across paths or watchers.
|
|
40
|
+
*/
|
|
41
|
+
export declare class FileWatchDebouncer {
|
|
42
|
+
private readonly debounceMs;
|
|
43
|
+
private readonly now;
|
|
44
|
+
private readonly lastFiredAt;
|
|
45
|
+
constructor(debounceMs: number, now?: () => number);
|
|
46
|
+
/** Returns true when the event for `filePath` should be suppressed. A path
|
|
47
|
+
* that has never fired is never suppressed — `now` is injectable, so 0 is a
|
|
48
|
+
* time a clock can genuinely read, not a stand-in for "no entry". */
|
|
49
|
+
shouldSuppress(filePath: string): boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Combines the event-type, include/ignore-pattern, and debounce checks in the
|
|
53
|
+
* same order `FileWatchTriggerNode.genProcess()`'s `emitEvent` always applied
|
|
54
|
+
* them: event type first (cheapest), then patterns, then debounce (which has
|
|
55
|
+
* a side effect — it records the fire time — so it must run last and only
|
|
56
|
+
* once the event is otherwise known to matter).
|
|
57
|
+
*/
|
|
58
|
+
export declare function shouldEmitFileWatchEvent(eventType: string, filePath: string, filter: FileWatchFilter, debouncer: FileWatchDebouncer): boolean;
|
|
59
|
+
//# sourceMappingURL=file-watch-match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-watch-match.d.ts","sourceRoot":"","sources":["../../src/lib/file-watch-match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,oFAAoF;IACpF,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAgBT;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,CAAC,GAC3D,OAAO,CAYT;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EAAE,GACf,OAAO,CAET;AAED;;;;;GAKG;AACH,qBAAa,kBAAkB;IAI3B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG;IAJtB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IAEzD,YACmB,UAAU,EAAE,MAAM,EAClB,GAAG,GAAE,MAAM,MAAiB,EAC3C;IAEJ;;yEAEqE;IACrE,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMxC;CACF;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAKT"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared file-watch matching/debounce logic.
|
|
3
|
+
*
|
|
4
|
+
* Used by both `FileWatchTriggerNode` (`../nodes/triggers.ts`, the in-editor
|
|
5
|
+
* live-test path that runs inside a job) and the host file-watch adapter
|
|
6
|
+
* (`packages/websocket/src/triggers/file-watch.ts`, the production ingestion
|
|
7
|
+
* path that runs in the backend server process). One implementation means a
|
|
8
|
+
* pattern or debounce fix lands in both call sites at once instead of
|
|
9
|
+
* drifting apart.
|
|
10
|
+
*/
|
|
11
|
+
import * as path from "path";
|
|
12
|
+
/**
|
|
13
|
+
* Minimal glob match against a filename: `*` matches any run of characters,
|
|
14
|
+
* `?` matches any single character, everything else is literal. `pattern ===
|
|
15
|
+
* "*"` is short-circuited since it is the common "match everything" case.
|
|
16
|
+
*/
|
|
17
|
+
export function matchesFileWatchPattern(filename, pattern) {
|
|
18
|
+
if (pattern === "*")
|
|
19
|
+
return true;
|
|
20
|
+
// Escape every regex metacharacter first, then reinstate the two glob
|
|
21
|
+
// wildcards from their escaped forms. Escaping only "." would leave the
|
|
22
|
+
// rest live: "\d" would match any digit instead of a literal backslash,
|
|
23
|
+
// and an unbalanced "(" would throw at watch time rather than simply
|
|
24
|
+
// failing to match.
|
|
25
|
+
const source = pattern
|
|
26
|
+
.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&")
|
|
27
|
+
.replace(/\\\*/g, ".*")
|
|
28
|
+
.replace(/\\\?/g, ".");
|
|
29
|
+
// "s" because a bare "." skips the four JS line terminators, all of which
|
|
30
|
+
// are legal in a POSIX filename; "u" because it otherwise counts one UTF-16
|
|
31
|
+
// unit, so "?" ate half an emoji. Neither flag can make the compile throw:
|
|
32
|
+
// the escape above already covers every character "u" is strict about.
|
|
33
|
+
return new RegExp(`^${source}$`, "us").test(filename);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* True when a changed file's basename passes the ignore/include pattern
|
|
37
|
+
* filter: ignore patterns are checked first (an ignored file is never
|
|
38
|
+
* processed even if an include pattern also matches it), then include
|
|
39
|
+
* patterns — no include pattern match means the file is skipped.
|
|
40
|
+
*/
|
|
41
|
+
export function shouldProcessFileWatchPath(filePath, filter) {
|
|
42
|
+
const filename = path.basename(filePath);
|
|
43
|
+
for (const pattern of filter.ignorePatterns) {
|
|
44
|
+
if (matchesFileWatchPattern(filename, pattern))
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
for (const pattern of filter.patterns) {
|
|
48
|
+
if (matchesFileWatchPattern(filename, pattern))
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
/** True when an event type is one the watcher cares about. */
|
|
54
|
+
export function isWatchedFileEvent(eventType, events) {
|
|
55
|
+
return events.includes(eventType);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Per-path debounce: tracks the last time each path fired and suppresses a
|
|
59
|
+
* repeat for the same path within `debounceMs`. One instance per watcher (a
|
|
60
|
+
* node run, or one per registration in the host adapter) — state is scoped to
|
|
61
|
+
* that watcher, not shared across paths or watchers.
|
|
62
|
+
*/
|
|
63
|
+
export class FileWatchDebouncer {
|
|
64
|
+
debounceMs;
|
|
65
|
+
now;
|
|
66
|
+
lastFiredAt = new Map();
|
|
67
|
+
constructor(debounceMs, now = Date.now) {
|
|
68
|
+
this.debounceMs = debounceMs;
|
|
69
|
+
this.now = now;
|
|
70
|
+
}
|
|
71
|
+
/** Returns true when the event for `filePath` should be suppressed. A path
|
|
72
|
+
* that has never fired is never suppressed — `now` is injectable, so 0 is a
|
|
73
|
+
* time a clock can genuinely read, not a stand-in for "no entry". */
|
|
74
|
+
shouldSuppress(filePath) {
|
|
75
|
+
const now = this.now();
|
|
76
|
+
const last = this.lastFiredAt.get(filePath);
|
|
77
|
+
if (last !== undefined && now - last < this.debounceMs)
|
|
78
|
+
return true;
|
|
79
|
+
this.lastFiredAt.set(filePath, now);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Combines the event-type, include/ignore-pattern, and debounce checks in the
|
|
85
|
+
* same order `FileWatchTriggerNode.genProcess()`'s `emitEvent` always applied
|
|
86
|
+
* them: event type first (cheapest), then patterns, then debounce (which has
|
|
87
|
+
* a side effect — it records the fire time — so it must run last and only
|
|
88
|
+
* once the event is otherwise known to matter).
|
|
89
|
+
*/
|
|
90
|
+
export function shouldEmitFileWatchEvent(eventType, filePath, filter, debouncer) {
|
|
91
|
+
if (!isWatchedFileEvent(eventType, filter.events))
|
|
92
|
+
return false;
|
|
93
|
+
if (!shouldProcessFileWatchPath(filePath, filter))
|
|
94
|
+
return false;
|
|
95
|
+
if (debouncer.shouldSuppress(filePath))
|
|
96
|
+
return false;
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=file-watch-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-watch-match.js","sourceRoot":"","sources":["../../src/lib/file-watch-match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAY7B;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAAgB,EAChB,OAAe;IAEf,IAAI,OAAO,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IACjC,sEAAsE;IACtE,wEAAwE;IACxE,wEAAwE;IACxE,qEAAqE;IACrE,oBAAoB;IACpB,MAAM,MAAM,GAAG,OAAO;SACnB,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC;SACtC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;SACtB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACzB,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,uEAAuE;IACvE,OAAO,IAAI,MAAM,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,EAAE,GAAG,CAAC,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAAiB,EACjB,QAAgB,EAChB,MAAuB,EACvB,SAA6B;IAE7B,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAChE,IAAI,CAAC,0BAA0B,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAChE,IAAI,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The boundary between a trigger adapter's payload and the output slots each
|
|
3
|
+
* trigger node declares. A payload arrives as JSON somebody else wrote, so each
|
|
4
|
+
* parse below keeps a field only when it carries the type its slot emits and
|
|
5
|
+
* fills the rest in. A payload that is not an object of named fields carries no
|
|
6
|
+
* fields at all; the manual and webhook parses emit the whole value instead.
|
|
7
|
+
*/
|
|
8
|
+
import type { TriggerEvent } from "@nodetool-ai/node-sdk";
|
|
9
|
+
/** What `nodetool.triggers.ManualTrigger` emits — one field per declared slot. */
|
|
10
|
+
export type ManualTriggerEvent = {
|
|
11
|
+
data: unknown;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
source: string;
|
|
14
|
+
event_type: "manual";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The adapter envelope is `{data, timestamp, source}`; a payload without a
|
|
18
|
+
* `data` field is emitted whole as the data slot.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseManualEvent(payload: TriggerEvent["payload"], triggerName: string): ManualTriggerEvent;
|
|
21
|
+
/** What `nodetool.triggers.IntervalTrigger` emits — one field per declared slot. */
|
|
22
|
+
export type IntervalTickEvent = {
|
|
23
|
+
tick: number;
|
|
24
|
+
elapsed_seconds: number;
|
|
25
|
+
interval_seconds: number;
|
|
26
|
+
timestamp: string;
|
|
27
|
+
source: "interval";
|
|
28
|
+
event_type: "tick";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The scheduler adapter synthesizes the tick fields; a bare fire carries none
|
|
32
|
+
* of them, so each falls back to a value that still describes a first tick of
|
|
33
|
+
* this node's configured interval.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseIntervalTick(payload: TriggerEvent["payload"], intervalSeconds: number): IntervalTickEvent;
|
|
36
|
+
/** What `nodetool.triggers.WebhookTrigger` emits — one field per declared slot. */
|
|
37
|
+
export type WebhookEvent = {
|
|
38
|
+
body: unknown;
|
|
39
|
+
headers: object;
|
|
40
|
+
query: object;
|
|
41
|
+
method: string;
|
|
42
|
+
path: string;
|
|
43
|
+
timestamp: string;
|
|
44
|
+
source: string;
|
|
45
|
+
event_type: "webhook";
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The webhook route captures `{body, headers, query, method}` (plus
|
|
49
|
+
* path/timestamp when available); a payload carrying none of those four is
|
|
50
|
+
* treated as the body itself.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseWebhookEvent(payload: TriggerEvent["payload"]): WebhookEvent;
|
|
53
|
+
/** What `nodetool.triggers.FileWatchTrigger` emits — one field per declared slot. */
|
|
54
|
+
export type FileWatchEvent = {
|
|
55
|
+
event: string;
|
|
56
|
+
path: string;
|
|
57
|
+
dest_path: string;
|
|
58
|
+
is_directory: boolean;
|
|
59
|
+
timestamp: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* The file-watch adapter — or the launch-time snapshot diff — delivers
|
|
63
|
+
* `{event, path, dest_path, is_directory}`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseFileWatchEvent(payload: TriggerEvent["payload"]): FileWatchEvent;
|
|
66
|
+
//# sourceMappingURL=trigger-payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,GAC/B,cAAc,CAShB"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The boundary between a trigger adapter's payload and the output slots each
|
|
3
|
+
* trigger node declares. A payload arrives as JSON somebody else wrote, so each
|
|
4
|
+
* parse below keeps a field only when it carries the type its slot emits and
|
|
5
|
+
* fills the rest in. A payload that is not an object of named fields carries no
|
|
6
|
+
* fields at all; the manual and webhook parses emit the whole value instead.
|
|
7
|
+
*/
|
|
8
|
+
function isString(value) {
|
|
9
|
+
return typeof value === "string";
|
|
10
|
+
}
|
|
11
|
+
function isFiniteNumber(value) {
|
|
12
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
13
|
+
}
|
|
14
|
+
function isBoolean(value) {
|
|
15
|
+
return typeof value === "boolean";
|
|
16
|
+
}
|
|
17
|
+
/** An object of named fields. `null` and arrays are bare values, not envelopes. */
|
|
18
|
+
function isFieldObject(value) {
|
|
19
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
20
|
+
}
|
|
21
|
+
function envelopeOf(payload) {
|
|
22
|
+
const fields = new Map();
|
|
23
|
+
if (isFieldObject(payload)) {
|
|
24
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
25
|
+
fields.set(key, value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return fields;
|
|
29
|
+
}
|
|
30
|
+
function stringField(fields, key, fallback) {
|
|
31
|
+
const value = fields.get(key);
|
|
32
|
+
return isString(value) ? value : fallback;
|
|
33
|
+
}
|
|
34
|
+
function numberField(fields, key, fallback) {
|
|
35
|
+
const value = fields.get(key);
|
|
36
|
+
return isFiniteNumber(value) ? value : fallback;
|
|
37
|
+
}
|
|
38
|
+
function booleanField(fields, key, fallback) {
|
|
39
|
+
const value = fields.get(key);
|
|
40
|
+
return isBoolean(value) ? value : fallback;
|
|
41
|
+
}
|
|
42
|
+
/** A `dict[str, any]` slot: the field's object, or an empty one. */
|
|
43
|
+
function objectField(fields, key) {
|
|
44
|
+
const value = fields.get(key);
|
|
45
|
+
return isFieldObject(value) ? value : {};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The adapter envelope is `{data, timestamp, source}`; a payload without a
|
|
49
|
+
* `data` field is emitted whole as the data slot.
|
|
50
|
+
*/
|
|
51
|
+
export function parseManualEvent(payload, triggerName) {
|
|
52
|
+
const fields = envelopeOf(payload);
|
|
53
|
+
return {
|
|
54
|
+
data: fields.has("data") ? fields.get("data") : payload,
|
|
55
|
+
timestamp: stringField(fields, "timestamp", new Date().toISOString()),
|
|
56
|
+
source: stringField(fields, "source", triggerName),
|
|
57
|
+
event_type: "manual"
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The scheduler adapter synthesizes the tick fields; a bare fire carries none
|
|
62
|
+
* of them, so each falls back to a value that still describes a first tick of
|
|
63
|
+
* this node's configured interval.
|
|
64
|
+
*/
|
|
65
|
+
export function parseIntervalTick(payload, intervalSeconds) {
|
|
66
|
+
const fields = envelopeOf(payload);
|
|
67
|
+
return {
|
|
68
|
+
tick: numberField(fields, "tick", 1),
|
|
69
|
+
elapsed_seconds: numberField(fields, "elapsed_seconds", 0),
|
|
70
|
+
interval_seconds: numberField(fields, "interval_seconds", intervalSeconds),
|
|
71
|
+
timestamp: stringField(fields, "timestamp", new Date().toISOString()),
|
|
72
|
+
source: "interval",
|
|
73
|
+
event_type: "tick"
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The webhook route captures `{body, headers, query, method}` (plus
|
|
78
|
+
* path/timestamp when available); a payload carrying none of those four is
|
|
79
|
+
* treated as the body itself.
|
|
80
|
+
*/
|
|
81
|
+
export function parseWebhookEvent(payload) {
|
|
82
|
+
const fields = envelopeOf(payload);
|
|
83
|
+
const isEnvelope = fields.has("body") ||
|
|
84
|
+
fields.has("headers") ||
|
|
85
|
+
fields.has("query") ||
|
|
86
|
+
fields.has("method");
|
|
87
|
+
return {
|
|
88
|
+
body: isEnvelope ? fields.get("body") : payload,
|
|
89
|
+
headers: objectField(fields, "headers"),
|
|
90
|
+
query: objectField(fields, "query"),
|
|
91
|
+
method: stringField(fields, "method", "POST"),
|
|
92
|
+
path: stringField(fields, "path", ""),
|
|
93
|
+
timestamp: stringField(fields, "timestamp", new Date().toISOString()),
|
|
94
|
+
source: stringField(fields, "source", "webhook"),
|
|
95
|
+
event_type: "webhook"
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The file-watch adapter — or the launch-time snapshot diff — delivers
|
|
100
|
+
* `{event, path, dest_path, is_directory}`.
|
|
101
|
+
*/
|
|
102
|
+
export function parseFileWatchEvent(payload) {
|
|
103
|
+
const fields = envelopeOf(payload);
|
|
104
|
+
return {
|
|
105
|
+
event: stringField(fields, "event", "modified"),
|
|
106
|
+
path: stringField(fields, "path", ""),
|
|
107
|
+
dest_path: stringField(fields, "dest_path", ""),
|
|
108
|
+
is_directory: booleanField(fields, "is_directory", false),
|
|
109
|
+
timestamp: stringField(fields, "timestamp", new Date().toISOString())
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=trigger-payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-payload.js","sourceRoot":"","sources":["../../src/lib/trigger-payload.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,SAAS,QAAQ,CAAI,KAAQ;IAC3B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED,SAAS,cAAc,CAA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AAW,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;QACrC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC;QAC/C,YAAY,EAAE,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC;QACzD,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;KACtE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseNode } from "@nodetool-ai/node-sdk";
|
|
2
|
+
/** The single `output` slot `lib.browser.Screenshot` declares: a PNG image ref. */
|
|
3
|
+
type ScreenshotLibNodeOutputs = {
|
|
4
|
+
output: {
|
|
5
|
+
type: "image";
|
|
6
|
+
/** Raw base64 PNG bytes — never a `data:` URI. */
|
|
7
|
+
data: string;
|
|
8
|
+
mime_type: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare class ScreenshotLibNode extends BaseNode {
|
|
12
|
+
static readonly nodeType = "lib.browser.Screenshot";
|
|
13
|
+
static readonly title = "Screenshot";
|
|
14
|
+
static readonly description = "Takes a screenshot of a web page or specific element.\n browser, screenshot, capture, image\n\n Use cases:\n - Capture visual representation of web pages\n - Document specific UI elements\n - Create visual records of web content";
|
|
15
|
+
static readonly metadataOutputTypes: {
|
|
16
|
+
output: string;
|
|
17
|
+
};
|
|
18
|
+
static readonly inlineFields: string[];
|
|
19
|
+
static readonly inputFields: never[];
|
|
20
|
+
url: string;
|
|
21
|
+
selector: string;
|
|
22
|
+
timeout: number;
|
|
23
|
+
process(): Promise<ScreenshotLibNodeOutputs>;
|
|
24
|
+
}
|
|
25
|
+
export declare const LIB_BROWSER_NODES: (typeof ScreenshotLibNode)[];
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=lib-browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-browser.d.ts","sourceRoot":"","sources":["../../src/nodes/lib-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AAIvD,mFAAmF;AACnF,KAAK,wBAAwB,GAAG;IAC9B,MAAM,EAAE;QACN,IAAI,EAAE,OAAO,CAAC;QACd,kDAAkD;QAClD,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,MAAM,CAAC,QAAQ,CAAC,QAAQ,4BAA4B;IACpD,MAAM,CAAC,QAAQ,CAAC,KAAK,gBAAgB;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,yPAC6N;IACxP,MAAM,CAAC,QAAQ,CAAC,mBAAmB;QACjC,MAAM;MACN;IACF,MAAM,CAAC,QAAQ,CAAC,YAAY,WAAuB;IACnD,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAM;IAQzB,GAAG,EAAE,MAAM,CAAC;IAQZ,QAAQ,EAAE,MAAM,CAAC;IAQjB,OAAO,EAAE,MAAM,CAAC;IAElB,OAAO,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAuBjD;CACF;AAED,eAAO,MAAM,iBAAiB,8BAAmC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseNode, prop } from "@nodetool-ai/node-sdk";
|
|
8
|
+
import { withPage } from "@nodetool-ai/browser";
|
|
9
|
+
import { tagAsServer } from "@nodetool-ai/nodes-utils";
|
|
10
|
+
export class ScreenshotLibNode extends BaseNode {
|
|
11
|
+
static nodeType = "lib.browser.Screenshot";
|
|
12
|
+
static title = "Screenshot";
|
|
13
|
+
static description = "Takes a screenshot of a web page or specific element.\n browser, screenshot, capture, image\n\n Use cases:\n - Capture visual representation of web pages\n - Document specific UI elements\n - Create visual records of web content";
|
|
14
|
+
static metadataOutputTypes = {
|
|
15
|
+
output: "image"
|
|
16
|
+
};
|
|
17
|
+
static inlineFields = ["url", "selector"];
|
|
18
|
+
static inputFields = [];
|
|
19
|
+
async process() {
|
|
20
|
+
const { url, selector, timeout } = this;
|
|
21
|
+
if (!url)
|
|
22
|
+
throw new Error("URL is required");
|
|
23
|
+
return withPage({}, async (page) => {
|
|
24
|
+
await page.goto(url, { waitUntil: "domcontentloaded", timeout });
|
|
25
|
+
let buffer;
|
|
26
|
+
if (selector) {
|
|
27
|
+
await page.waitForSelector(selector, { timeout });
|
|
28
|
+
buffer = await page.screenshotOfElement(selector);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
buffer = await page.screenshot();
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
output: {
|
|
35
|
+
type: "image",
|
|
36
|
+
data: buffer.toString("base64"),
|
|
37
|
+
mime_type: "image/png"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
__decorate([
|
|
44
|
+
prop({
|
|
45
|
+
type: "str",
|
|
46
|
+
default: "",
|
|
47
|
+
title: "Url",
|
|
48
|
+
description: "URL to navigate to before taking screenshot"
|
|
49
|
+
})
|
|
50
|
+
], ScreenshotLibNode.prototype, "url", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
prop({
|
|
53
|
+
type: "str",
|
|
54
|
+
default: "",
|
|
55
|
+
title: "Selector",
|
|
56
|
+
description: "Optional CSS selector for capturing a specific element"
|
|
57
|
+
})
|
|
58
|
+
], ScreenshotLibNode.prototype, "selector", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
prop({
|
|
61
|
+
type: "int",
|
|
62
|
+
default: 30000,
|
|
63
|
+
title: "Timeout",
|
|
64
|
+
description: "Timeout in milliseconds for page navigation"
|
|
65
|
+
})
|
|
66
|
+
], ScreenshotLibNode.prototype, "timeout", void 0);
|
|
67
|
+
export const LIB_BROWSER_NODES = tagAsServer([ScreenshotLibNode]);
|
|
68
|
+
//# sourceMappingURL=lib-browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-browser.js","sourceRoot":"","sources":["../../src/nodes/lib-browser.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAYvD,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IAC7C,MAAM,CAAU,QAAQ,GAAG,wBAAwB,CAAC;IACpD,MAAM,CAAU,KAAK,GAAG,YAAY,CAAC;IACrC,MAAM,CAAU,WAAW,GACzB,qPAAqP,CAAC;IACxP,MAAM,CAAU,mBAAmB,GAAG;QACpC,MAAM,EAAE,OAAO;KAChB,CAAC;IACF,MAAM,CAAU,YAAY,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACnD,MAAM,CAAU,WAAW,GAAG,EAAE,CAAC;IA0BjC,KAAK,CAAC,OAAO;QACX,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAE7C,OAAO,QAAQ,CAAC,EAAE,EAAE,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nodetool-ai/node-sdk";
|
|
3
|
+
import type { ProcessingContext } from "@nodetool-ai/runtime";
|
|
4
|
+
/** Output handles GetDatabasePathLibNode.process() emits. */
|
|
5
|
+
type GetDatabasePathLibNodeOutputs = {
|
|
6
|
+
output: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class GetDatabasePathLibNode extends BaseNode {
|
|
9
|
+
static readonly nodeType = "lib.sqlite.GetDatabasePath";
|
|
10
|
+
static readonly title = "Get Database Path";
|
|
11
|
+
static readonly inlineFields: string[];
|
|
12
|
+
static readonly inputFields: never[];
|
|
13
|
+
static readonly description = "Get the full path to a SQLite database file.\n sqlite, database, path, location\n\n Use cases:\n - Reference database location\n - Verify database exists\n - Pass path to external tools";
|
|
14
|
+
static readonly metadataOutputTypes: {
|
|
15
|
+
output: string;
|
|
16
|
+
};
|
|
17
|
+
database_name: string;
|
|
18
|
+
process(context?: ProcessingContext): Promise<GetDatabasePathLibNodeOutputs>;
|
|
19
|
+
}
|
|
20
|
+
export declare const LIB_SQLITE_NODES: readonly NodeClass[];
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=lib-sqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-sqlite.d.ts","sourceRoot":"","sources":["../../src/nodes/lib-sqlite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAuB9D,6DAA6D;AAC7D,KAAK,6BAA6B,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,QAAQ;IAClD,MAAM,CAAC,QAAQ,CAAC,QAAQ,gCAAgC;IACxD,MAAM,CAAC,QAAQ,CAAC,KAAK,uBAAuB;IAC5C,MAAM,CAAC,QAAQ,CAAC,YAAY,WAAqB;IACjD,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAM;IACjC,MAAM,CAAC,QAAQ,CAAC,WAAW,8MACkL;IAC7M,MAAM,CAAC,QAAQ,CAAC,mBAAmB;QACjC,MAAM;MACN;IAQM,aAAa,EAAE,MAAM,CAAC;IAExB,OAAO,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAGjF;CACF;AAED,eAAO,MAAM,gBAAgB,EAAE,SAAS,SAAS,EAEhD,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseNode, prop } from "@nodetool-ai/node-sdk";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
function resolveDbPath(context, databaseName) {
|
|
10
|
+
// SQLite opens the file directly and holds it open across statements, so a
|
|
11
|
+
// staged copy would diverge from the workspace the moment a second run
|
|
12
|
+
// touched it. This node therefore needs a workspace that is a real folder.
|
|
13
|
+
const workspaceDir = context?.workspace?.localDir ?? context?.workspaceDir;
|
|
14
|
+
if (!workspaceDir) {
|
|
15
|
+
throw new Error(context?.workspace
|
|
16
|
+
? "SQLite needs a workspace that is a folder on the machine running " +
|
|
17
|
+
"the workflow. This run's workspace is cloud storage, which cannot " +
|
|
18
|
+
"back a live database file."
|
|
19
|
+
: "A workspace is required for SQLite operations");
|
|
20
|
+
}
|
|
21
|
+
return join(workspaceDir, databaseName);
|
|
22
|
+
}
|
|
23
|
+
export class GetDatabasePathLibNode extends BaseNode {
|
|
24
|
+
static nodeType = "lib.sqlite.GetDatabasePath";
|
|
25
|
+
static title = "Get Database Path";
|
|
26
|
+
static inlineFields = ["database_name"];
|
|
27
|
+
static inputFields = [];
|
|
28
|
+
static description = "Get the full path to a SQLite database file.\n sqlite, database, path, location\n\n Use cases:\n - Reference database location\n - Verify database exists\n - Pass path to external tools";
|
|
29
|
+
static metadataOutputTypes = {
|
|
30
|
+
output: "str"
|
|
31
|
+
};
|
|
32
|
+
async process(context) {
|
|
33
|
+
const dbPath = resolveDbPath(context, this.database_name);
|
|
34
|
+
return { output: dbPath };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
__decorate([
|
|
38
|
+
prop({
|
|
39
|
+
type: "str",
|
|
40
|
+
default: "memory.db",
|
|
41
|
+
title: "Database Name",
|
|
42
|
+
description: "Name of the SQLite database file"
|
|
43
|
+
})
|
|
44
|
+
], GetDatabasePathLibNode.prototype, "database_name", void 0);
|
|
45
|
+
export const LIB_SQLITE_NODES = [
|
|
46
|
+
GetDatabasePathLibNode
|
|
47
|
+
];
|
|
48
|
+
//# sourceMappingURL=lib-sqlite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-sqlite.js","sourceRoot":"","sources":["../../src/nodes/lib-sqlite.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,SAAS,aAAa,CACpB,OAAsC,EACtC,YAAoB;IAEpB,2EAA2E;IAC3E,uEAAuE;IACvE,2EAA2E;IAC3E,MAAM,YAAY,GAAG,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,OAAO,EAAE,YAAY,CAAC;IAC3E,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB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