n8n-nodes-base 1.93.0 → 1.94.0

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 (97) hide show
  1. package/dist/credentials/AirtopApi.credentials.js +2 -1
  2. package/dist/credentials/AirtopApi.credentials.js.map +1 -1
  3. package/dist/credentials/JinaAiApi.credentials.js +1 -1
  4. package/dist/credentials/JinaAiApi.credentials.js.map +1 -1
  5. package/dist/known/nodes.json +0 -4
  6. package/dist/nodes/Airtop/Airtop.node.js +14 -8
  7. package/dist/nodes/Airtop/Airtop.node.js.map +1 -1
  8. package/dist/nodes/Airtop/GenericFunctions.js +87 -15
  9. package/dist/nodes/Airtop/GenericFunctions.js.map +1 -1
  10. package/dist/nodes/Airtop/actions/common/fields.js +9 -0
  11. package/dist/nodes/Airtop/actions/common/fields.js.map +1 -1
  12. package/dist/nodes/Airtop/actions/common/output.utils.js +79 -0
  13. package/dist/nodes/Airtop/actions/common/output.utils.js.map +1 -0
  14. package/dist/nodes/Airtop/actions/common/session.utils.js +2 -2
  15. package/dist/nodes/Airtop/actions/common/session.utils.js.map +1 -1
  16. package/dist/nodes/Airtop/actions/extraction/getPaginated.operation.js +13 -4
  17. package/dist/nodes/Airtop/actions/extraction/getPaginated.operation.js.map +1 -1
  18. package/dist/nodes/Airtop/actions/extraction/query.operation.js +21 -3
  19. package/dist/nodes/Airtop/actions/extraction/query.operation.js.map +1 -1
  20. package/dist/nodes/Airtop/actions/extraction/scrape.operation.js +2 -1
  21. package/dist/nodes/Airtop/actions/extraction/scrape.operation.js.map +1 -1
  22. package/dist/nodes/Airtop/actions/file/File.resource.js +104 -0
  23. package/dist/nodes/Airtop/actions/file/File.resource.js.map +1 -0
  24. package/dist/nodes/Airtop/actions/file/delete.operation.js +60 -0
  25. package/dist/nodes/Airtop/actions/file/delete.operation.js.map +1 -0
  26. package/dist/nodes/Airtop/actions/file/get.operation.js +91 -0
  27. package/dist/nodes/Airtop/actions/file/get.operation.js.map +1 -0
  28. package/dist/nodes/Airtop/actions/file/getMany.operation.js +100 -0
  29. package/dist/nodes/Airtop/actions/file/getMany.operation.js.map +1 -0
  30. package/dist/nodes/Airtop/actions/file/helpers.js +199 -0
  31. package/dist/nodes/Airtop/actions/file/helpers.js.map +1 -0
  32. package/dist/nodes/Airtop/actions/file/load.operation.js +85 -0
  33. package/dist/nodes/Airtop/actions/file/load.operation.js.map +1 -0
  34. package/dist/nodes/Airtop/actions/file/upload.operation.js +186 -0
  35. package/dist/nodes/Airtop/actions/file/upload.operation.js.map +1 -0
  36. package/dist/nodes/Airtop/actions/interaction/Interaction.resource.js +22 -1
  37. package/dist/nodes/Airtop/actions/interaction/Interaction.resource.js.map +1 -1
  38. package/dist/nodes/Airtop/actions/interaction/fill.operation.js +89 -0
  39. package/dist/nodes/Airtop/actions/interaction/fill.operation.js.map +1 -0
  40. package/dist/nodes/Airtop/actions/interaction/scroll.operation.js +219 -0
  41. package/dist/nodes/Airtop/actions/interaction/scroll.operation.js.map +1 -0
  42. package/dist/nodes/Airtop/actions/node.type.js.map +1 -1
  43. package/dist/nodes/Airtop/actions/router.js +13 -4
  44. package/dist/nodes/Airtop/actions/router.js.map +1 -1
  45. package/dist/nodes/Airtop/actions/session/create.operation.js +85 -32
  46. package/dist/nodes/Airtop/actions/session/create.operation.js.map +1 -1
  47. package/dist/nodes/Airtop/actions/window/Window.resource.js +2 -1
  48. package/dist/nodes/Airtop/actions/window/Window.resource.js.map +1 -1
  49. package/dist/nodes/Airtop/actions/window/create.operation.js +1 -1
  50. package/dist/nodes/Airtop/actions/window/create.operation.js.map +1 -1
  51. package/dist/nodes/Airtop/actions/window/takeScreenshot.operation.js +26 -3
  52. package/dist/nodes/Airtop/actions/window/takeScreenshot.operation.js.map +1 -1
  53. package/dist/nodes/Airtop/constants.js +38 -5
  54. package/dist/nodes/Airtop/constants.js.map +1 -1
  55. package/dist/nodes/Airtop/countries.js +1026 -0
  56. package/dist/nodes/Airtop/countries.js.map +1 -0
  57. package/dist/nodes/Airtop/transport/index.js +6 -3
  58. package/dist/nodes/Airtop/transport/index.js.map +1 -1
  59. package/dist/nodes/Airtop/transport/types.js.map +1 -1
  60. package/dist/nodes/Google/Drive/v2/actions/file/upload.operation.js +4 -1
  61. package/dist/nodes/Google/Drive/v2/actions/file/upload.operation.js.map +1 -1
  62. package/dist/nodes/Google/Firebase/CloudFirestore/GenericFunctions.js +1 -2
  63. package/dist/nodes/Google/Firebase/CloudFirestore/GenericFunctions.js.map +1 -1
  64. package/dist/nodes/HttpRequest/GenericFunctions.js +1 -1
  65. package/dist/nodes/HttpRequest/GenericFunctions.js.map +1 -1
  66. package/dist/nodes/Jira/Jira.node.js +34 -15
  67. package/dist/nodes/Jira/Jira.node.js.map +1 -1
  68. package/dist/nodes/Merge/Merge.node.js +3 -2
  69. package/dist/nodes/Merge/Merge.node.js.map +1 -1
  70. package/dist/nodes/Merge/v3/actions/mode/combineBySql.js +42 -4
  71. package/dist/nodes/Merge/v3/actions/mode/combineBySql.js.map +1 -1
  72. package/dist/nodes/Merge/v3/actions/versionDescription.js +1 -1
  73. package/dist/nodes/Merge/v3/actions/versionDescription.js.map +1 -1
  74. package/dist/nodes/Microsoft/SharePoint/descriptions/file/update.operation.js +2 -2
  75. package/dist/nodes/Microsoft/SharePoint/descriptions/file/update.operation.js.map +1 -1
  76. package/dist/nodes/Microsoft/SharePoint/descriptions/file/upload.operation.js +2 -2
  77. package/dist/nodes/Microsoft/SharePoint/descriptions/file/upload.operation.js.map +1 -1
  78. package/dist/nodes/Microsoft/SharePoint/descriptions/item/Item.resource.js +1 -1
  79. package/dist/nodes/Microsoft/SharePoint/descriptions/item/Item.resource.js.map +1 -1
  80. package/dist/nodes/Microsoft/SharePoint/descriptions/list/List.resource.js +1 -1
  81. package/dist/nodes/Microsoft/SharePoint/descriptions/list/List.resource.js.map +1 -1
  82. package/dist/nodes/MongoDb/GenericFunctions.js +9 -2
  83. package/dist/nodes/MongoDb/GenericFunctions.js.map +1 -1
  84. package/dist/nodes/MongoDb/MongoDb.node.js +25 -5
  85. package/dist/nodes/MongoDb/MongoDb.node.js.map +1 -1
  86. package/dist/nodes/Telegram/Telegram.node.js +5 -1
  87. package/dist/nodes/Telegram/Telegram.node.js.map +1 -1
  88. package/dist/nodes/Transform/Summarize/utils.js +2 -1
  89. package/dist/nodes/Transform/Summarize/utils.js.map +1 -1
  90. package/dist/test/setup.js +1 -0
  91. package/dist/test/setup.js.map +1 -1
  92. package/dist/types/credentials.json +1 -1
  93. package/dist/types/nodes.json +8 -9
  94. package/package.json +6 -7
  95. package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.js +0 -119
  96. package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.js.map +0 -1
  97. package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.json +0 -14
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var fill_operation_exports = {};
20
+ __export(fill_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(fill_operation_exports);
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_constants = require("../../constants");
27
+ var import_GenericFunctions = require("../../GenericFunctions");
28
+ var import_transport = require("../../transport");
29
+ const description = [
30
+ {
31
+ displayName: "Form Data",
32
+ name: "formData",
33
+ type: "string",
34
+ typeOptions: {
35
+ rows: 4
36
+ },
37
+ required: true,
38
+ default: "",
39
+ displayOptions: {
40
+ show: {
41
+ resource: ["interaction"],
42
+ operation: ["fill"]
43
+ }
44
+ },
45
+ description: "The information to fill into the form written in natural language",
46
+ placeholder: 'e.g. "Name: John Doe, Email: john.doe@example.com"'
47
+ }
48
+ ];
49
+ async function execute(index, timeout = import_constants.OPERATION_TIMEOUT) {
50
+ const { sessionId, windowId } = import_GenericFunctions.validateSessionAndWindowId.call(this, index);
51
+ const formData = import_GenericFunctions.validateRequiredStringField.call(this, index, "formData", "Form Data");
52
+ const asyncAutomationResponse = await import_transport.apiRequest.call(
53
+ this,
54
+ "POST",
55
+ `/async/sessions/${sessionId}/windows/${windowId}/execute-automation`,
56
+ {
57
+ automationId: "auto",
58
+ parameters: {
59
+ customData: formData
60
+ }
61
+ }
62
+ );
63
+ const reqId = asyncAutomationResponse.requestId;
64
+ const startTime = Date.now();
65
+ let automationStatusResponse;
66
+ while (true) {
67
+ automationStatusResponse = await import_transport.apiRequest.call(this, "GET", `/requests/${reqId}/status`);
68
+ const status = automationStatusResponse?.status ?? "";
69
+ (0, import_GenericFunctions.validateAirtopApiResponse)(this.getNode(), automationStatusResponse);
70
+ if (status === "completed" || status === "error") {
71
+ break;
72
+ }
73
+ const elapsedTime = Date.now() - startTime;
74
+ if (elapsedTime >= timeout) {
75
+ throw new import_n8n_workflow.NodeApiError(this.getNode(), {
76
+ message: import_constants.ERROR_MESSAGES.TIMEOUT_REACHED,
77
+ code: 500
78
+ });
79
+ }
80
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
81
+ }
82
+ return this.helpers.returnJsonArray({ sessionId, windowId, ...automationStatusResponse });
83
+ }
84
+ // Annotate the CommonJS export names for ESM import in node:
85
+ 0 && (module.exports = {
86
+ description,
87
+ execute
88
+ });
89
+ //# sourceMappingURL=fill.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../nodes/Airtop/actions/interaction/fill.operation.ts"],"sourcesContent":["import {\n\ttype IExecuteFunctions,\n\ttype INodeExecutionData,\n\ttype INodeProperties,\n\tNodeApiError,\n} from 'n8n-workflow';\n\nimport { ERROR_MESSAGES, OPERATION_TIMEOUT } from '../../constants';\nimport {\n\tvalidateRequiredStringField,\n\tvalidateSessionAndWindowId,\n\tvalidateAirtopApiResponse,\n} from '../../GenericFunctions';\nimport { apiRequest } from '../../transport';\nimport type { IAirtopResponse } from '../../transport/types';\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Form Data',\n\t\tname: 'formData',\n\t\ttype: 'string',\n\t\ttypeOptions: {\n\t\t\trows: 4,\n\t\t},\n\t\trequired: true,\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['interaction'],\n\t\t\t\toperation: ['fill'],\n\t\t\t},\n\t\t},\n\t\tdescription: 'The information to fill into the form written in natural language',\n\t\tplaceholder: 'e.g. \"Name: John Doe, Email: john.doe@example.com\"',\n\t},\n];\n\nexport async function execute(\n\tthis: IExecuteFunctions,\n\tindex: number,\n\ttimeout = OPERATION_TIMEOUT,\n): Promise<INodeExecutionData[]> {\n\tconst { sessionId, windowId } = validateSessionAndWindowId.call(this, index);\n\tconst formData = validateRequiredStringField.call(this, index, 'formData', 'Form Data');\n\n\t// run automation\n\tconst asyncAutomationResponse = await apiRequest.call(\n\t\tthis,\n\t\t'POST',\n\t\t`/async/sessions/${sessionId}/windows/${windowId}/execute-automation`,\n\t\t{\n\t\t\tautomationId: 'auto',\n\t\t\tparameters: {\n\t\t\t\tcustomData: formData,\n\t\t\t},\n\t\t},\n\t);\n\n\tconst reqId = asyncAutomationResponse.requestId as string;\n\n\t// Poll status every second until it's completed or timeout is reached\n\tconst startTime = Date.now();\n\tlet automationStatusResponse: IAirtopResponse;\n\n\twhile (true) {\n\t\tautomationStatusResponse = await apiRequest.call(this, 'GET', `/requests/${reqId}/status`);\n\t\tconst status = automationStatusResponse?.status ?? '';\n\n\t\tvalidateAirtopApiResponse(this.getNode(), automationStatusResponse);\n\n\t\tif (status === 'completed' || status === 'error') {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst elapsedTime = Date.now() - startTime;\n\t\tif (elapsedTime >= timeout) {\n\t\t\tthrow new NodeApiError(this.getNode(), {\n\t\t\t\tmessage: ERROR_MESSAGES.TIMEOUT_REACHED,\n\t\t\t\tcode: 500,\n\t\t\t});\n\t\t}\n\n\t\t// Wait one second\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\n\t}\n\n\treturn this.helpers.returnJsonArray({ sessionId, windowId, ...automationStatusResponse });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAKO;AAEP,uBAAkD;AAClD,8BAIO;AACP,uBAA2B;AAGpB,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,IACA,UAAU;AAAA,IACV,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,aAAa;AAAA,QACxB,WAAW,CAAC,MAAM;AAAA,MACnB;AAAA,IACD;AAAA,IACA,aAAa;AAAA,IACb,aAAa;AAAA,EACd;AACD;AAEA,eAAsB,QAErB,OACA,UAAU,oCACsB;AAChC,QAAM,EAAE,WAAW,SAAS,IAAI,mDAA2B,KAAK,MAAM,KAAK;AAC3E,QAAM,WAAW,oDAA4B,KAAK,MAAM,OAAO,YAAY,WAAW;AAGtF,QAAM,0BAA0B,MAAM,4BAAW;AAAA,IAChD;AAAA,IACA;AAAA,IACA,mBAAmB,SAAS,YAAY,QAAQ;AAAA,IAChD;AAAA,MACC,cAAc;AAAA,MACd,YAAY;AAAA,QACX,YAAY;AAAA,MACb;AAAA,IACD;AAAA,EACD;AAEA,QAAM,QAAQ,wBAAwB;AAGtC,QAAM,YAAY,KAAK,IAAI;AAC3B,MAAI;AAEJ,SAAO,MAAM;AACZ,+BAA2B,MAAM,4BAAW,KAAK,MAAM,OAAO,aAAa,KAAK,SAAS;AACzF,UAAM,SAAS,0BAA0B,UAAU;AAEnD,2DAA0B,KAAK,QAAQ,GAAG,wBAAwB;AAElE,QAAI,WAAW,eAAe,WAAW,SAAS;AACjD;AAAA,IACD;AAEA,UAAM,cAAc,KAAK,IAAI,IAAI;AACjC,QAAI,eAAe,SAAS;AAC3B,YAAM,IAAI,iCAAa,KAAK,QAAQ,GAAG;AAAA,QACtC,SAAS,gCAAe;AAAA,QACxB,MAAM;AAAA,MACP,CAAC;AAAA,IACF;AAGA,UAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAI,CAAC;AAAA,EACzD;AAEA,SAAO,KAAK,QAAQ,gBAAgB,EAAE,WAAW,UAAU,GAAG,yBAAyB,CAAC;AACzF;","names":[]}
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var scroll_operation_exports = {};
20
+ __export(scroll_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(scroll_operation_exports);
25
+ var import_helpers = require("./helpers");
26
+ var import_GenericFunctions = require("../../GenericFunctions");
27
+ var import_transport = require("../../transport");
28
+ const description = [
29
+ {
30
+ displayName: "Scroll Mode",
31
+ name: "scrollingMode",
32
+ type: "options",
33
+ description: "Choose the mode of scrolling",
34
+ options: [
35
+ {
36
+ name: "Automatic",
37
+ value: "automatic",
38
+ description: "Describe with natural language the element to scroll to"
39
+ },
40
+ {
41
+ name: "Manual",
42
+ value: "manual",
43
+ description: "Define the direction and amount to scroll by"
44
+ }
45
+ ],
46
+ default: "automatic",
47
+ required: true,
48
+ displayOptions: {
49
+ show: {
50
+ resource: ["interaction"],
51
+ operation: ["scroll"]
52
+ }
53
+ }
54
+ },
55
+ {
56
+ displayName: "Element Description",
57
+ default: "",
58
+ description: "A natural language description of the element to scroll to",
59
+ name: "scrollToElement",
60
+ type: "string",
61
+ placeholder: 'e.g. the page section titled "Contact Us"',
62
+ required: true,
63
+ displayOptions: {
64
+ show: {
65
+ resource: ["interaction"],
66
+ operation: ["scroll"],
67
+ scrollingMode: ["automatic"]
68
+ }
69
+ }
70
+ },
71
+ {
72
+ displayName: "Scroll To Page Edges",
73
+ name: "scrollToEdge",
74
+ type: "fixedCollection",
75
+ default: {},
76
+ placeholder: "Add Edge Direction",
77
+ description: "The direction to scroll to. When 'Scroll By' is defined, 'Scroll To Edge' action will be executed first, then 'Scroll By' action.",
78
+ displayOptions: {
79
+ show: {
80
+ resource: ["interaction"],
81
+ operation: ["scroll"],
82
+ scrollingMode: ["manual"]
83
+ }
84
+ },
85
+ options: [
86
+ {
87
+ displayName: "Page Edges",
88
+ name: "edgeValues",
89
+ values: [
90
+ {
91
+ displayName: "Vertically",
92
+ name: "yAxis",
93
+ type: "options",
94
+ default: "",
95
+ options: [
96
+ {
97
+ name: "Empty",
98
+ value: ""
99
+ },
100
+ {
101
+ name: "Top",
102
+ value: "top"
103
+ },
104
+ {
105
+ name: "Bottom",
106
+ value: "bottom"
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ displayName: "Horizontally",
112
+ name: "xAxis",
113
+ type: "options",
114
+ default: "",
115
+ options: [
116
+ {
117
+ name: "Empty",
118
+ value: ""
119
+ },
120
+ {
121
+ name: "Left",
122
+ value: "left"
123
+ },
124
+ {
125
+ name: "Right",
126
+ value: "right"
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ displayName: "Scroll By",
136
+ name: "scrollBy",
137
+ type: "fixedCollection",
138
+ default: {},
139
+ description: "The amount to scroll by. When 'Scroll To Edge' is defined, 'Scroll By' action will be executed after 'Scroll To Edge'.",
140
+ placeholder: "Add Scroll Amount",
141
+ displayOptions: {
142
+ show: {
143
+ resource: ["interaction"],
144
+ operation: ["scroll"],
145
+ scrollingMode: ["manual"]
146
+ }
147
+ },
148
+ options: [
149
+ {
150
+ name: "scrollValues",
151
+ displayName: "Scroll Values",
152
+ description: "The amount in pixels or percentage to scroll by",
153
+ values: [
154
+ {
155
+ displayName: "Vertically",
156
+ name: "yAxis",
157
+ type: "string",
158
+ default: "",
159
+ placeholder: "e.g. 200px, 50%, -100px"
160
+ },
161
+ {
162
+ displayName: "Horizontally",
163
+ name: "xAxis",
164
+ type: "string",
165
+ default: "",
166
+ placeholder: "e.g. 50px, 10%, -200px"
167
+ }
168
+ ]
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ displayName: "Scrollable Area",
174
+ name: "scrollWithin",
175
+ type: "string",
176
+ default: "",
177
+ description: "Scroll within an element on the page",
178
+ placeholder: "e.g. the left sidebar",
179
+ displayOptions: {
180
+ show: {
181
+ resource: ["interaction"],
182
+ operation: ["scroll"],
183
+ scrollingMode: ["automatic"]
184
+ }
185
+ }
186
+ }
187
+ ];
188
+ async function execute(index) {
189
+ const { sessionId, windowId } = import_GenericFunctions.validateSessionAndWindowId.call(this, index);
190
+ const scrollingMode = import_GenericFunctions.validateScrollingMode.call(this, index);
191
+ const isAutomatic = scrollingMode === "automatic";
192
+ const scrollToElement = isAutomatic ? import_GenericFunctions.validateRequiredStringField.call(this, index, "scrollToElement", "Element Description") : "";
193
+ const scrollToEdge = this.getNodeParameter("scrollToEdge.edgeValues", index, {});
194
+ const scrollBy = import_GenericFunctions.validateScrollByAmount.call(this, index, "scrollBy.scrollValues");
195
+ const scrollWithin = this.getNodeParameter("scrollWithin", index, "");
196
+ const request = {
197
+ // when scrollingMode is 'Manual'
198
+ ...!isAutomatic ? { scrollToEdge } : {},
199
+ ...!isAutomatic ? { scrollBy } : {},
200
+ // when scrollingMode is 'Automatic'
201
+ ...isAutomatic ? { scrollToElement } : {},
202
+ ...isAutomatic ? { scrollWithin } : {}
203
+ };
204
+ const fullRequest = import_helpers.constructInteractionRequest.call(this, index, request);
205
+ const response = await import_transport.apiRequest.call(
206
+ this,
207
+ "POST",
208
+ `/sessions/${sessionId}/windows/${windowId}/scroll`,
209
+ fullRequest
210
+ );
211
+ (0, import_GenericFunctions.validateAirtopApiResponse)(this.getNode(), response);
212
+ return this.helpers.returnJsonArray({ sessionId, windowId, ...response });
213
+ }
214
+ // Annotate the CommonJS export names for ESM import in node:
215
+ 0 && (module.exports = {
216
+ description,
217
+ execute
218
+ });
219
+ //# sourceMappingURL=scroll.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../nodes/Airtop/actions/interaction/scroll.operation.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nimport { constructInteractionRequest } from './helpers';\nimport {\n\tvalidateRequiredStringField,\n\tvalidateSessionAndWindowId,\n\tvalidateAirtopApiResponse,\n\tvalidateScrollByAmount,\n\tvalidateScrollingMode,\n} from '../../GenericFunctions';\nimport { apiRequest } from '../../transport';\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Scroll Mode',\n\t\tname: 'scrollingMode',\n\t\ttype: 'options',\n\t\tdescription: 'Choose the mode of scrolling',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Automatic',\n\t\t\t\tvalue: 'automatic',\n\t\t\t\tdescription: 'Describe with natural language the element to scroll to',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Manual',\n\t\t\t\tvalue: 'manual',\n\t\t\t\tdescription: 'Define the direction and amount to scroll by',\n\t\t\t},\n\t\t],\n\t\tdefault: 'automatic',\n\t\trequired: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['interaction'],\n\t\t\t\toperation: ['scroll'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Element Description',\n\t\tdefault: '',\n\t\tdescription: 'A natural language description of the element to scroll to',\n\t\tname: 'scrollToElement',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. the page section titled \"Contact Us\"',\n\t\trequired: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['interaction'],\n\t\t\t\toperation: ['scroll'],\n\t\t\t\tscrollingMode: ['automatic'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Scroll To Page Edges',\n\t\tname: 'scrollToEdge',\n\t\ttype: 'fixedCollection',\n\t\tdefault: {},\n\t\tplaceholder: 'Add Edge Direction',\n\t\tdescription:\n\t\t\t\"The direction to scroll to. When 'Scroll By' is defined, 'Scroll To Edge' action will be executed first, then 'Scroll By' action.\",\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['interaction'],\n\t\t\t\toperation: ['scroll'],\n\t\t\t\tscrollingMode: ['manual'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Page Edges',\n\t\t\t\tname: 'edgeValues',\n\t\t\t\tvalues: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Vertically',\n\t\t\t\t\t\tname: 'yAxis',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Empty',\n\t\t\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Top',\n\t\t\t\t\t\t\t\tvalue: 'top',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Bottom',\n\t\t\t\t\t\t\t\tvalue: 'bottom',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Horizontally',\n\t\t\t\t\t\tname: 'xAxis',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Empty',\n\t\t\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Left',\n\t\t\t\t\t\t\t\tvalue: 'left',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Right',\n\t\t\t\t\t\t\t\tvalue: 'right',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Scroll By',\n\t\tname: 'scrollBy',\n\t\ttype: 'fixedCollection',\n\t\tdefault: {},\n\t\tdescription:\n\t\t\t\"The amount to scroll by. When 'Scroll To Edge' is defined, 'Scroll By' action will be executed after 'Scroll To Edge'.\",\n\t\tplaceholder: 'Add Scroll Amount',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['interaction'],\n\t\t\t\toperation: ['scroll'],\n\t\t\t\tscrollingMode: ['manual'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'scrollValues',\n\t\t\t\tdisplayName: 'Scroll Values',\n\t\t\t\tdescription: 'The amount in pixels or percentage to scroll by',\n\t\t\t\tvalues: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Vertically',\n\t\t\t\t\t\tname: 'yAxis',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tplaceholder: 'e.g. 200px, 50%, -100px',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Horizontally',\n\t\t\t\t\t\tname: 'xAxis',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tplaceholder: 'e.g. 50px, 10%, -200px',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Scrollable Area',\n\t\tname: 'scrollWithin',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tdescription: 'Scroll within an element on the page',\n\t\tplaceholder: 'e.g. the left sidebar',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['interaction'],\n\t\t\t\toperation: ['scroll'],\n\t\t\t\tscrollingMode: ['automatic'],\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport async function execute(\n\tthis: IExecuteFunctions,\n\tindex: number,\n): Promise<INodeExecutionData[]> {\n\tconst { sessionId, windowId } = validateSessionAndWindowId.call(this, index);\n\n\tconst scrollingMode = validateScrollingMode.call(this, index);\n\tconst isAutomatic = scrollingMode === 'automatic';\n\n\tconst scrollToElement = isAutomatic\n\t\t? validateRequiredStringField.call(this, index, 'scrollToElement', 'Element Description')\n\t\t: '';\n\n\tconst scrollToEdge = this.getNodeParameter('scrollToEdge.edgeValues', index, {}) as {\n\t\txAxis?: string;\n\t\tyAxis?: string;\n\t};\n\n\tconst scrollBy = validateScrollByAmount.call(this, index, 'scrollBy.scrollValues');\n\n\tconst scrollWithin = this.getNodeParameter('scrollWithin', index, '') as string;\n\n\tconst request: IDataObject = {\n\t\t// when scrollingMode is 'Manual'\n\t\t...(!isAutomatic ? { scrollToEdge } : {}),\n\t\t...(!isAutomatic ? { scrollBy } : {}),\n\t\t// when scrollingMode is 'Automatic'\n\t\t...(isAutomatic ? { scrollToElement } : {}),\n\t\t...(isAutomatic ? { scrollWithin } : {}),\n\t};\n\n\tconst fullRequest = constructInteractionRequest.call(this, index, request);\n\n\tconst response = await apiRequest.call(\n\t\tthis,\n\t\t'POST',\n\t\t`/sessions/${sessionId}/windows/${windowId}/scroll`,\n\t\tfullRequest,\n\t);\n\n\tvalidateAirtopApiResponse(this.getNode(), response);\n\n\treturn this.helpers.returnJsonArray({ sessionId, windowId, ...response });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA4C;AAC5C,8BAMO;AACP,uBAA2B;AAEpB,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,MACd;AAAA,IACD;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,aAAa;AAAA,QACxB,WAAW,CAAC,QAAQ;AAAA,MACrB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC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,IACvC,GAAI,CAAC,cAAc,EAAE,SAAS,IAAI,CAAC;AAAA;AAAA,IAEnC,GAAI,cAAc,EAAE,gBAAgB,IAAI,CAAC;AAAA,IACzC,GAAI,cAAc,EAAE,aAAa,IAAI,CAAC;AAAA,EACvC;AAEA,QAAM,cAAc,2CAA4B,KAAK,MAAM,OAAO,OAAO;AAEzE,QAAM,WAAW,MAAM,4BAAW;AAAA,IACjC;AAAA,IACA;AAAA,IACA,aAAa,SAAS,YAAY,QAAQ;AAAA,IAC1C;AAAA,EACD;AAEA,yDAA0B,KAAK,QAAQ,GAAG,QAAQ;AAElD,SAAO,KAAK,QAAQ,gBAAgB,EAAE,WAAW,UAAU,GAAG,SAAS,CAAC;AACzE;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/Airtop/actions/node.type.ts"],"sourcesContent":["import type { AllEntities } from 'n8n-workflow';\n\ntype NodeMap = {\n\tsession: 'create' | 'save' | 'terminate';\n\twindow: 'create' | 'close' | 'takeScreenshot' | 'load';\n\textraction: 'getPaginated' | 'query' | 'scrape';\n\tinteraction: 'click' | 'hover' | 'type';\n};\n\nexport type AirtopType = AllEntities<NodeMap>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/Airtop/actions/node.type.ts"],"sourcesContent":["import type { AllEntities } from 'n8n-workflow';\n\ntype NodeMap = {\n\tsession: 'create' | 'save' | 'terminate';\n\twindow: 'create' | 'close' | 'takeScreenshot' | 'load';\n\textraction: 'getPaginated' | 'query' | 'scrape';\n\tinteraction: 'click' | 'fill' | 'hover' | 'type';\n\tfile: 'getMany' | 'get' | 'deleteFile' | 'upload' | 'load';\n};\n\nexport type AirtopType = AllEntities<NodeMap>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -32,13 +32,17 @@ __export(router_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(router_exports);
34
34
  var import_n8n_workflow = require("n8n-workflow");
35
+ var import_output = require("./common/output.utils");
35
36
  var extraction = __toESM(require("./extraction/Extraction.resource"));
37
+ var file = __toESM(require("./file/File.resource"));
36
38
  var interaction = __toESM(require("./interaction/Interaction.resource"));
37
39
  var session = __toESM(require("./session/Session.resource"));
38
40
  var window = __toESM(require("./window/Window.resource"));
39
41
  async function router() {
40
42
  const operationResult = [];
41
43
  let responseData = [];
44
+ const nodeType = this.getNode().type;
45
+ const isCalledAsTool = nodeType.includes("airtopTool");
42
46
  const items = this.getInputData();
43
47
  const resource = this.getNodeParameter("resource", 0);
44
48
  const operation = this.getNodeParameter("operation", 0);
@@ -61,16 +65,21 @@ async function router() {
61
65
  case "extraction":
62
66
  responseData = await extraction[airtopNodeData.operation].execute.call(this, i);
63
67
  break;
68
+ case "file":
69
+ responseData = await file[airtopNodeData.operation].execute.call(this, i);
70
+ break;
64
71
  default:
65
72
  throw new import_n8n_workflow.NodeOperationError(
66
73
  this.getNode(),
67
74
  `The resource "${resource}" is not supported!`
68
75
  );
69
76
  }
70
- const executionData = this.helpers.constructExecutionMetaData(
71
- this.helpers.returnJsonArray(responseData),
72
- { itemData: { item: i } }
73
- );
77
+ if (isCalledAsTool && !["session", "window"].includes(resource)) {
78
+ responseData = (0, import_output.cleanOutputForToolUse)(responseData);
79
+ }
80
+ const executionData = this.helpers.constructExecutionMetaData(responseData, {
81
+ itemData: { item: i }
82
+ });
74
83
  operationResult.push(...executionData);
75
84
  } catch (error) {
76
85
  if (this.continueOnFail()) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/Airtop/actions/router.ts"],"sourcesContent":["import type { IDataObject, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';\nimport { NodeOperationError } from 'n8n-workflow';\n\nimport * as extraction from './extraction/Extraction.resource';\nimport * as interaction from './interaction/Interaction.resource';\nimport type { AirtopType } from './node.type';\nimport * as session from './session/Session.resource';\nimport * as window from './window/Window.resource';\n\nexport async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\tconst operationResult: INodeExecutionData[] = [];\n\tlet responseData: IDataObject | IDataObject[] = [];\n\n\tconst items = this.getInputData();\n\tconst resource = this.getNodeParameter<AirtopType>('resource', 0);\n\tconst operation = this.getNodeParameter('operation', 0);\n\n\tconst airtopNodeData = {\n\t\tresource,\n\t\toperation,\n\t} as AirtopType;\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tswitch (airtopNodeData.resource) {\n\t\t\t\tcase 'session':\n\t\t\t\t\tresponseData = await session[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'window':\n\t\t\t\t\tresponseData = await window[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'interaction':\n\t\t\t\t\tresponseData = await interaction[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'extraction':\n\t\t\t\t\tresponseData = await extraction[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t`The resource \"${resource}\" is not supported!`,\n\t\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(responseData),\n\t\t\t\t{ itemData: { item: i } },\n\t\t\t);\n\t\t\toperationResult.push(...executionData);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\toperationResult.push({\n\t\t\t\t\tjson: this.getInputData(i)[0].json,\n\t\t\t\t\terror: error as NodeOperationError,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn [operationResult];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAmC;AAEnC,iBAA4B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AA,EACD;AAEA,SAAO,CAAC,eAAe;AACxB;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/Airtop/actions/router.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';\nimport { NodeOperationError } from 'n8n-workflow';\n\nimport { cleanOutputForToolUse } from './common/output.utils';\nimport * as extraction from './extraction/Extraction.resource';\nimport * as file from './file/File.resource';\nimport * as interaction from './interaction/Interaction.resource';\nimport type { AirtopType } from './node.type';\nimport * as session from './session/Session.resource';\nimport * as window from './window/Window.resource';\nimport type { IAirtopNodeExecutionData } from '../transport/types';\n\nexport async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\tconst operationResult: INodeExecutionData[] = [];\n\tlet responseData: IAirtopNodeExecutionData[] = [];\n\tconst nodeType = this.getNode().type;\n\tconst isCalledAsTool = nodeType.includes('airtopTool');\n\n\tconst items = this.getInputData();\n\tconst resource = this.getNodeParameter<AirtopType>('resource', 0);\n\tconst operation = this.getNodeParameter('operation', 0);\n\n\tconst airtopNodeData = {\n\t\tresource,\n\t\toperation,\n\t} as AirtopType;\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tswitch (airtopNodeData.resource) {\n\t\t\t\tcase 'session':\n\t\t\t\t\tresponseData = await session[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'window':\n\t\t\t\t\tresponseData = await window[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'interaction':\n\t\t\t\t\tresponseData = await interaction[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'extraction':\n\t\t\t\t\tresponseData = await extraction[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'file':\n\t\t\t\t\tresponseData = await file[airtopNodeData.operation].execute.call(this, i);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t`The resource \"${resource}\" is not supported!`,\n\t\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Get cleaner output when called as tool\n\t\t\tif (isCalledAsTool && !['session', 'window'].includes(resource)) {\n\t\t\t\tresponseData = cleanOutputForToolUse(responseData);\n\t\t\t}\n\n\t\t\tconst executionData = this.helpers.constructExecutionMetaData(responseData, {\n\t\t\t\titemData: { item: i },\n\t\t\t});\n\n\t\t\toperationResult.push(...executionData);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\toperationResult.push({\n\t\t\t\t\tjson: this.getInputData(i)[0].json,\n\t\t\t\t\terror: error as NodeOperationError,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn [operationResult];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAmC;AAEnC,oBAAsC;AACtC,iBAA4B;AAC5B,WAAsB;AACtB,kBAA6B;AAE7B,cAAyB;AACzB,aAAwB;AAGxB,eAAsB,SAAiE;AACtF,QAAM,kBAAwC,CAAC;AAC/C,MAAI,eAA2C,CAAC;AAChD,QAAM,WAAW,KAAK,QAAQ,EAAE;AAChC,QAAM,iBAAiB,SAAS,SAAS,YAAY;AAErD,QAAM,QAAQ,KAAK,aAAa;AAChC,QAAM,WAAW,KAAK,iBAA6B,YAAY,CAAC;AAChE,QAAM,YAAY,KAAK,iBAAiB,aAAa,CAAC;AAEtD,QAAM,iBAAiB;AAAA,IACtB;AAAA,IACA;AAAA,EACD;AAEA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACtC,QAAI;AACH,cAAQ,eAAe,UAAU;AAAA,QAChC,KAAK;AACJ,yBAAe,MAAM,QAAQ,eAAe,SAAS,EAAE,QAAQ,KAAK,MAAM,CAAC;AAC3E;AAAA,QACD,KAAK;AACJ,yBAAe,MAAM,OAAO,eAAe,SAAS,EAAE,QAAQ,KAAK,MAAM,CAAC;AAC1E;AAAA,QACD,KAAK;AACJ,yBAAe,MAAM,YAAY,eAAe,SAAS,EAAE,QAAQ,KAAK,MAAM,CAAC;AAC/E;AAAA,QACD,KAAK;AACJ,yBAAe,MAAM,WAAW,eAAe,SAAS,EAAE,QAAQ,KAAK,MAAM,CAAC;AAC9E;AAAA,QACD,KAAK;AACJ,yBAAe,MAAM,KAAK,eAAe,SAAS,EAAE,QAAQ,KAAK,MAAM,CAAC;AACxE;AAAA,QACD;AACC,gBAAM,IAAI;AAAA,YACT,KAAK,QAAQ;AAAA,YACb,iBAAiB,QAAQ;AAAA,UAC1B;AAAA,MACF;AAGA,UAAI,kBAAkB,CAAC,CAAC,WAAW,QAAQ,EAAE,SAAS,QAAQ,GAAG;AAChE,2BAAe,qCAAsB,YAAY;AAAA,MAClD;AAEA,YAAM,gBAAgB,KAAK,QAAQ,2BAA2B,cAAc;AAAA,QAC3E,UAAU,EAAE,MAAM,EAAE;AAAA,MACrB,CAAC;AAED,sBAAgB,KAAK,GAAG,aAAa;AAAA,IACtC,SAAS,OAAO;AACf,UAAI,KAAK,eAAe,GAAG;AAC1B,wBAAgB,KAAK;AAAA,UACpB,MAAM,KAAK,aAAa,CAAC,EAAE,CAAC,EAAE;AAAA,UAC9B;AAAA,QACD,CAAC;AAAA,MACF,OAAO;AACN,cAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AAEA,SAAO,CAAC,eAAe;AACxB;","names":[]}
@@ -22,19 +22,21 @@ __export(create_operation_exports, {
22
22
  execute: () => execute
23
23
  });
24
24
  module.exports = __toCommonJS(create_operation_exports);
25
- var import_constants = require("../../constants");
25
+ var import_countries = require("../../countries");
26
26
  var import_GenericFunctions = require("../../GenericFunctions");
27
27
  var import_transport = require("../../transport");
28
28
  var import_fields = require("../common/fields");
29
+ const displayOptions = {
30
+ show: {
31
+ resource: ["session"],
32
+ operation: ["create"]
33
+ }
34
+ };
35
+ const countryOptions = import_countries.COUNTRIES.map(({ name, value }) => ({ name, value }));
29
36
  const description = [
30
37
  {
31
38
  ...import_fields.profileNameField,
32
- displayOptions: {
33
- show: {
34
- resource: ["session"],
35
- operation: ["create"]
36
- }
37
- }
39
+ displayOptions
38
40
  },
39
41
  {
40
42
  displayName: "Save Profile",
@@ -42,12 +44,7 @@ const description = [
42
44
  type: "boolean",
43
45
  default: false,
44
46
  description: 'Whether to automatically save the <a href="https://docs.airtop.ai/guides/how-to/saving-a-profile" target="_blank">Airtop profile</a> for this session upon termination',
45
- displayOptions: {
46
- show: {
47
- resource: ["session"],
48
- operation: ["create"]
49
- }
50
- }
47
+ displayOptions
51
48
  },
52
49
  {
53
50
  displayName: "Idle Timeout",
@@ -56,13 +53,11 @@ const description = [
56
53
  default: 10,
57
54
  validateType: "number",
58
55
  description: "Minutes to wait before the session is terminated due to inactivity",
59
- displayOptions: {
60
- show: {
61
- resource: ["session"],
62
- operation: ["create"]
63
- }
64
- }
56
+ displayOptions
65
57
  },
58
+ /**
59
+ * Proxy Configuration
60
+ */
66
61
  {
67
62
  displayName: "Proxy",
68
63
  name: "proxy",
@@ -81,15 +76,41 @@ const description = [
81
76
  description: "Use Airtop-provided proxy"
82
77
  },
83
78
  {
84
- name: "Custom",
85
- value: "custom",
86
- description: "Configure a custom proxy"
79
+ name: "Proxy URL",
80
+ value: "proxyUrl",
81
+ description: "Use a proxy URL to configure the proxy"
82
+ }
83
+ ],
84
+ displayOptions
85
+ },
86
+ {
87
+ displayName: "Proxy Configuration",
88
+ name: "proxyConfig",
89
+ type: "collection",
90
+ default: { country: "US", sticky: true },
91
+ description: "The Airtop-provided configuration to use for the proxy",
92
+ placeholder: "Add Attribute",
93
+ options: [
94
+ {
95
+ displayName: "Country",
96
+ name: "country",
97
+ type: "options",
98
+ default: "US",
99
+ description: 'The country to use for the proxy. Not all countries are guaranteed to provide a proxy. Learn more <a href="https://docs.airtop.ai/api-reference/airtop-api/sessions/create#request.body.configuration.proxy.Proxy.Airtop-Proxy-Configuration.country" target="_blank">here</a>.',
100
+ options: countryOptions
101
+ },
102
+ {
103
+ displayName: "Keep Same IP",
104
+ name: "sticky",
105
+ type: "boolean",
106
+ default: true,
107
+ description: "Whether to try to maintain the same IP address for the duration of the session. Airtop can guarantee that the same IP address will be available for up to a maximum of 30 minutes."
87
108
  }
88
109
  ],
89
110
  displayOptions: {
90
111
  show: {
91
- resource: ["session"],
92
- operation: ["create"]
112
+ ...displayOptions.show,
113
+ proxy: ["integrated"]
93
114
  }
94
115
  }
95
116
  },
@@ -99,30 +120,62 @@ const description = [
99
120
  type: "string",
100
121
  default: "",
101
122
  description: "The URL of the proxy to use",
123
+ validateType: "string",
102
124
  displayOptions: {
103
125
  show: {
104
- proxy: ["custom"]
126
+ ...displayOptions.show,
127
+ proxy: ["proxyUrl"]
105
128
  }
106
129
  }
130
+ },
131
+ {
132
+ displayName: "Additional Fields",
133
+ name: "additionalFields",
134
+ type: "collection",
135
+ placeholder: "Add Field",
136
+ default: {},
137
+ displayOptions,
138
+ options: [
139
+ {
140
+ displayName: "Auto Solve Captchas",
141
+ name: "solveCaptcha",
142
+ type: "boolean",
143
+ default: false,
144
+ description: 'Whether to automatically solve <a href="https://docs.airtop.ai/guides/how-to/solving-captchas" target="_blank">captcha challenges</a>'
145
+ },
146
+ {
147
+ displayName: "Extension IDs",
148
+ name: "extensionIds",
149
+ type: "string",
150
+ default: "",
151
+ placeholder: "e.g. extId1, extId2, ...",
152
+ description: 'Comma-separated extension IDs from the Google Web Store to be loaded into the session. Learn more <a href="https://docs.airtop.ai/guides/how-to/using-chrome-extensions" target="_blank">here</a>.'
153
+ }
154
+ ]
107
155
  }
108
156
  ];
109
157
  async function execute(index) {
110
- const url = `${import_constants.INTEGRATION_URL}/create-session`;
111
158
  const profileName = import_GenericFunctions.validateProfileName.call(this, index);
112
159
  const timeoutMinutes = import_GenericFunctions.validateTimeoutMinutes.call(this, index);
113
160
  const saveProfileOnTermination = import_GenericFunctions.validateSaveProfileOnTermination.call(this, index, profileName);
114
- const proxyParam = this.getNodeParameter("proxy", index, "none");
115
- const proxyUrl = import_GenericFunctions.validateProxyUrl.call(this, index, proxyParam);
161
+ const { proxy } = import_GenericFunctions.validateProxy.call(this, index);
162
+ const solveCaptcha = this.getNodeParameter(
163
+ "additionalFields.solveCaptcha",
164
+ index,
165
+ false
166
+ );
167
+ const extensions = this.getNodeParameter("additionalFields.extensionIds", index, "");
168
+ const extensionIds = extensions ? extensions.split(",").map((id) => id.trim()) : [];
116
169
  const body = {
117
170
  configuration: {
118
171
  profileName,
119
172
  timeoutMinutes,
120
- proxy: proxyParam === "custom" ? proxyUrl : Boolean(proxyParam === "integrated")
173
+ proxy,
174
+ solveCaptcha,
175
+ ...extensionIds.length > 0 ? { extensionIds } : {}
121
176
  }
122
177
  };
123
- const response = await import_transport.apiRequest.call(this, "POST", url, body);
124
- const sessionId = response.sessionId;
125
- (0, import_GenericFunctions.validateAirtopApiResponse)(this.getNode(), response);
178
+ const { sessionId } = await import_GenericFunctions.createSession.call(this, body);
126
179
  if (saveProfileOnTermination) {
127
180
  await import_transport.apiRequest.call(
128
181
  this,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../nodes/Airtop/actions/session/create.operation.ts"],"sourcesContent":["import {\n\ttype IDataObject,\n\ttype IExecuteFunctions,\n\ttype INodeExecutionData,\n\ttype INodeProperties,\n} from 'n8n-workflow';\n\nimport { INTEGRATION_URL } from '../../constants';\nimport {\n\tvalidateAirtopApiResponse,\n\tvalidateProfileName,\n\tvalidateProxyUrl,\n\tvalidateSaveProfileOnTermination,\n\tvalidateTimeoutMinutes,\n} from '../../GenericFunctions';\nimport { apiRequest } from '../../transport';\nimport { profileNameField } from '../common/fields';\n\nexport const description: INodeProperties[] = [\n\t{\n\t\t...profileNameField,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['session'],\n\t\t\t\toperation: ['create'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Save Profile',\n\t\tname: 'saveProfileOnTermination',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription:\n\t\t\t'Whether to automatically save the <a href=\"https://docs.airtop.ai/guides/how-to/saving-a-profile\" target=\"_blank\">Airtop profile</a> for this session upon termination',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['session'],\n\t\t\t\toperation: ['create'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Idle Timeout',\n\t\tname: 'timeoutMinutes',\n\t\ttype: 'number',\n\t\tdefault: 10,\n\t\tvalidateType: 'number',\n\t\tdescription: 'Minutes to wait before the session is terminated due to inactivity',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['session'],\n\t\t\t\toperation: ['create'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Proxy',\n\t\tname: 'proxy',\n\t\ttype: 'options',\n\t\tdefault: 'none',\n\t\tdescription: 'Choose how to configure the proxy for this session',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'None',\n\t\t\t\tvalue: 'none',\n\t\t\t\tdescription: 'No proxy will be used',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Integrated',\n\t\t\t\tvalue: 'integrated',\n\t\t\t\tdescription: 'Use Airtop-provided proxy',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Custom',\n\t\t\t\tvalue: 'custom',\n\t\t\t\tdescription: 'Configure a custom proxy',\n\t\t\t},\n\t\t],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['session'],\n\t\t\t\toperation: ['create'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Proxy URL',\n\t\tname: 'proxyUrl',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tdescription: 'The URL of the proxy to use',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tproxy: ['custom'],\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport async function execute(\n\tthis: IExecuteFunctions,\n\tindex: number,\n): Promise<INodeExecutionData[]> {\n\tconst url = `${INTEGRATION_URL}/create-session`;\n\n\tconst profileName = validateProfileName.call(this, index);\n\tconst timeoutMinutes = validateTimeoutMinutes.call(this, index);\n\tconst saveProfileOnTermination = validateSaveProfileOnTermination.call(this, index, profileName);\n\tconst proxyParam = this.getNodeParameter('proxy', index, 'none') as string;\n\tconst proxyUrl = validateProxyUrl.call(this, index, proxyParam);\n\n\tconst body: IDataObject = {\n\t\tconfiguration: {\n\t\t\tprofileName,\n\t\t\ttimeoutMinutes,\n\t\t\tproxy: proxyParam === 'custom' ? proxyUrl : Boolean(proxyParam === 'integrated'),\n\t\t},\n\t};\n\n\tconst response = await apiRequest.call(this, 'POST', url, body);\n\tconst sessionId = response.sessionId;\n\n\t// validate response\n\tvalidateAirtopApiResponse(this.getNode(), response);\n\n\tif (saveProfileOnTermination) {\n\t\tawait apiRequest.call(\n\t\t\tthis,\n\t\t\t'PUT',\n\t\t\t`/sessions/${sessionId}/save-profile-on-termination/${profileName}`,\n\t\t);\n\t}\n\n\treturn this.helpers.returnJsonArray({ sessionId } as IDataObject);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,uBAAgC;AAChC,8BAMO;AACP,uBAA2B;AAC3B,oBAAiC;AAE1B,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,GAAG;AAAA,IACH,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,SAAS;AAAA,QACpB,WAAW,CAAC,QAAQ;AAAA,MACrB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACC;AAAA,IACD,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAA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,MAAM;AAC/D,QAAM,WAAW,yCAAiB,KAAK,MAAM,OAAO,UAAU;AAE9D,QAAM,OAAoB;AAAA,IACzB,eAAe;AAAA,MACd;AAAA,MACA;AAAA,MACA,OAAO,eAAe,WAAW,WAAW,QAAQ,eAAe,YAAY;AAAA,IAChF;AAAA,EACD;AAEA,QAAM,WAAW,MAAM,4BAAW,KAAK,MAAM,QAAQ,KAAK,IAAI;AAC9D,QAAM,YAAY,SAAS;AAG3B,yDAA0B,KAAK,QAAQ,GAAG,QAAQ;AAElD,MAAI,0BAA0B;AAC7B,UAAM,4BAAW;AAAA,MAChB;AAAA,MACA;AAAA,MACA,aAAa,SAAS,gCAAgC,WAAW;AAAA,IAClE;AAAA,EACD;AAEA,SAAO,KAAK,QAAQ,gBAAgB,EAAE,UAAU,CAAgB;AACjE;","names":[]}
1
+ {"version":3,"sources":["../../../../../nodes/Airtop/actions/session/create.operation.ts"],"sourcesContent":["import {\n\ttype IDataObject,\n\ttype IExecuteFunctions,\n\ttype INodeExecutionData,\n\ttype INodeProperties,\n} from 'n8n-workflow';\n\nimport { COUNTRIES } from '../../countries';\nimport {\n\tcreateSession,\n\tvalidateProfileName,\n\tvalidateProxy,\n\tvalidateSaveProfileOnTermination,\n\tvalidateTimeoutMinutes,\n} from '../../GenericFunctions';\nimport { apiRequest } from '../../transport';\nimport { profileNameField } from '../common/fields';\n\nconst displayOptions = {\n\tshow: {\n\t\tresource: ['session'],\n\t\toperation: ['create'],\n\t},\n};\n\nconst countryOptions = COUNTRIES.map(({ name, value }) => ({ name, value }));\n\nexport const description: INodeProperties[] = [\n\t{\n\t\t...profileNameField,\n\t\tdisplayOptions,\n\t},\n\t{\n\t\tdisplayName: 'Save Profile',\n\t\tname: 'saveProfileOnTermination',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription:\n\t\t\t'Whether to automatically save the <a href=\"https://docs.airtop.ai/guides/how-to/saving-a-profile\" target=\"_blank\">Airtop profile</a> for this session upon termination',\n\t\tdisplayOptions,\n\t},\n\t{\n\t\tdisplayName: 'Idle Timeout',\n\t\tname: 'timeoutMinutes',\n\t\ttype: 'number',\n\t\tdefault: 10,\n\t\tvalidateType: 'number',\n\t\tdescription: 'Minutes to wait before the session is terminated due to inactivity',\n\t\tdisplayOptions,\n\t},\n\t/**\n\t * Proxy Configuration\n\t */\n\t{\n\t\tdisplayName: 'Proxy',\n\t\tname: 'proxy',\n\t\ttype: 'options',\n\t\tdefault: 'none',\n\t\tdescription: 'Choose how to configure the proxy for this session',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'None',\n\t\t\t\tvalue: 'none',\n\t\t\t\tdescription: 'No proxy will be used',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Integrated',\n\t\t\t\tvalue: 'integrated',\n\t\t\t\tdescription: 'Use Airtop-provided proxy',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Proxy URL',\n\t\t\t\tvalue: 'proxyUrl',\n\t\t\t\tdescription: 'Use a proxy URL to configure the proxy',\n\t\t\t},\n\t\t],\n\t\tdisplayOptions,\n\t},\n\t{\n\t\tdisplayName: 'Proxy Configuration',\n\t\tname: 'proxyConfig',\n\t\ttype: 'collection',\n\t\tdefault: { country: 'US', sticky: true },\n\t\tdescription: 'The Airtop-provided configuration to use for the proxy',\n\t\tplaceholder: 'Add Attribute',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Country',\n\t\t\t\tname: 'country',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'US',\n\t\t\t\tdescription:\n\t\t\t\t\t'The country to use for the proxy. Not all countries are guaranteed to provide a proxy. Learn more <a href=\"https://docs.airtop.ai/api-reference/airtop-api/sessions/create#request.body.configuration.proxy.Proxy.Airtop-Proxy-Configuration.country\" target=\"_blank\">here</a>.',\n\t\t\t\toptions: countryOptions,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Keep Same IP',\n\t\t\t\tname: 'sticky',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: true,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to try to maintain the same IP address for the duration of the session. Airtop can guarantee that the same IP address will be available for up to a maximum of 30 minutes.',\n\t\t\t},\n\t\t],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t...displayOptions.show,\n\t\t\t\tproxy: ['integrated'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Proxy URL',\n\t\tname: 'proxyUrl',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tdescription: 'The URL of the proxy to use',\n\t\tvalidateType: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t...displayOptions.show,\n\t\t\t\tproxy: ['proxyUrl'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Additional Fields',\n\t\tname: 'additionalFields',\n\t\ttype: 'collection',\n\t\tplaceholder: 'Add Field',\n\t\tdefault: {},\n\t\tdisplayOptions,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Auto Solve Captchas',\n\t\t\t\tname: 'solveCaptcha',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to automatically solve <a href=\"https://docs.airtop.ai/guides/how-to/solving-captchas\" target=\"_blank\">captcha challenges</a>',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Extension IDs',\n\t\t\t\tname: 'extensionIds',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. extId1, extId2, ...',\n\t\t\t\tdescription:\n\t\t\t\t\t'Comma-separated extension IDs from the Google Web Store to be loaded into the session. Learn more <a href=\"https://docs.airtop.ai/guides/how-to/using-chrome-extensions\" target=\"_blank\">here</a>.',\n\t\t\t},\n\t\t],\n\t},\n];\n\nexport async function execute(\n\tthis: IExecuteFunctions,\n\tindex: number,\n): Promise<INodeExecutionData[]> {\n\tconst profileName = validateProfileName.call(this, index);\n\tconst timeoutMinutes = validateTimeoutMinutes.call(this, index);\n\tconst saveProfileOnTermination = validateSaveProfileOnTermination.call(this, index, profileName);\n\tconst { proxy } = validateProxy.call(this, index);\n\tconst solveCaptcha = this.getNodeParameter(\n\t\t'additionalFields.solveCaptcha',\n\t\tindex,\n\t\tfalse,\n\t) as boolean;\n\n\tconst extensions = this.getNodeParameter('additionalFields.extensionIds', index, '') as string;\n\tconst extensionIds = extensions ? extensions.split(',').map((id) => id.trim()) : [];\n\n\tconst body: IDataObject = {\n\t\tconfiguration: {\n\t\t\tprofileName,\n\t\t\ttimeoutMinutes,\n\t\t\tproxy,\n\t\t\tsolveCaptcha,\n\t\t\t...(extensionIds.length > 0 ? { extensionIds } : {}),\n\t\t},\n\t};\n\n\tconst { sessionId } = await createSession.call(this, body);\n\n\tif (saveProfileOnTermination) {\n\t\tawait apiRequest.call(\n\t\t\tthis,\n\t\t\t'PUT',\n\t\t\t`/sessions/${sessionId}/save-profile-on-termination/${profileName}`,\n\t\t);\n\t}\n\n\treturn this.helpers.returnJsonArray({ sessionId } as IDataObject);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,uBAA0B;AAC1B,8BAMO;AACP,uBAA2B;AAC3B,oBAAiC;AAEjC,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,UAAU,CAAC,SAAS;AAAA,IACpB,WAAW,CAAC,QAAQ;AAAA,EACrB;AACD;AAEA,MAAM,iBAAiB,2BAAU,IAAI,CAAC,EAAE,MAAM,MAAM,OAAO,EAAE,MAAM,MAAM,EAAE;AAEpE,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,GAAG;AAAA,IACH;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACC;AAAA,IACD;AAAA,EACD;AAAA,EACA;AA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,EAAE,UAAU,CAAgB;AACjE;","names":[]}
@@ -100,7 +100,8 @@ const description = [
100
100
  }
101
101
  },
102
102
  ...create.description,
103
- ...load.description
103
+ ...load.description,
104
+ ...takeScreenshot.description
104
105
  ];
105
106
  // Annotate the CommonJS export names for ESM import in node:
106
107
  0 && (module.exports = {