@n8n/n8n-nodes-langchain 1.115.1 → 1.116.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 (194) hide show
  1. package/dist/credentials/AnthropicApi.credentials.js +39 -8
  2. package/dist/credentials/AnthropicApi.credentials.js.map +1 -1
  3. package/dist/credentials/LemonadeApi.credentials.js +70 -0
  4. package/dist/credentials/LemonadeApi.credentials.js.map +1 -0
  5. package/dist/known/credentials.json +9 -0
  6. package/dist/known/nodes.json +12 -0
  7. package/dist/nodes/agents/Agent/Agent.node.js +1 -2
  8. package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
  9. package/dist/nodes/agents/Agent/V1/AgentV1.node.js +2 -0
  10. package/dist/nodes/agents/Agent/V1/AgentV1.node.js.map +1 -1
  11. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js +13 -1
  12. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js.map +1 -1
  13. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js +49 -30
  14. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js.map +1 -1
  15. package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js +3 -0
  16. package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js.map +1 -1
  17. package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js +87 -0
  18. package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js.map +1 -0
  19. package/dist/nodes/embeddings/EmbeddingsLemonade/lemonade.svg +53 -0
  20. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +17 -0
  21. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
  22. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +12 -8
  23. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
  24. package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js +106 -0
  25. package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js.map +1 -0
  26. package/dist/nodes/llms/LMChatLemonade/lemonade.svg +53 -0
  27. package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js +6 -5
  28. package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js.map +1 -1
  29. package/dist/nodes/llms/LMLemonade/LmLemonade.node.js +107 -0
  30. package/dist/nodes/llms/LMLemonade/LmLemonade.node.js.map +1 -0
  31. package/dist/nodes/llms/LMLemonade/description.js +147 -0
  32. package/dist/nodes/llms/LMLemonade/description.js.map +1 -0
  33. package/dist/nodes/llms/LMLemonade/lemonade.svg +53 -0
  34. package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js +3 -0
  35. package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js.map +1 -1
  36. package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js +14 -1
  37. package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js.map +1 -1
  38. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +107 -47
  39. package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
  40. package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js +2 -1
  41. package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js.map +1 -1
  42. package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js +43 -4
  43. package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js.map +1 -1
  44. package/dist/nodes/vendors/Anthropic/transport/index.js +9 -5
  45. package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -1
  46. package/dist/nodes/vendors/OpenAi/OpenAi.node.js +50 -11
  47. package/dist/nodes/vendors/OpenAi/OpenAi.node.js.map +1 -1
  48. package/dist/nodes/vendors/OpenAi/helpers/binary-data.js +3 -3
  49. package/dist/nodes/vendors/OpenAi/helpers/binary-data.js.map +1 -1
  50. package/dist/nodes/vendors/OpenAi/helpers/description.js +75 -0
  51. package/dist/nodes/vendors/OpenAi/helpers/description.js.map +1 -0
  52. package/dist/nodes/vendors/OpenAi/helpers/interfaces.js.map +1 -1
  53. package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js +34 -0
  54. package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js.map +1 -0
  55. package/dist/nodes/vendors/OpenAi/helpers/polling.js +52 -0
  56. package/dist/nodes/vendors/OpenAi/helpers/polling.js.map +1 -0
  57. package/dist/nodes/vendors/OpenAi/helpers/utils.js +27 -0
  58. package/dist/nodes/vendors/OpenAi/helpers/utils.js.map +1 -1
  59. package/dist/nodes/vendors/OpenAi/methods/listSearch.js +10 -6
  60. package/dist/nodes/vendors/OpenAi/methods/listSearch.js.map +1 -1
  61. package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js +110 -0
  62. package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js.map +1 -0
  63. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/create.operation.js +1 -1
  64. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/create.operation.js.map +1 -0
  65. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/deleteAssistant.operation.js +1 -1
  66. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/deleteAssistant.operation.js.map +1 -0
  67. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/index.js.map +1 -0
  68. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/list.operation.js +1 -1
  69. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/list.operation.js.map +1 -0
  70. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/message.operation.js +5 -5
  71. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js.map +1 -0
  72. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/update.operation.js +1 -1
  73. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/update.operation.js.map +1 -0
  74. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/generate.operation.js +1 -1
  75. package/dist/nodes/vendors/OpenAi/v1/actions/audio/generate.operation.js.map +1 -0
  76. package/dist/nodes/vendors/OpenAi/v1/actions/audio/index.js.map +1 -0
  77. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/transcribe.operation.js +2 -2
  78. package/dist/nodes/vendors/OpenAi/v1/actions/audio/transcribe.operation.js.map +1 -0
  79. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/translate.operation.js +2 -2
  80. package/dist/nodes/vendors/OpenAi/v1/actions/audio/translate.operation.js.map +1 -0
  81. package/dist/nodes/vendors/OpenAi/v1/actions/descriptions.js.map +1 -0
  82. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/deleteFile.operation.js +1 -1
  83. package/dist/nodes/vendors/OpenAi/v1/actions/file/deleteFile.operation.js.map +1 -0
  84. package/dist/nodes/vendors/OpenAi/v1/actions/file/index.js.map +1 -0
  85. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/list.operation.js +1 -1
  86. package/dist/nodes/vendors/OpenAi/v1/actions/file/list.operation.js.map +1 -0
  87. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/upload.operation.js +2 -2
  88. package/dist/nodes/vendors/OpenAi/v1/actions/file/upload.operation.js.map +1 -0
  89. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/analyze.operation.js +1 -1
  90. package/dist/nodes/vendors/OpenAi/v1/actions/image/analyze.operation.js.map +1 -0
  91. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/generate.operation.js +1 -1
  92. package/dist/nodes/vendors/OpenAi/v1/actions/image/generate.operation.js.map +1 -0
  93. package/dist/nodes/vendors/OpenAi/v1/actions/image/index.js.map +1 -0
  94. package/dist/nodes/vendors/OpenAi/v1/actions/node.type.js.map +1 -0
  95. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/router.js +1 -1
  96. package/dist/nodes/vendors/OpenAi/v1/actions/router.js.map +1 -0
  97. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/classify.operation.js +1 -1
  98. package/dist/nodes/vendors/OpenAi/v1/actions/text/classify.operation.js.map +1 -0
  99. package/dist/nodes/vendors/OpenAi/v1/actions/text/index.js.map +1 -0
  100. package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/message.operation.js +4 -4
  101. package/dist/nodes/vendors/OpenAi/v1/actions/text/message.operation.js.map +1 -0
  102. package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js +116 -0
  103. package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js.map +1 -0
  104. package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js +197 -0
  105. package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js.map +1 -0
  106. package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js +96 -0
  107. package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js.map +1 -0
  108. package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js +121 -0
  109. package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js.map +1 -0
  110. package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js +111 -0
  111. package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js.map +1 -0
  112. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js +120 -0
  113. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js.map +1 -0
  114. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js +60 -0
  115. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js.map +1 -0
  116. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js +94 -0
  117. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js.map +1 -0
  118. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js +60 -0
  119. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js.map +1 -0
  120. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js +75 -0
  121. package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js.map +1 -0
  122. package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js +279 -0
  123. package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js.map +1 -0
  124. package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js +84 -0
  125. package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js.map +1 -0
  126. package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js +84 -0
  127. package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js.map +1 -0
  128. package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js +92 -0
  129. package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js.map +1 -0
  130. package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js +130 -0
  131. package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js.map +1 -0
  132. package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js +211 -0
  133. package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js.map +1 -0
  134. package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js +464 -0
  135. package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js.map +1 -0
  136. package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js +319 -0
  137. package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js.map +1 -0
  138. package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js +84 -0
  139. package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js.map +1 -0
  140. package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js +17 -0
  141. package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js.map +1 -0
  142. package/dist/nodes/vendors/OpenAi/v2/actions/router.js +111 -0
  143. package/dist/nodes/vendors/OpenAi/v2/actions/router.js.map +1 -0
  144. package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js +102 -0
  145. package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js.map +1 -0
  146. package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js +277 -0
  147. package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js.map +1 -0
  148. package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js +86 -0
  149. package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js.map +1 -0
  150. package/dist/nodes/vendors/OpenAi/v2/actions/text/message.operation.js +345 -0
  151. package/dist/nodes/vendors/OpenAi/v2/actions/text/message.operation.js.map +1 -0
  152. package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js +777 -0
  153. package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js.map +1 -0
  154. package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js +199 -0
  155. package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js.map +1 -0
  156. package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js +64 -0
  157. package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js.map +1 -0
  158. package/dist/types/credentials.json +2 -1
  159. package/dist/types/nodes.json +10 -6
  160. package/dist/utils/helpers.js +22 -2
  161. package/dist/utils/helpers.js.map +1 -1
  162. package/package.json +16 -12
  163. package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js.map +0 -1
  164. package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.js.map +0 -1
  165. package/dist/nodes/vendors/OpenAi/actions/assistant/index.js.map +0 -1
  166. package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.js.map +0 -1
  167. package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js.map +0 -1
  168. package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js.map +0 -1
  169. package/dist/nodes/vendors/OpenAi/actions/audio/generate.operation.js.map +0 -1
  170. package/dist/nodes/vendors/OpenAi/actions/audio/index.js.map +0 -1
  171. package/dist/nodes/vendors/OpenAi/actions/audio/transcribe.operation.js.map +0 -1
  172. package/dist/nodes/vendors/OpenAi/actions/audio/translate.operation.js.map +0 -1
  173. package/dist/nodes/vendors/OpenAi/actions/descriptions.js.map +0 -1
  174. package/dist/nodes/vendors/OpenAi/actions/file/deleteFile.operation.js.map +0 -1
  175. package/dist/nodes/vendors/OpenAi/actions/file/index.js.map +0 -1
  176. package/dist/nodes/vendors/OpenAi/actions/file/list.operation.js.map +0 -1
  177. package/dist/nodes/vendors/OpenAi/actions/file/upload.operation.js.map +0 -1
  178. package/dist/nodes/vendors/OpenAi/actions/image/analyze.operation.js.map +0 -1
  179. package/dist/nodes/vendors/OpenAi/actions/image/generate.operation.js.map +0 -1
  180. package/dist/nodes/vendors/OpenAi/actions/image/index.js.map +0 -1
  181. package/dist/nodes/vendors/OpenAi/actions/node.type.js.map +0 -1
  182. package/dist/nodes/vendors/OpenAi/actions/router.js.map +0 -1
  183. package/dist/nodes/vendors/OpenAi/actions/text/classify.operation.js.map +0 -1
  184. package/dist/nodes/vendors/OpenAi/actions/text/index.js.map +0 -1
  185. package/dist/nodes/vendors/OpenAi/actions/text/message.operation.js.map +0 -1
  186. package/dist/nodes/vendors/OpenAi/actions/versionDescription.js +0 -160
  187. package/dist/nodes/vendors/OpenAi/actions/versionDescription.js.map +0 -1
  188. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/index.js +0 -0
  189. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/index.js +0 -0
  190. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/descriptions.js +0 -0
  191. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/index.js +0 -0
  192. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/index.js +0 -0
  193. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/node.type.js +0 -0
  194. /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/index.js +0 -0
@@ -0,0 +1,464 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var edit_operation_exports = {};
30
+ __export(edit_operation_exports, {
31
+ description: () => description,
32
+ execute: () => execute,
33
+ properties: () => properties
34
+ });
35
+ module.exports = __toCommonJS(edit_operation_exports);
36
+ var import_form_data = __toESM(require("form-data"));
37
+ var import_n8n_workflow = require("n8n-workflow");
38
+ var import_binary_data = require("../../../helpers/binary-data");
39
+ var import_transport = require("../../../transport");
40
+ const properties = [
41
+ {
42
+ displayName: "Model",
43
+ name: "model",
44
+ type: "options",
45
+ default: "gpt-image-1",
46
+ description: "The model to use for image generation",
47
+ options: [
48
+ {
49
+ name: "DALL\xB7E 2",
50
+ value: "dall-e-2"
51
+ },
52
+ {
53
+ name: "GPT Image 1",
54
+ value: "gpt-image-1"
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ displayName: "Prompt",
60
+ name: "prompt",
61
+ type: "string",
62
+ required: true,
63
+ default: "",
64
+ description: "A text description of the desired image(s). Maximum 1000 characters for dall-e-2, 32000 characters for gpt-image-1.",
65
+ placeholder: "A beautiful sunset over mountains",
66
+ typeOptions: {
67
+ rows: 2
68
+ }
69
+ },
70
+ {
71
+ displayName: "Images",
72
+ name: "images",
73
+ type: "fixedCollection",
74
+ placeholder: "Add Image",
75
+ typeOptions: {
76
+ multipleValues: true,
77
+ multipleValueButtonText: "Add Image"
78
+ },
79
+ default: { values: [{ binaryPropertyName: "data" }] },
80
+ description: "Add one or more binary fields to include images with your prompt. Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 16 images.",
81
+ displayOptions: {
82
+ show: {
83
+ "/model": ["gpt-image-1"]
84
+ }
85
+ },
86
+ options: [
87
+ {
88
+ displayName: "Image",
89
+ name: "values",
90
+ values: [
91
+ {
92
+ displayName: "Binary Field Name",
93
+ name: "binaryPropertyName",
94
+ type: "string",
95
+ default: "data",
96
+ placeholder: "e.g. data",
97
+ description: "The name of the binary field containing the image data"
98
+ }
99
+ ]
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ displayName: "Binary Field Name",
105
+ name: "binaryPropertyName",
106
+ type: "string",
107
+ default: "data",
108
+ placeholder: "e.g. data",
109
+ hint: "The name of the input field containing the binary file data to be processed",
110
+ description: "Name of the binary property which contains the image. It should be a square png file less than 4MB.",
111
+ displayOptions: {
112
+ show: {
113
+ "/model": ["dall-e-2"]
114
+ }
115
+ }
116
+ },
117
+ {
118
+ displayName: "Number of Images",
119
+ name: "n",
120
+ type: "number",
121
+ default: 1,
122
+ description: "The number of images to generate. Must be between 1 and 10.",
123
+ typeOptions: {
124
+ minValue: 1,
125
+ maxValue: 10
126
+ }
127
+ },
128
+ {
129
+ displayName: "Size",
130
+ name: "size",
131
+ type: "options",
132
+ default: "1024x1024",
133
+ description: "The size of the generated images",
134
+ // eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
135
+ options: [
136
+ {
137
+ name: "256x256",
138
+ value: "256x256"
139
+ },
140
+ {
141
+ name: "512x512",
142
+ value: "512x512"
143
+ },
144
+ {
145
+ name: "1024x1024",
146
+ value: "1024x1024"
147
+ },
148
+ {
149
+ name: "1024x1536 (Portrait)",
150
+ value: "1024x1536"
151
+ },
152
+ {
153
+ name: "1536x1024 (Landscape)",
154
+ value: "1536x1024"
155
+ },
156
+ {
157
+ name: "Auto",
158
+ value: "auto"
159
+ }
160
+ ]
161
+ },
162
+ {
163
+ displayName: "Quality",
164
+ name: "quality",
165
+ type: "options",
166
+ default: "auto",
167
+ description: "The quality of the image that will be generated",
168
+ // eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
169
+ options: [
170
+ {
171
+ name: "Auto",
172
+ value: "auto"
173
+ },
174
+ {
175
+ name: "High",
176
+ value: "high"
177
+ },
178
+ {
179
+ name: "Medium",
180
+ value: "medium"
181
+ },
182
+ {
183
+ name: "Low",
184
+ value: "low"
185
+ },
186
+ {
187
+ name: "Standard",
188
+ value: "standard"
189
+ }
190
+ ],
191
+ displayOptions: {
192
+ show: {
193
+ "/model": ["gpt-image-1"]
194
+ }
195
+ }
196
+ },
197
+ {
198
+ displayName: "Response Format",
199
+ name: "responseFormat",
200
+ type: "options",
201
+ default: "url",
202
+ description: "The format in which the generated images are returned. URLs are only valid for 60 minutes after generation.",
203
+ options: [
204
+ {
205
+ name: "URL",
206
+ value: "url"
207
+ },
208
+ {
209
+ name: "Base64 JSON",
210
+ value: "b64_json"
211
+ }
212
+ ],
213
+ displayOptions: {
214
+ show: {
215
+ "/model": ["dall-e-2"]
216
+ }
217
+ }
218
+ },
219
+ {
220
+ displayName: "Output Format",
221
+ name: "outputFormat",
222
+ type: "options",
223
+ default: "png",
224
+ description: "The format in which the generated images are returned. Only supported for gpt-image-1.",
225
+ options: [
226
+ {
227
+ name: "PNG",
228
+ value: "png"
229
+ },
230
+ {
231
+ name: "JPEG",
232
+ value: "jpeg"
233
+ },
234
+ {
235
+ name: "WebP",
236
+ value: "webp"
237
+ }
238
+ ],
239
+ displayOptions: {
240
+ show: {
241
+ "/model": ["gpt-image-1"]
242
+ }
243
+ }
244
+ },
245
+ {
246
+ displayName: "Output Compression",
247
+ name: "outputCompression",
248
+ type: "number",
249
+ default: 100,
250
+ description: "The compression level (0-100%) for the generated images. Only supported for gpt-image-1 with webp or jpeg output formats.",
251
+ typeOptions: {
252
+ minValue: 0,
253
+ maxValue: 100
254
+ },
255
+ displayOptions: {
256
+ show: {
257
+ "/model": ["gpt-image-1"],
258
+ outputFormat: ["webp", "jpeg"]
259
+ }
260
+ }
261
+ },
262
+ {
263
+ displayName: "Options",
264
+ name: "options",
265
+ placeholder: "Add Option",
266
+ type: "collection",
267
+ default: {},
268
+ options: [
269
+ {
270
+ displayName: "User",
271
+ name: "user",
272
+ type: "string",
273
+ default: "",
274
+ description: "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse",
275
+ placeholder: "user-12345"
276
+ },
277
+ {
278
+ displayName: "Background",
279
+ name: "background",
280
+ type: "options",
281
+ default: "auto",
282
+ description: "Allows to set transparency for the background of the generated image(s). Only supported for gpt-image-1.",
283
+ options: [
284
+ {
285
+ name: "Auto",
286
+ value: "auto"
287
+ },
288
+ {
289
+ name: "Transparent",
290
+ value: "transparent"
291
+ },
292
+ {
293
+ name: "Opaque",
294
+ value: "opaque"
295
+ }
296
+ ],
297
+ displayOptions: {
298
+ show: {
299
+ "/model": ["gpt-image-1"]
300
+ }
301
+ }
302
+ },
303
+ {
304
+ displayName: "Input Fidelity",
305
+ name: "inputFidelity",
306
+ type: "options",
307
+ default: "low",
308
+ description: "Control how much effort the model will exert to match the style and features of input images. Only supported for gpt-image-1.",
309
+ options: [
310
+ {
311
+ name: "Low",
312
+ value: "low"
313
+ },
314
+ {
315
+ name: "High",
316
+ value: "high"
317
+ }
318
+ ],
319
+ displayOptions: {
320
+ show: {
321
+ "/model": ["gpt-image-1"]
322
+ }
323
+ }
324
+ },
325
+ {
326
+ displayName: "Image Mask",
327
+ name: "imageMask",
328
+ type: "string",
329
+ default: "data",
330
+ hint: "The name of the input field containing the binary file data to be processed",
331
+ description: "Name of the binary property which contains the image. An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where image should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as image."
332
+ }
333
+ ]
334
+ }
335
+ ];
336
+ const displayOptions = {
337
+ show: {
338
+ operation: ["edit"],
339
+ resource: ["image"]
340
+ }
341
+ };
342
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
343
+ async function execute(i) {
344
+ const model = this.getNodeParameter("model", i);
345
+ const prompt = this.getNodeParameter("prompt", i);
346
+ const options = this.getNodeParameter("options", i, {});
347
+ const isGPTImage1 = model === "gpt-image-1";
348
+ const isDallE2 = model === "dall-e-2";
349
+ const n = this.getNodeParameter("n", i, 1);
350
+ const size = this.getNodeParameter("size", i, "1024x1024");
351
+ const defaultResponseFormat = isGPTImage1 ? "b64_json" : "url";
352
+ const responseFormat = this.getNodeParameter(
353
+ "responseFormat",
354
+ i,
355
+ defaultResponseFormat
356
+ );
357
+ const quality = this.getNodeParameter("quality", i, "auto");
358
+ const formData = new import_form_data.default();
359
+ if (isGPTImage1) {
360
+ const imagesParam = this.getNodeParameter("images", i, {
361
+ values: [{ binaryPropertyName: "data" }]
362
+ });
363
+ const imagesUi = imagesParam.values ?? [];
364
+ const imageFieldNames = imagesUi.map((v) => v.binaryPropertyName).filter((n2) => Boolean(n2));
365
+ for (const fieldName of imageFieldNames) {
366
+ const { fileContent, contentType, filename } = await (0, import_binary_data.getBinaryDataFile)(this, i, fieldName);
367
+ const buffer = await this.helpers.binaryToBuffer(fileContent);
368
+ formData.append("image[]", buffer, {
369
+ filename,
370
+ contentType
371
+ });
372
+ }
373
+ } else {
374
+ const binaryPropertyName = this.getNodeParameter("binaryPropertyName", i);
375
+ const { fileContent, contentType, filename } = await (0, import_binary_data.getBinaryDataFile)(
376
+ this,
377
+ i,
378
+ binaryPropertyName
379
+ );
380
+ const buffer = await this.helpers.binaryToBuffer(fileContent);
381
+ formData.append("image", buffer, {
382
+ filename,
383
+ contentType
384
+ });
385
+ }
386
+ formData.append("prompt", prompt);
387
+ formData.append("model", model);
388
+ if (n) {
389
+ formData.append("n", n.toString());
390
+ }
391
+ if (size) {
392
+ formData.append("size", size);
393
+ }
394
+ if (responseFormat && isDallE2) {
395
+ formData.append("response_format", responseFormat);
396
+ }
397
+ if (options.user) {
398
+ formData.append("user", options.user);
399
+ }
400
+ if (options.background && isGPTImage1) {
401
+ formData.append("background", options.background);
402
+ }
403
+ if (options.inputFidelity && isGPTImage1) {
404
+ formData.append("input_fidelity", options.inputFidelity);
405
+ }
406
+ if (options.outputFormat && isGPTImage1) {
407
+ formData.append("output_format", options.outputFormat);
408
+ }
409
+ if (options.outputCompression !== void 0 && options.outputCompression !== null) {
410
+ formData.append("output_compression", String(Number(options.outputCompression)));
411
+ }
412
+ if (quality && isGPTImage1) {
413
+ formData.append("quality", quality);
414
+ }
415
+ if (options.imageMask && typeof options.imageMask === "string") {
416
+ const { fileContent, contentType, filename } = await (0, import_binary_data.getBinaryDataFile)(
417
+ this,
418
+ i,
419
+ options.imageMask
420
+ );
421
+ const buffer = await this.helpers.binaryToBuffer(fileContent);
422
+ formData.append("mask", buffer, {
423
+ filename,
424
+ contentType
425
+ });
426
+ }
427
+ const response = await import_transport.apiRequest.call(this, "POST", "/images/edits", {
428
+ option: { formData },
429
+ headers: formData.getHeaders()
430
+ });
431
+ const returnData = [];
432
+ if (responseFormat === "url") {
433
+ const data = response.data || [];
434
+ const entries = data.map((entry) => ({
435
+ json: entry,
436
+ pairedItem: { item: i }
437
+ }));
438
+ Array.prototype.push.apply(returnData, entries);
439
+ } else {
440
+ for (const entry of response.data || []) {
441
+ const binaryData = await this.helpers.prepareBinaryData(
442
+ Buffer.from(entry.b64_json, "base64"),
443
+ "data"
444
+ );
445
+ returnData.push({
446
+ json: Object.assign({}, binaryData, {
447
+ data: void 0
448
+ }),
449
+ binary: {
450
+ data: binaryData
451
+ },
452
+ pairedItem: { item: i }
453
+ });
454
+ }
455
+ }
456
+ return returnData;
457
+ }
458
+ // Annotate the CommonJS export names for ESM import in node:
459
+ 0 && (module.exports = {
460
+ description,
461
+ execute,
462
+ properties
463
+ });
464
+ //# sourceMappingURL=edit.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v2/actions/image/edit.operation.ts"],"sourcesContent":["import FormData from 'form-data';\nimport type {\n\tIBinaryData,\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n} from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { getBinaryDataFile } from '../../../helpers/binary-data';\nimport { apiRequest } from '../../../transport';\n\nexport const properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Model',\n\t\tname: 'model',\n\t\ttype: 'options',\n\t\tdefault: 'gpt-image-1',\n\t\tdescription: 'The model to use for image generation',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'DALL·E 2',\n\t\t\t\tvalue: 'dall-e-2',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'GPT Image 1',\n\t\t\t\tvalue: 'gpt-image-1',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Prompt',\n\t\tname: 'prompt',\n\t\ttype: 'string',\n\t\trequired: true,\n\t\tdefault: '',\n\t\tdescription:\n\t\t\t'A text description of the desired image(s). Maximum 1000 characters for dall-e-2, 32000 characters for gpt-image-1.',\n\t\tplaceholder: 'A beautiful sunset over mountains',\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Images',\n\t\tname: 'images',\n\t\ttype: 'fixedCollection',\n\t\tplaceholder: 'Add Image',\n\t\ttypeOptions: {\n\t\t\tmultipleValues: true,\n\t\t\tmultipleValueButtonText: 'Add Image',\n\t\t},\n\t\tdefault: { values: [{ binaryPropertyName: 'data' }] },\n\t\tdescription:\n\t\t\t'Add one or more binary fields to include images with your prompt. Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 16 images.',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Image',\n\t\t\t\tname: 'values',\n\t\t\t\tvalues: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Binary Field Name',\n\t\t\t\t\t\tname: 'binaryPropertyName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: 'data',\n\t\t\t\t\t\tplaceholder: 'e.g. data',\n\t\t\t\t\t\tdescription: 'The name of the binary field containing the image data',\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: 'Binary Field Name',\n\t\tname: 'binaryPropertyName',\n\t\ttype: 'string',\n\t\tdefault: 'data',\n\t\tplaceholder: 'e.g. data',\n\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\tdescription:\n\t\t\t'Name of the binary property which contains the image. It should be a square png file less than 4MB.',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/model': ['dall-e-2'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Number of Images',\n\t\tname: 'n',\n\t\ttype: 'number',\n\t\tdefault: 1,\n\t\tdescription: 'The number of images to generate. Must be between 1 and 10.',\n\t\ttypeOptions: {\n\t\t\tminValue: 1,\n\t\t\tmaxValue: 10,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Size',\n\t\tname: 'size',\n\t\ttype: 'options',\n\t\tdefault: '1024x1024',\n\t\tdescription: 'The size of the generated images',\n\t\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: '256x256',\n\t\t\t\tvalue: '256x256',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: '512x512',\n\t\t\t\tvalue: '512x512',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: '1024x1024',\n\t\t\t\tvalue: '1024x1024',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: '1024x1536 (Portrait)',\n\t\t\t\tvalue: '1024x1536',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: '1536x1024 (Landscape)',\n\t\t\t\tvalue: '1536x1024',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Auto',\n\t\t\t\tvalue: 'auto',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'Quality',\n\t\tname: 'quality',\n\t\ttype: 'options',\n\t\tdefault: 'auto',\n\t\tdescription: 'The quality of the image that will be generated',\n\t\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Auto',\n\t\t\t\tvalue: 'auto',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'High',\n\t\t\t\tvalue: 'high',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Medium',\n\t\t\t\tvalue: 'medium',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Low',\n\t\t\t\tvalue: 'low',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Standard',\n\t\t\t\tvalue: 'standard',\n\t\t\t},\n\t\t],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Response Format',\n\t\tname: 'responseFormat',\n\t\ttype: 'options',\n\t\tdefault: 'url',\n\t\tdescription:\n\t\t\t'The format in which the generated images are returned. URLs are only valid for 60 minutes after generation.',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'URL',\n\t\t\t\tvalue: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Base64 JSON',\n\t\t\t\tvalue: 'b64_json',\n\t\t\t},\n\t\t],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/model': ['dall-e-2'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Output Format',\n\t\tname: 'outputFormat',\n\t\ttype: 'options',\n\t\tdefault: 'png',\n\t\tdescription:\n\t\t\t'The format in which the generated images are returned. Only supported for gpt-image-1.',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'PNG',\n\t\t\t\tvalue: 'png',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'JPEG',\n\t\t\t\tvalue: 'jpeg',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'WebP',\n\t\t\t\tvalue: 'webp',\n\t\t\t},\n\t\t],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Output Compression',\n\t\tname: 'outputCompression',\n\t\ttype: 'number',\n\t\tdefault: 100,\n\t\tdescription:\n\t\t\t'The compression level (0-100%) for the generated images. Only supported for gpt-image-1 with webp or jpeg output formats.',\n\t\ttypeOptions: {\n\t\t\tminValue: 0,\n\t\t\tmaxValue: 100,\n\t\t},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t\toutputFormat: ['webp', 'jpeg'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\tplaceholder: 'Add Option',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'User',\n\t\t\t\tname: 'user',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tdescription:\n\t\t\t\t\t'A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse',\n\t\t\t\tplaceholder: 'user-12345',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Background',\n\t\t\t\tname: 'background',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'auto',\n\t\t\t\tdescription:\n\t\t\t\t\t'Allows to set transparency for the background of the generated image(s). Only supported for gpt-image-1.',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Auto',\n\t\t\t\t\t\tvalue: 'auto',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Transparent',\n\t\t\t\t\t\tvalue: 'transparent',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Opaque',\n\t\t\t\t\t\tvalue: 'opaque',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Input Fidelity',\n\t\t\t\tname: 'inputFidelity',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'low',\n\t\t\t\tdescription:\n\t\t\t\t\t'Control how much effort the model will exert to match the style and features of input images. Only supported for gpt-image-1.',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Low',\n\t\t\t\t\t\tvalue: 'low',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'High',\n\t\t\t\t\t\tvalue: 'high',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/model': ['gpt-image-1'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Image Mask',\n\t\t\t\tname: 'imageMask',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: 'data',\n\t\t\t\thint: 'The name of the input field containing the binary file data to be processed',\n\t\t\t\tdescription:\n\t\t\t\t\t'Name of the binary property which contains the image. An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where image should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as image.',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['edit'],\n\t\tresource: ['image'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst model = this.getNodeParameter('model', i);\n\tconst prompt = this.getNodeParameter('prompt', i);\n\tconst options = this.getNodeParameter('options', i, {});\n\n\tconst isGPTImage1 = model === 'gpt-image-1';\n\tconst isDallE2 = model === 'dall-e-2';\n\n\tconst n = this.getNodeParameter('n', i, 1) as number;\n\tconst size = this.getNodeParameter('size', i, '1024x1024') as string;\n\tconst defaultResponseFormat = isGPTImage1 ? 'b64_json' : 'url';\n\tconst responseFormat = this.getNodeParameter(\n\t\t'responseFormat',\n\t\ti,\n\t\tdefaultResponseFormat,\n\t) as string;\n\tconst quality = this.getNodeParameter('quality', i, 'auto') as string;\n\n\tconst formData = new FormData();\n\n\tif (isGPTImage1) {\n\t\tconst imagesParam = this.getNodeParameter('images', i, {\n\t\t\tvalues: [{ binaryPropertyName: 'data' }],\n\t\t}) as { values: Array<{ binaryPropertyName: string | IBinaryData }> };\n\n\t\tconst imagesUi = imagesParam.values ?? [];\n\t\tconst imageFieldNames = imagesUi.map((v) => v.binaryPropertyName).filter((n) => Boolean(n));\n\n\t\tfor (const fieldName of imageFieldNames) {\n\t\t\tconst { fileContent, contentType, filename } = await getBinaryDataFile(this, i, fieldName);\n\t\t\tconst buffer = await this.helpers.binaryToBuffer(fileContent);\n\t\t\tformData.append('image[]', buffer, {\n\t\t\t\tfilename,\n\t\t\t\tcontentType,\n\t\t\t});\n\t\t}\n\t} else {\n\t\tconst binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);\n\t\tconst { fileContent, contentType, filename } = await getBinaryDataFile(\n\t\t\tthis,\n\t\t\ti,\n\t\t\tbinaryPropertyName,\n\t\t);\n\t\tconst buffer = await this.helpers.binaryToBuffer(fileContent);\n\t\tformData.append('image', buffer, {\n\t\t\tfilename,\n\t\t\tcontentType,\n\t\t});\n\t}\n\n\tformData.append('prompt', prompt);\n\tformData.append('model', model);\n\n\tif (n) {\n\t\tformData.append('n', n.toString());\n\t}\n\tif (size) {\n\t\tformData.append('size', size);\n\t}\n\tif (responseFormat && isDallE2) {\n\t\tformData.append('response_format', responseFormat);\n\t}\n\tif (options.user) {\n\t\tformData.append('user', options.user as string);\n\t}\n\tif (options.background && isGPTImage1) {\n\t\tformData.append('background', options.background as string);\n\t}\n\tif (options.inputFidelity && isGPTImage1) {\n\t\tformData.append('input_fidelity', options.inputFidelity as string);\n\t}\n\tif (options.outputFormat && isGPTImage1) {\n\t\tformData.append('output_format', options.outputFormat as string);\n\t}\n\tif (options.outputCompression !== undefined && options.outputCompression !== null) {\n\t\tformData.append('output_compression', String(Number(options.outputCompression)));\n\t}\n\tif (quality && isGPTImage1) {\n\t\tformData.append('quality', quality);\n\t}\n\n\tif (options.imageMask && typeof options.imageMask === 'string') {\n\t\tconst { fileContent, contentType, filename } = await getBinaryDataFile(\n\t\t\tthis,\n\t\t\ti,\n\t\t\toptions.imageMask,\n\t\t);\n\t\tconst buffer = await this.helpers.binaryToBuffer(fileContent);\n\t\tformData.append('mask', buffer, {\n\t\t\tfilename,\n\t\t\tcontentType,\n\t\t});\n\t}\n\n\tconst response = (await apiRequest.call(this, 'POST', '/images/edits', {\n\t\toption: { formData },\n\t\theaders: formData.getHeaders(),\n\t})) as IDataObject;\n\n\tconst returnData: INodeExecutionData[] = [];\n\n\tif (responseFormat === 'url') {\n\t\tconst data = (response.data as IDataObject[]) || [];\n\t\tconst entries = data.map((entry) => ({\n\t\t\tjson: entry,\n\t\t\tpairedItem: { item: i },\n\t\t}));\n\t\tArray.prototype.push.apply(returnData, entries);\n\t} else {\n\t\tfor (const entry of (response.data as IDataObject[]) || []) {\n\t\t\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\t\t\tBuffer.from(entry.b64_json as string, 'base64'),\n\t\t\t\t'data',\n\t\t\t);\n\t\t\treturnData.push({\n\t\t\t\tjson: Object.assign({}, binaryData, {\n\t\t\t\t\tdata: undefined,\n\t\t\t\t}),\n\t\t\t\tbinary: {\n\t\t\t\t\tdata: binaryData,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t});\n\t\t}\n\t}\n\treturn returnData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB;AAQrB,0BAAqC;AAErC,yBAAkC;AAClC,uBAA2B;AAEpB,MAAM,aAAgC;AAAA,EAC5C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,IACT,aACC;AAAA,IACD,aAAa;AAAA,IACb,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;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