scordi-extension 1.14.6 → 1.14.7

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.
Files changed (70) hide show
  1. package/dist/assets/loading-page-1924caaa.js +51 -0
  2. package/dist/blocks/WaitForConditionBlock.d.ts +176 -0
  3. package/dist/blocks/WaitForConditionBlock.d.ts.map +1 -0
  4. package/dist/blocks/index.d.ts +136 -0
  5. package/dist/blocks/index.d.ts.map +1 -1
  6. package/dist/logo.png +0 -0
  7. package/dist/manifest.json +55 -0
  8. package/dist/public/logo.png +0 -0
  9. package/dist/sdk/index.cjs +1 -1
  10. package/dist/sdk/index.js +3 -2
  11. package/dist/sdk/types.d.ts +1 -1
  12. package/dist/sdk/types.d.ts.map +1 -1
  13. package/dist/service-worker-loader.js +3 -0
  14. package/dist/src/blocks/AiParseDataBlock.ts.js +101 -0
  15. package/dist/src/blocks/ClearValueFormBlock.ts.js +55 -0
  16. package/dist/src/blocks/DataExtractBlock.ts.js +28 -0
  17. package/dist/src/blocks/ElementExistsBlock.ts.js +26 -0
  18. package/dist/src/blocks/EventClickBlock.ts.js +143 -0
  19. package/dist/src/blocks/FetchApiBlock.ts.js +50 -0
  20. package/dist/src/blocks/GetAttributeValueBlock.ts.js +33 -0
  21. package/dist/src/blocks/GetElementDataBlock.ts.js +114 -0
  22. package/dist/src/blocks/GetTextBlock.ts.js +152 -0
  23. package/dist/src/blocks/GetValueFormBlock.ts.js +52 -0
  24. package/dist/src/blocks/KeypressBlock.ts.js +89 -0
  25. package/dist/src/blocks/SaveAssetsBlock.ts.js +35 -0
  26. package/dist/src/blocks/ScrollBlock.ts.js +111 -0
  27. package/dist/src/blocks/SetValueFormBlock.ts.js +56 -0
  28. package/dist/src/blocks/WaitBlock.ts.js +24 -0
  29. package/dist/src/blocks/WaitForConditionBlock.ts.js +187 -0
  30. package/dist/src/blocks/index.ts.js +174 -0
  31. package/dist/src/blocks/types.ts.js +11 -0
  32. package/dist/src/content/components/ConfirmationUI.tsx.js +236 -0
  33. package/dist/src/content/elements/finders/CssSelector.ts.js +51 -0
  34. package/dist/src/content/elements/finders/ElementSelector.ts.js +20 -0
  35. package/dist/src/content/elements/finders/IframeSelector.ts.js +32 -0
  36. package/dist/src/content/elements/finders/ShadowDOMSelector.ts.js +38 -0
  37. package/dist/src/content/elements/finders/XPathFinder.ts.js +32 -0
  38. package/dist/src/content/elements/index.ts.js +26 -0
  39. package/dist/src/content/elements/utils/CSSSelectorGenerator.ts.js +72 -0
  40. package/dist/src/content/elements/utils/XPathGenerator.ts.js +62 -0
  41. package/dist/src/content/handler/ExternalMessageHandler.ts.js +78 -0
  42. package/dist/src/content/handler/InternalMessageHandler.ts.js +18 -0
  43. package/dist/src/content/kernel/MessageKernel.ts.js +83 -0
  44. package/dist/src/content/main.tsx-loader.js +22 -0
  45. package/dist/src/content/main.tsx.js +27 -0
  46. package/dist/src/content/utils/index.ts.js +1 -0
  47. package/dist/src/content/utils/synchronizedLock.ts.js +35 -0
  48. package/dist/src/popup/index.html +12 -0
  49. package/dist/src/types/internal-messages.ts.js +15 -0
  50. package/dist/vendor/.vite-deps-chunk-2TUXWMP5.js__v--9054997c.js +45 -0
  51. package/dist/vendor/.vite-deps-chunk-2TUXWMP5.js__v--e2a1f584.js +45 -0
  52. package/dist/vendor/.vite-deps-chunk-EL3BNLGW.js__v--e2a1f584.js +975 -0
  53. package/dist/vendor/.vite-deps-chunk-QIBDMRD4.js__v--9054997c.js +4158 -0
  54. package/dist/vendor/.vite-deps-chunk-QIBDMRD4.js__v--e2a1f584.js +4158 -0
  55. package/dist/vendor/.vite-deps-chunk-XHY3JSIG.js__v--e2a1f584.js +280 -0
  56. package/dist/vendor/.vite-deps-jsonata.js__v--d602c657.js +5761 -0
  57. package/dist/vendor/.vite-deps-jsonata.js__v--e2a1f584.js +5761 -0
  58. package/dist/vendor/.vite-deps-react-dom.js__v--e2a1f584.js +6 -0
  59. package/dist/vendor/.vite-deps-react-dom_client.js__v--e2a1f584.js +18108 -0
  60. package/dist/vendor/.vite-deps-react.js__v--e2a1f584.js +5 -0
  61. package/dist/vendor/.vite-deps-react_jsx-dev-runtime.js__v--e2a1f584.js +281 -0
  62. package/dist/vendor/.vite-deps-zod.js__v--9e0f4cc1.js +219 -0
  63. package/dist/vendor/.vite-deps-zod.js__v--e2a1f584.js +219 -0
  64. package/dist/vendor/crx-client-port.js +66 -0
  65. package/dist/vendor/crx-client-preamble.js +4 -0
  66. package/dist/vendor/react-refresh.js +670 -0
  67. package/dist/vendor/vite-client.js +1134 -0
  68. package/dist/vendor/vite-dist-client-env.mjs.js +24 -0
  69. package/dist/vendor/webcomponents-custom-elements.js +47 -0
  70. package/package.json +1 -1
@@ -0,0 +1,111 @@
1
+ import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
2
+ import { BaseBlockSchema } from "/src/blocks/types.ts.js";
3
+ import { findElement } from "/src/content/elements/index.ts.js";
4
+ export const ScrollBlockSchema = BaseBlockSchema.extend({
5
+ name: z.literal("scroll"),
6
+ scrollType: z.enum(["toElement", "toBottom", "byDistance", "untilLoaded"]).optional(),
7
+ distance: z.number().optional(),
8
+ behavior: z.enum(["auto", "smooth"]).optional(),
9
+ maxScrolls: z.number().optional(),
10
+ waitAfterScroll: z.number().optional()
11
+ });
12
+ export function validateScrollBlock(data) {
13
+ return ScrollBlockSchema.parse(data);
14
+ }
15
+ export async function handlerScroll(data) {
16
+ try {
17
+ const {
18
+ selector = "",
19
+ scrollType = "toBottom",
20
+ distance = 500,
21
+ behavior = "smooth",
22
+ maxScrolls = 50,
23
+ waitAfterScroll = 300,
24
+ findBy = "cssSelector",
25
+ option
26
+ } = data;
27
+ switch (scrollType) {
28
+ case "toElement":
29
+ if (!selector) {
30
+ throw new Error("Selector is required for toElement scroll type");
31
+ }
32
+ return await scrollToElement(selector, findBy, option, behavior);
33
+ case "toBottom":
34
+ return await scrollToBottom(behavior, waitAfterScroll);
35
+ case "byDistance":
36
+ return await scrollByDistance(distance, behavior);
37
+ case "untilLoaded":
38
+ return await scrollUntilLoaded(maxScrolls, distance, behavior, waitAfterScroll);
39
+ default:
40
+ throw new Error(`Unknown scroll type: ${scrollType}`);
41
+ }
42
+ } catch (error) {
43
+ return {
44
+ hasError: true,
45
+ message: error instanceof Error ? error.message : "Unknown error in scroll handler",
46
+ data: false
47
+ };
48
+ }
49
+ }
50
+ async function scrollToElement(selector, findBy, option, behavior) {
51
+ const element = await findElement({ selector, findBy, option });
52
+ if (!element) {
53
+ return {
54
+ hasError: true,
55
+ message: "Element not found for scrolling",
56
+ data: false
57
+ };
58
+ }
59
+ const targetElement = Array.isArray(element) ? element[0] : element;
60
+ targetElement.scrollIntoView({ behavior, block: "center" });
61
+ return { data: true };
62
+ }
63
+ async function scrollToBottom(behavior, waitAfterScroll) {
64
+ let lastHeight = document.body.scrollHeight;
65
+ let attempts = 0;
66
+ const maxAttempts = 50;
67
+ while (attempts < maxAttempts) {
68
+ window.scrollTo({
69
+ top: document.body.scrollHeight,
70
+ behavior
71
+ });
72
+ await new Promise((resolve) => setTimeout(resolve, waitAfterScroll));
73
+ const newHeight = document.body.scrollHeight;
74
+ if (newHeight === lastHeight) {
75
+ break;
76
+ }
77
+ lastHeight = newHeight;
78
+ attempts++;
79
+ }
80
+ return { data: true };
81
+ }
82
+ async function scrollByDistance(distance, behavior) {
83
+ window.scrollBy({
84
+ top: distance,
85
+ behavior
86
+ });
87
+ return { data: true };
88
+ }
89
+ async function scrollUntilLoaded(maxScrolls, distance, behavior, waitAfterScroll) {
90
+ let scrollCount = 0;
91
+ let lastHeight = document.body.scrollHeight;
92
+ while (scrollCount < maxScrolls) {
93
+ window.scrollBy({
94
+ top: distance,
95
+ behavior
96
+ // Use provided behavior
97
+ });
98
+ await new Promise((resolve) => setTimeout(resolve, waitAfterScroll));
99
+ const newHeight = document.body.scrollHeight;
100
+ const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
101
+ const windowHeight = window.innerHeight;
102
+ if (scrollTop + windowHeight >= newHeight - 10) {
103
+ if (newHeight === lastHeight) {
104
+ break;
105
+ }
106
+ }
107
+ lastHeight = newHeight;
108
+ scrollCount++;
109
+ }
110
+ return { data: true };
111
+ }
@@ -0,0 +1,56 @@
1
+ import { findElement } from "/src/content/elements/index.ts.js";
2
+ import { BaseBlockSchema } from "/src/blocks/types.ts.js";
3
+ import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
4
+ export const SetValueFormsBlockSchema = BaseBlockSchema.extend({
5
+ name: z.literal("set-value-form"),
6
+ setValue: z.string(),
7
+ type: z.enum(["text-field", "select", "checkbox"]).optional()
8
+ });
9
+ export function validateSetValueFormsBlock(data) {
10
+ return SetValueFormsBlockSchema.parse(data);
11
+ }
12
+ export async function handlerSetValueForm(data) {
13
+ try {
14
+ const { selector = "", setValue, type = "text-field", findBy = "cssSelector" } = data;
15
+ if (!selector) {
16
+ throw new Error("Selector is required for set-value-form block");
17
+ }
18
+ const element = await findElement({ selector, findBy, option: data.option });
19
+ if (!element) {
20
+ throw new Error("Form element not found");
21
+ }
22
+ setFormValue(element, setValue, type);
23
+ return { data: "Form element updated successfully" };
24
+ } catch (error) {
25
+ return {
26
+ hasError: true,
27
+ message: error instanceof Error ? error.message : "Unknown error in set-value-form handler",
28
+ data: null
29
+ };
30
+ }
31
+ }
32
+ function setFormValue(element, value, type) {
33
+ switch (type) {
34
+ case "text-field":
35
+ if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
36
+ element.value = value;
37
+ element.dispatchEvent(new Event("input", { bubbles: true }));
38
+ element.dispatchEvent(new Event("change", { bubbles: true }));
39
+ }
40
+ break;
41
+ case "select":
42
+ if (element instanceof HTMLSelectElement) {
43
+ element.value = value;
44
+ element.dispatchEvent(new Event("change", { bubbles: true }));
45
+ }
46
+ break;
47
+ case "checkbox":
48
+ if (element instanceof HTMLInputElement && element.type === "checkbox") {
49
+ element.checked = value === "true" || value === "checked";
50
+ element.dispatchEvent(new Event("change", { bubbles: true }));
51
+ }
52
+ break;
53
+ default:
54
+ throw new Error(`Unsupported form element type: ${type}`);
55
+ }
56
+ }
@@ -0,0 +1,24 @@
1
+ import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
2
+ export const WaitBlockSchema = z.object({
3
+ name: z.literal("wait"),
4
+ duration: z.number().min(0)
5
+ });
6
+ export function validateWaitBlock(data) {
7
+ return WaitBlockSchema.parse(data);
8
+ }
9
+ export async function handlerWait(data) {
10
+ try {
11
+ const { duration } = data;
12
+ console.log(`[Wait] Waiting for ${duration}ms...`);
13
+ await new Promise((resolve) => setTimeout(resolve, duration));
14
+ console.log(`[Wait] Wait completed after ${duration}ms`);
15
+ return { data: true };
16
+ } catch (error) {
17
+ console.log(error);
18
+ return {
19
+ hasError: true,
20
+ message: error instanceof Error ? error.message : "Unknown error in wait handler",
21
+ data: false
22
+ };
23
+ }
24
+ }
@@ -0,0 +1,187 @@
1
+ import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
2
+ export const WaitForConditionBlockSchema = z.object({
3
+ name: z.literal("wait-for-condition"),
4
+ conditions: z.object({
5
+ urlPattern: z.string().optional(),
6
+ elementExists: z.object({
7
+ selector: z.string(),
8
+ findBy: z.enum(["cssSelector", "xpath"])
9
+ }).optional(),
10
+ cookieExists: z.string().optional(),
11
+ storageKey: z.object({
12
+ type: z.enum(["localStorage", "sessionStorage"]),
13
+ key: z.string()
14
+ }).optional(),
15
+ userConfirmation: z.boolean().optional(),
16
+ message: z.string().optional(),
17
+ buttonText: z.string().optional()
18
+ }).refine(
19
+ (data) => {
20
+ return data.urlPattern !== void 0 || data.elementExists !== void 0 || data.cookieExists !== void 0 || data.storageKey !== void 0 || data.userConfirmation === true;
21
+ },
22
+ {
23
+ message: "At least one condition must be specified"
24
+ }
25
+ ),
26
+ mode: z.enum(["auto", "manual", "auto-or-manual"]).optional(),
27
+ pollingIntervalMs: z.number().min(100).optional(),
28
+ timeoutMs: z.number().min(1e3).optional(),
29
+ position: z.enum(["top-left", "top-right", "bottom-left", "bottom-right"]).optional()
30
+ });
31
+ export function validateWaitForConditionBlock(data) {
32
+ return WaitForConditionBlockSchema.parse(data);
33
+ }
34
+ export async function handlerWaitForCondition(data) {
35
+ try {
36
+ const {
37
+ conditions,
38
+ mode = "auto-or-manual",
39
+ pollingIntervalMs = 1e3,
40
+ timeoutMs = 3e5,
41
+ position = "bottom-right"
42
+ } = data;
43
+ console.log("[WaitForCondition] Starting wait with conditions:", conditions);
44
+ console.log("[WaitForCondition] Mode:", mode, "Timeout:", timeoutMs);
45
+ const hasAutoConditions = !!(conditions.urlPattern || conditions.elementExists || conditions.cookieExists || conditions.storageKey);
46
+ const hasManualConfirmation = conditions.userConfirmation === true;
47
+ let userConfirmedPromise = null;
48
+ let confirmResolve = null;
49
+ if ((mode === "manual" || mode === "auto-or-manual") && hasManualConfirmation) {
50
+ userConfirmedPromise = new Promise((resolve) => {
51
+ confirmResolve = resolve;
52
+ });
53
+ window.dispatchEvent(
54
+ new CustomEvent("8g-show-confirmation-ui", {
55
+ detail: {
56
+ message: conditions.message || "작업을 완료하셨나요?",
57
+ buttonText: conditions.buttonText || "완료",
58
+ position,
59
+ onConfirm: confirmResolve
60
+ }
61
+ })
62
+ );
63
+ }
64
+ const checkAutoConditions = async () => {
65
+ if (conditions.urlPattern) {
66
+ try {
67
+ const regex = new RegExp(conditions.urlPattern);
68
+ if (regex.test(window.location.href)) {
69
+ return {
70
+ success: true,
71
+ reason: "urlPattern",
72
+ message: `URL matches pattern: ${conditions.urlPattern}`
73
+ };
74
+ }
75
+ } catch (error) {
76
+ console.warn("[WaitForCondition] Invalid URL pattern:", error);
77
+ }
78
+ }
79
+ if (conditions.elementExists) {
80
+ const { selector, findBy } = conditions.elementExists;
81
+ let element = null;
82
+ if (findBy === "cssSelector") {
83
+ element = document.querySelector(selector);
84
+ } else if (findBy === "xpath") {
85
+ const xpathResult = document.evaluate(
86
+ selector,
87
+ document,
88
+ null,
89
+ XPathResult.FIRST_ORDERED_NODE_TYPE,
90
+ null
91
+ );
92
+ element = xpathResult.singleNodeValue;
93
+ }
94
+ if (element) {
95
+ return {
96
+ success: true,
97
+ reason: "elementExists",
98
+ message: `Element found: ${selector}`
99
+ };
100
+ }
101
+ }
102
+ if (conditions.cookieExists) {
103
+ const cookies = document.cookie.split(";");
104
+ const cookieExists = cookies.some((cookie) => {
105
+ const [name] = cookie.trim().split("=");
106
+ return name === conditions.cookieExists;
107
+ });
108
+ if (cookieExists) {
109
+ return {
110
+ success: true,
111
+ reason: "cookieExists",
112
+ message: `Cookie found: ${conditions.cookieExists}`
113
+ };
114
+ }
115
+ }
116
+ if (conditions.storageKey) {
117
+ const { type, key } = conditions.storageKey;
118
+ const storage = type === "localStorage" ? window.localStorage : window.sessionStorage;
119
+ const value = storage.getItem(key);
120
+ if (value !== null) {
121
+ return {
122
+ success: true,
123
+ reason: "storageKey",
124
+ message: `Storage key found: ${type}.${key}`
125
+ };
126
+ }
127
+ }
128
+ return null;
129
+ };
130
+ return new Promise((resolve) => {
131
+ let intervalId = null;
132
+ let resolved = false;
133
+ const cleanup = () => {
134
+ if (intervalId) {
135
+ clearInterval(intervalId);
136
+ intervalId = null;
137
+ }
138
+ window.dispatchEvent(new CustomEvent("8g-hide-confirmation-ui"));
139
+ };
140
+ const resolveWith = (result) => {
141
+ if (resolved) return;
142
+ resolved = true;
143
+ cleanup();
144
+ console.log("[WaitForCondition] Resolved with:", result);
145
+ resolve({ data: result });
146
+ };
147
+ const timeoutId = setTimeout(() => {
148
+ resolveWith({
149
+ success: false,
150
+ reason: "timeout",
151
+ message: `Timeout after ${timeoutMs}ms`
152
+ });
153
+ }, timeoutMs);
154
+ if ((mode === "auto" || mode === "auto-or-manual") && hasAutoConditions) {
155
+ intervalId = setInterval(async () => {
156
+ const result = await checkAutoConditions();
157
+ if (result) {
158
+ clearTimeout(timeoutId);
159
+ resolveWith(result);
160
+ }
161
+ }, pollingIntervalMs);
162
+ }
163
+ if ((mode === "manual" || mode === "auto-or-manual") && userConfirmedPromise) {
164
+ userConfirmedPromise.then(() => {
165
+ clearTimeout(timeoutId);
166
+ resolveWith({
167
+ success: true,
168
+ reason: "userConfirmation",
169
+ message: "User confirmed completion"
170
+ });
171
+ });
172
+ }
173
+ if (mode === "manual" && !hasAutoConditions) {
174
+ }
175
+ });
176
+ } catch (error) {
177
+ console.error("[WaitForCondition] Error:", error);
178
+ return {
179
+ hasError: true,
180
+ message: error instanceof Error ? error.message : "Unknown error in wait-for-condition handler",
181
+ data: {
182
+ success: false,
183
+ message: error instanceof Error ? error.message : "Unknown error"
184
+ }
185
+ };
186
+ }
187
+ }
@@ -0,0 +1,174 @@
1
+ export { BaseBlockSchema } from "/src/blocks/types.ts.js";
2
+ export { createSchema, createArraySchema, Schema } from "/src/blocks/AiParseDataBlock.ts.js";
3
+ export { GetTextBlockSchema } from "/src/blocks/GetTextBlock.ts.js";
4
+ export { GetAttributeValueBlockSchema } from "/src/blocks/GetAttributeValueBlock.ts.js";
5
+ export { GetValueFormsBlockSchema } from "/src/blocks/GetValueFormBlock.ts.js";
6
+ export { SetValueFormsBlockSchema } from "/src/blocks/SetValueFormBlock.ts.js";
7
+ export { ClearValueFormsBlockSchema } from "/src/blocks/ClearValueFormBlock.ts.js";
8
+ export { ElementExistsBlockSchema } from "/src/blocks/ElementExistsBlock.ts.js";
9
+ export { EventClickBlockSchema } from "/src/blocks/EventClickBlock.ts.js";
10
+ export { KeypressBlockSchema } from "/src/blocks/KeypressBlock.ts.js";
11
+ export { WaitBlockSchema } from "/src/blocks/WaitBlock.ts.js";
12
+ export { WaitForConditionBlockSchema } from "/src/blocks/WaitForConditionBlock.ts.js";
13
+ export { SaveAssetsBlockSchema } from "/src/blocks/SaveAssetsBlock.ts.js";
14
+ export { GetElementDataBlockSchema } from "/src/blocks/GetElementDataBlock.ts.js";
15
+ export { ScrollBlockSchema } from "/src/blocks/ScrollBlock.ts.js";
16
+ export { AiParseDataBlockSchema } from "/src/blocks/AiParseDataBlock.ts.js";
17
+ export { FetchApiBlockSchema } from "/src/blocks/FetchApiBlock.ts.js";
18
+ export { DataExtractBlockSchema } from "/src/blocks/DataExtractBlock.ts.js";
19
+ import { handlerGetText, validateGetTextBlock } from "/src/blocks/GetTextBlock.ts.js";
20
+ import {
21
+ handlerGetAttributeValue,
22
+ validateGetAttributeValueBlock
23
+ } from "/src/blocks/GetAttributeValueBlock.ts.js";
24
+ import {
25
+ handlerGetValueForm,
26
+ validateGetValueFormsBlock
27
+ } from "/src/blocks/GetValueFormBlock.ts.js";
28
+ import {
29
+ handlerSetValueForm,
30
+ validateSetValueFormsBlock
31
+ } from "/src/blocks/SetValueFormBlock.ts.js";
32
+ import {
33
+ handlerClearValueForm,
34
+ validateClearValueFormsBlock
35
+ } from "/src/blocks/ClearValueFormBlock.ts.js";
36
+ import {
37
+ handlerElementExists,
38
+ validateElementExistsBlock
39
+ } from "/src/blocks/ElementExistsBlock.ts.js";
40
+ import { handlerEventClick, validateEventClickBlock } from "/src/blocks/EventClickBlock.ts.js";
41
+ import { handlerKeypress, validateKeypressBlock } from "/src/blocks/KeypressBlock.ts.js";
42
+ import { handlerWait, validateWaitBlock } from "/src/blocks/WaitBlock.ts.js";
43
+ import {
44
+ handlerWaitForCondition,
45
+ validateWaitForConditionBlock
46
+ } from "/src/blocks/WaitForConditionBlock.ts.js";
47
+ import { handlerSaveAssets, validateSaveAssetsBlock } from "/src/blocks/SaveAssetsBlock.ts.js";
48
+ import {
49
+ handlerGetElementData,
50
+ validateGetElementDataBlock
51
+ } from "/src/blocks/GetElementDataBlock.ts.js";
52
+ import { handlerScroll, validateScrollBlock } from "/src/blocks/ScrollBlock.ts.js";
53
+ import { handlerAiParseData, validateAiParseDataBlock } from "/src/blocks/AiParseDataBlock.ts.js";
54
+ import { handlerFetchApi, validateFetchApiBlock } from "/src/blocks/FetchApiBlock.ts.js";
55
+ import { handlerDataExtract, validateDataExtractBlock } from "/src/blocks/DataExtractBlock.ts.js";
56
+ import { GetTextBlockSchema as GetTextBlockSchema2 } from "/src/blocks/GetTextBlock.ts.js";
57
+ import { GetAttributeValueBlockSchema as GetAttributeValueBlockSchema2 } from "/src/blocks/GetAttributeValueBlock.ts.js";
58
+ import { GetValueFormsBlockSchema as GetValueFormsBlockSchema2 } from "/src/blocks/GetValueFormBlock.ts.js";
59
+ import { SetValueFormsBlockSchema as SetValueFormsBlockSchema2 } from "/src/blocks/SetValueFormBlock.ts.js";
60
+ import { ClearValueFormsBlockSchema as ClearValueFormsBlockSchema2 } from "/src/blocks/ClearValueFormBlock.ts.js";
61
+ import { ElementExistsBlockSchema as ElementExistsBlockSchema2 } from "/src/blocks/ElementExistsBlock.ts.js";
62
+ import { EventClickBlockSchema as EventClickBlockSchema2 } from "/src/blocks/EventClickBlock.ts.js";
63
+ import { KeypressBlockSchema as KeypressBlockSchema2 } from "/src/blocks/KeypressBlock.ts.js";
64
+ import { WaitBlockSchema as WaitBlockSchema2 } from "/src/blocks/WaitBlock.ts.js";
65
+ import { WaitForConditionBlockSchema as WaitForConditionBlockSchema2 } from "/src/blocks/WaitForConditionBlock.ts.js";
66
+ import { SaveAssetsBlockSchema as SaveAssetsBlockSchema2 } from "/src/blocks/SaveAssetsBlock.ts.js";
67
+ import { GetElementDataBlockSchema as GetElementDataBlockSchema2 } from "/src/blocks/GetElementDataBlock.ts.js";
68
+ import { ScrollBlockSchema as ScrollBlockSchema2 } from "/src/blocks/ScrollBlock.ts.js";
69
+ import { AiParseDataBlockSchema as AiParseDataBlockSchema2 } from "/src/blocks/AiParseDataBlock.ts.js";
70
+ import { FetchApiBlockSchema as FetchApiBlockSchema2 } from "/src/blocks/FetchApiBlock.ts.js";
71
+ import { DataExtractBlockSchema as DataExtractBlockSchema2 } from "/src/blocks/DataExtractBlock.ts.js";
72
+ export const AllBlockSchemas = {
73
+ "get-text": GetTextBlockSchema2,
74
+ "attribute-value": GetAttributeValueBlockSchema2,
75
+ "get-value-form": GetValueFormsBlockSchema2,
76
+ "set-value-form": SetValueFormsBlockSchema2,
77
+ "clear-value-form": ClearValueFormsBlockSchema2,
78
+ "element-exists": ElementExistsBlockSchema2,
79
+ "event-click": EventClickBlockSchema2,
80
+ "keypress": KeypressBlockSchema2,
81
+ "wait": WaitBlockSchema2,
82
+ "wait-for-condition": WaitForConditionBlockSchema2,
83
+ "save-assets": SaveAssetsBlockSchema2,
84
+ "get-element-data": GetElementDataBlockSchema2,
85
+ "scroll": ScrollBlockSchema2,
86
+ "ai-parse-data": AiParseDataBlockSchema2,
87
+ "fetch-api": FetchApiBlockSchema2,
88
+ "data-extract": DataExtractBlockSchema2
89
+ };
90
+ export class BlockHandler {
91
+ // Implementation
92
+ static async executeBlock(block) {
93
+ try {
94
+ switch (block.name) {
95
+ case "get-text": {
96
+ const validatedBlock = validateGetTextBlock(block);
97
+ return await handlerGetText(validatedBlock);
98
+ }
99
+ case "attribute-value": {
100
+ const validatedBlock = validateGetAttributeValueBlock(block);
101
+ return await handlerGetAttributeValue(validatedBlock);
102
+ }
103
+ case "get-value-form": {
104
+ const validatedBlock = validateGetValueFormsBlock(block);
105
+ return await handlerGetValueForm(validatedBlock);
106
+ }
107
+ case "set-value-form": {
108
+ const validatedBlock = validateSetValueFormsBlock(block);
109
+ return await handlerSetValueForm(validatedBlock);
110
+ }
111
+ case "clear-value-form": {
112
+ const validatedBlock = validateClearValueFormsBlock(block);
113
+ return await handlerClearValueForm(validatedBlock);
114
+ }
115
+ case "element-exists": {
116
+ const validatedBlock = validateElementExistsBlock(block);
117
+ return await handlerElementExists(validatedBlock);
118
+ }
119
+ case "event-click": {
120
+ const validatedBlock = validateEventClickBlock(block);
121
+ return await handlerEventClick(validatedBlock);
122
+ }
123
+ case "keypress": {
124
+ const validatedBlock = validateKeypressBlock(block);
125
+ return await handlerKeypress(validatedBlock);
126
+ }
127
+ case "wait": {
128
+ const validatedBlock = validateWaitBlock(block);
129
+ return await handlerWait(validatedBlock);
130
+ }
131
+ case "wait-for-condition": {
132
+ const validatedBlock = validateWaitForConditionBlock(block);
133
+ return await handlerWaitForCondition(validatedBlock);
134
+ }
135
+ case "save-assets": {
136
+ const validatedBlock = validateSaveAssetsBlock(block);
137
+ return await handlerSaveAssets(validatedBlock);
138
+ }
139
+ case "get-element-data": {
140
+ const validatedBlock = validateGetElementDataBlock(block);
141
+ return await handlerGetElementData(validatedBlock);
142
+ }
143
+ case "scroll": {
144
+ const validatedBlock = validateScrollBlock(block);
145
+ return await handlerScroll(validatedBlock);
146
+ }
147
+ case "ai-parse-data": {
148
+ const validatedBlock = validateAiParseDataBlock(block);
149
+ return await handlerAiParseData(validatedBlock);
150
+ }
151
+ case "fetch-api": {
152
+ const validatedBlock = validateFetchApiBlock(block);
153
+ return await handlerFetchApi(validatedBlock);
154
+ }
155
+ case "data-extract": {
156
+ const validatedBlock = validateDataExtractBlock(block);
157
+ return await handlerDataExtract(validatedBlock);
158
+ }
159
+ default:
160
+ return {
161
+ hasError: true,
162
+ message: `Unknown block type: ${block.name}`,
163
+ data: null
164
+ };
165
+ }
166
+ } catch (error) {
167
+ return {
168
+ hasError: true,
169
+ message: error instanceof Error ? error.message : "Unknown error in block execution",
170
+ data: null
171
+ };
172
+ }
173
+ }
174
+ }
@@ -0,0 +1,11 @@
1
+ import { z } from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
2
+ export const BaseBlockSchema = z.object({
3
+ name: z.string(),
4
+ selector: z.string(),
5
+ findBy: z.enum(["cssSelector", "xpath"]),
6
+ option: z.object({
7
+ waitForSelector: z.boolean().optional(),
8
+ waitSelectorTimeout: z.number().optional(),
9
+ multiple: z.boolean().optional()
10
+ })
11
+ });