@n8n/n8n-nodes-langchain 1.101.2 → 1.102.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 (108) hide show
  1. package/dist/credentials/CohereApi.credentials.js +7 -1
  2. package/dist/credentials/CohereApi.credentials.js.map +1 -1
  3. package/dist/known/credentials.json +2 -0
  4. package/dist/known/nodes.json +12 -0
  5. package/dist/nodes/agents/Agent/Agent.node.js +1 -0
  6. package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
  7. package/dist/nodes/agents/Agent/AgentTool.node.js +57 -0
  8. package/dist/nodes/agents/Agent/AgentTool.node.js.map +1 -0
  9. package/dist/nodes/agents/Agent/V2/AgentToolV2.node.js +104 -0
  10. package/dist/nodes/agents/Agent/V2/AgentToolV2.node.js.map +1 -0
  11. package/dist/nodes/agents/Agent/V2/AgentV2.node.js +4 -66
  12. package/dist/nodes/agents/Agent/V2/AgentV2.node.js.map +1 -1
  13. package/dist/nodes/agents/Agent/V2/utils.js +92 -0
  14. package/dist/nodes/agents/Agent/V2/utils.js.map +1 -0
  15. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/description.js +13 -10
  16. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/description.js.map +1 -1
  17. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js +14 -7
  18. package/dist/nodes/agents/Agent/agents/ToolsAgent/V2/execute.js.map +1 -1
  19. package/dist/nodes/agents/Agent/agents/ToolsAgent/common.js.map +1 -1
  20. package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js +1 -1
  21. package/dist/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.js.map +1 -1
  22. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +6 -0
  23. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
  24. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +2 -2
  25. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
  26. package/dist/nodes/llms/LmChatCohere/LmChatCohere.node.js +181 -0
  27. package/dist/nodes/llms/LmChatCohere/LmChatCohere.node.js.map +1 -0
  28. package/dist/nodes/llms/LmChatCohere/cohere.dark.svg +5 -0
  29. package/dist/nodes/llms/LmChatCohere/cohere.svg +5 -0
  30. package/dist/nodes/llms/N8nLlmTracing.js +4 -4
  31. package/dist/nodes/llms/N8nLlmTracing.js.map +1 -1
  32. package/dist/nodes/mcp/McpTrigger/McpTrigger.node.js +1 -1
  33. package/dist/nodes/mcp/McpTrigger/McpTrigger.node.js.map +1 -1
  34. package/dist/nodes/tools/ToolCode/ToolCode.node.js +1 -2
  35. package/dist/nodes/tools/ToolCode/ToolCode.node.js.map +1 -1
  36. package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js +1 -2
  37. package/dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js.map +1 -1
  38. package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js +2 -2
  39. package/dist/nodes/tools/ToolWorkflow/v2/ToolWorkflowV2.node.js.map +1 -1
  40. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +2 -1
  41. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -1
  42. package/dist/nodes/trigger/ChatTrigger/templates.js +3 -1
  43. package/dist/nodes/trigger/ChatTrigger/templates.js.map +1 -1
  44. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js +2 -1
  45. package/dist/nodes/vector_store/shared/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -1
  46. package/dist/nodes/vendors/GoogleGemini/GoogleGemini.node.js +42 -0
  47. package/dist/nodes/vendors/GoogleGemini/GoogleGemini.node.js.map +1 -0
  48. package/dist/nodes/vendors/GoogleGemini/actions/audio/analyze.operation.js +125 -0
  49. package/dist/nodes/vendors/GoogleGemini/actions/audio/analyze.operation.js.map +1 -0
  50. package/dist/nodes/vendors/GoogleGemini/actions/audio/index.js +74 -0
  51. package/dist/nodes/vendors/GoogleGemini/actions/audio/index.js.map +1 -0
  52. package/dist/nodes/vendors/GoogleGemini/actions/audio/transcribe.operation.js +184 -0
  53. package/dist/nodes/vendors/GoogleGemini/actions/audio/transcribe.operation.js.map +1 -0
  54. package/dist/nodes/vendors/GoogleGemini/actions/descriptions.js +52 -0
  55. package/dist/nodes/vendors/GoogleGemini/actions/descriptions.js.map +1 -0
  56. package/dist/nodes/vendors/GoogleGemini/actions/document/analyze.operation.js +125 -0
  57. package/dist/nodes/vendors/GoogleGemini/actions/document/analyze.operation.js.map +1 -0
  58. package/dist/nodes/vendors/GoogleGemini/actions/document/index.js +64 -0
  59. package/dist/nodes/vendors/GoogleGemini/actions/document/index.js.map +1 -0
  60. package/dist/nodes/vendors/GoogleGemini/actions/file/index.js +64 -0
  61. package/dist/nodes/vendors/GoogleGemini/actions/file/index.js.map +1 -0
  62. package/dist/nodes/vendors/GoogleGemini/actions/file/upload.operation.js +119 -0
  63. package/dist/nodes/vendors/GoogleGemini/actions/file/upload.operation.js.map +1 -0
  64. package/dist/nodes/vendors/GoogleGemini/actions/image/analyze.operation.js +125 -0
  65. package/dist/nodes/vendors/GoogleGemini/actions/image/analyze.operation.js.map +1 -0
  66. package/dist/nodes/vendors/GoogleGemini/actions/image/generate.operation.js +167 -0
  67. package/dist/nodes/vendors/GoogleGemini/actions/image/generate.operation.js.map +1 -0
  68. package/dist/nodes/vendors/GoogleGemini/actions/image/index.js +74 -0
  69. package/dist/nodes/vendors/GoogleGemini/actions/image/index.js.map +1 -0
  70. package/dist/nodes/vendors/GoogleGemini/actions/node.type.js +17 -0
  71. package/dist/nodes/vendors/GoogleGemini/actions/node.type.js.map +1 -0
  72. package/dist/nodes/vendors/GoogleGemini/actions/router.js +97 -0
  73. package/dist/nodes/vendors/GoogleGemini/actions/router.js.map +1 -0
  74. package/dist/nodes/vendors/GoogleGemini/actions/text/index.js +64 -0
  75. package/dist/nodes/vendors/GoogleGemini/actions/text/index.js.map +1 -0
  76. package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js +339 -0
  77. package/dist/nodes/vendors/GoogleGemini/actions/text/message.operation.js.map +1 -0
  78. package/dist/nodes/vendors/GoogleGemini/actions/versionDescription.js +131 -0
  79. package/dist/nodes/vendors/GoogleGemini/actions/versionDescription.js.map +1 -0
  80. package/dist/nodes/vendors/GoogleGemini/actions/video/analyze.operation.js +125 -0
  81. package/dist/nodes/vendors/GoogleGemini/actions/video/analyze.operation.js.map +1 -0
  82. package/dist/nodes/vendors/GoogleGemini/actions/video/download.operation.js +88 -0
  83. package/dist/nodes/vendors/GoogleGemini/actions/video/download.operation.js.map +1 -0
  84. package/dist/nodes/vendors/GoogleGemini/actions/video/generate.operation.js +228 -0
  85. package/dist/nodes/vendors/GoogleGemini/actions/video/generate.operation.js.map +1 -0
  86. package/dist/nodes/vendors/GoogleGemini/actions/video/index.js +84 -0
  87. package/dist/nodes/vendors/GoogleGemini/actions/video/index.js.map +1 -0
  88. package/dist/nodes/vendors/GoogleGemini/gemini.svg +1 -0
  89. package/dist/nodes/vendors/GoogleGemini/helpers/baseAnalyze.js +100 -0
  90. package/dist/nodes/vendors/GoogleGemini/helpers/baseAnalyze.js.map +1 -0
  91. package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js +17 -0
  92. package/dist/nodes/vendors/GoogleGemini/helpers/interfaces.js.map +1 -0
  93. package/dist/nodes/vendors/GoogleGemini/helpers/utils.js +91 -0
  94. package/dist/nodes/vendors/GoogleGemini/helpers/utils.js.map +1 -0
  95. package/dist/nodes/vendors/GoogleGemini/methods/index.js +39 -0
  96. package/dist/nodes/vendors/GoogleGemini/methods/index.js.map +1 -0
  97. package/dist/nodes/vendors/GoogleGemini/methods/listSearch.js +74 -0
  98. package/dist/nodes/vendors/GoogleGemini/methods/listSearch.js.map +1 -0
  99. package/dist/nodes/vendors/GoogleGemini/transport/index.js +48 -0
  100. package/dist/nodes/vendors/GoogleGemini/transport/index.js.map +1 -0
  101. package/dist/types/credentials.json +2 -2
  102. package/dist/types/nodes.json +4 -1
  103. package/dist/utils/descriptions.js +13 -2
  104. package/dist/utils/descriptions.js.map +1 -1
  105. package/dist/utils/helpers.js +2 -7
  106. package/dist/utils/helpers.js.map +1 -1
  107. package/dist/utils/output_parsers/N8nOutputParser.js.map +1 -1
  108. package/package.json +10 -6
@@ -0,0 +1,125 @@
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 analyze_operation_exports = {};
20
+ __export(analyze_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(analyze_operation_exports);
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_baseAnalyze = require("../../helpers/baseAnalyze");
27
+ var import_descriptions = require("../descriptions");
28
+ const properties = [
29
+ (0, import_descriptions.modelRLC)("modelSearch"),
30
+ {
31
+ displayName: "Text Input",
32
+ name: "text",
33
+ type: "string",
34
+ placeholder: "e.g. What's in this image?",
35
+ default: "What's in this image?",
36
+ typeOptions: {
37
+ rows: 2
38
+ }
39
+ },
40
+ {
41
+ displayName: "Input Type",
42
+ name: "inputType",
43
+ type: "options",
44
+ default: "url",
45
+ options: [
46
+ {
47
+ name: "Image URL(s)",
48
+ value: "url"
49
+ },
50
+ {
51
+ name: "Binary File(s)",
52
+ value: "binary"
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ displayName: "URL(s)",
58
+ name: "imageUrls",
59
+ type: "string",
60
+ placeholder: "e.g. https://example.com/image.png",
61
+ description: "URL(s) of the image(s) to analyze, multiple URLs can be added separated by comma",
62
+ default: "",
63
+ displayOptions: {
64
+ show: {
65
+ inputType: ["url"]
66
+ }
67
+ }
68
+ },
69
+ {
70
+ displayName: "Input Data Field Name(s)",
71
+ name: "binaryPropertyName",
72
+ type: "string",
73
+ default: "data",
74
+ placeholder: "e.g. data",
75
+ hint: "The name of the input field containing the binary file data to be processed",
76
+ description: "Name of the binary field(s) which contains the image(s), separate multiple field names with commas",
77
+ displayOptions: {
78
+ show: {
79
+ inputType: ["binary"]
80
+ }
81
+ }
82
+ },
83
+ {
84
+ displayName: "Simplify Output",
85
+ name: "simplify",
86
+ type: "boolean",
87
+ default: true,
88
+ description: "Whether to simplify the response or not"
89
+ },
90
+ {
91
+ displayName: "Options",
92
+ name: "options",
93
+ placeholder: "Add Option",
94
+ type: "collection",
95
+ default: {},
96
+ options: [
97
+ {
98
+ displayName: "Length of Description (Max Tokens)",
99
+ description: "Fewer tokens will result in shorter, less detailed image description",
100
+ name: "maxOutputTokens",
101
+ type: "number",
102
+ default: 300,
103
+ typeOptions: {
104
+ minValue: 1
105
+ }
106
+ }
107
+ ]
108
+ }
109
+ ];
110
+ const displayOptions = {
111
+ show: {
112
+ operation: ["analyze"],
113
+ resource: ["image"]
114
+ }
115
+ };
116
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
117
+ async function execute(i) {
118
+ return await import_baseAnalyze.baseAnalyze.call(this, i, "imageUrls", "image/png");
119
+ }
120
+ // Annotate the CommonJS export names for ESM import in node:
121
+ 0 && (module.exports = {
122
+ description,
123
+ execute
124
+ });
125
+ //# sourceMappingURL=analyze.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/image/analyze.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { baseAnalyze } from '../../helpers/baseAnalyze';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC('modelSearch'),\n\t{\n\t\tdisplayName: 'Text Input',\n\t\tname: 'text',\n\t\ttype: 'string',\n\t\tplaceholder: \"e.g. What's in this image?\",\n\t\tdefault: \"What's in this image?\",\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Type',\n\t\tname: 'inputType',\n\t\ttype: 'options',\n\t\tdefault: 'url',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Image URL(s)',\n\t\t\t\tvalue: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Binary File(s)',\n\t\t\t\tvalue: 'binary',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tdisplayName: 'URL(s)',\n\t\tname: 'imageUrls',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://example.com/image.png',\n\t\tdescription: 'URL(s) of the image(s) to analyze, multiple URLs can be added separated by comma',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['url'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Data Field Name(s)',\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 field(s) which contains the image(s), separate multiple field names with commas',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tinputType: ['binary'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Simplify Output',\n\t\tname: 'simplify',\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t\tdescription: 'Whether to simplify the response or not',\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: 'Length of Description (Max Tokens)',\n\t\t\t\tdescription: 'Fewer tokens will result in shorter, less detailed image description',\n\t\t\t\tname: 'maxOutputTokens',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 300,\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['analyze'],\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\treturn await baseAnalyze.call(this, i, 'imageUrls', 'image/png');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,yBAA4B;AAC5B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,MACrC,8BAAS,aAAa;AAAA,EACtB;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,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,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,KAAK;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aACC;AAAA,IACD,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,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,aAAa;AAAA,EACd;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,UACZ,UAAU;AAAA,QACX;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,SAAS;AAAA,IACrB,UAAU,CAAC,OAAO;AAAA,EACnB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,SAAO,MAAM,+BAAY,KAAK,MAAM,GAAG,aAAa,WAAW;AAChE;","names":[]}
@@ -0,0 +1,167 @@
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 generate_operation_exports = {};
20
+ __export(generate_operation_exports, {
21
+ description: () => description,
22
+ execute: () => execute
23
+ });
24
+ module.exports = __toCommonJS(generate_operation_exports);
25
+ var import_n8n_workflow = require("n8n-workflow");
26
+ var import_transport = require("../../transport");
27
+ var import_descriptions = require("../descriptions");
28
+ const properties = [
29
+ (0, import_descriptions.modelRLC)("imageGenerationModelSearch"),
30
+ {
31
+ displayName: "Prompt",
32
+ name: "prompt",
33
+ type: "string",
34
+ placeholder: "e.g. A cute cat eating a dinosaur",
35
+ description: "A text description of the desired image(s)",
36
+ default: "",
37
+ typeOptions: {
38
+ rows: 2
39
+ }
40
+ },
41
+ {
42
+ displayName: "Options",
43
+ name: "options",
44
+ placeholder: "Add Option",
45
+ type: "collection",
46
+ default: {},
47
+ options: [
48
+ {
49
+ displayName: "Number of Images",
50
+ name: "sampleCount",
51
+ default: 1,
52
+ description: "Number of images to generate. Not supported by Gemini models, supported by Imagen models.",
53
+ type: "number",
54
+ typeOptions: {
55
+ minValue: 1
56
+ }
57
+ },
58
+ {
59
+ displayName: "Put Output in Field",
60
+ name: "binaryPropertyOutput",
61
+ type: "string",
62
+ default: "data",
63
+ hint: "The name of the output field to put the binary file data in"
64
+ }
65
+ ]
66
+ }
67
+ ];
68
+ const displayOptions = {
69
+ show: {
70
+ operation: ["generate"],
71
+ resource: ["image"]
72
+ }
73
+ };
74
+ const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
75
+ async function execute(i) {
76
+ const model = this.getNodeParameter("modelId", i, "", { extractValue: true });
77
+ const prompt = this.getNodeParameter("prompt", i, "");
78
+ const binaryPropertyOutput = this.getNodeParameter(
79
+ "options.binaryPropertyOutput",
80
+ i,
81
+ "data"
82
+ );
83
+ if (model.includes("gemini")) {
84
+ const generationConfig = {
85
+ responseModalities: ["IMAGE", "TEXT"]
86
+ };
87
+ const body = {
88
+ contents: [
89
+ {
90
+ role: "user",
91
+ parts: [{ text: prompt }]
92
+ }
93
+ ],
94
+ generationConfig
95
+ };
96
+ const response = await import_transport.apiRequest.call(this, "POST", `/v1beta/${model}:generateContent`, {
97
+ body
98
+ });
99
+ const promises = response.candidates.map(async (candidate) => {
100
+ const imagePart = candidate.content.parts.find((part) => "inlineData" in part);
101
+ const buffer = Buffer.from(imagePart?.inlineData.data ?? "", "base64");
102
+ const binaryData = await this.helpers.prepareBinaryData(
103
+ buffer,
104
+ "image.png",
105
+ imagePart?.inlineData.mimeType
106
+ );
107
+ return {
108
+ binary: {
109
+ [binaryPropertyOutput]: binaryData
110
+ },
111
+ json: {
112
+ ...binaryData,
113
+ data: void 0
114
+ },
115
+ pairedItem: { item: i }
116
+ };
117
+ });
118
+ return await Promise.all(promises);
119
+ } else if (model.includes("imagen")) {
120
+ const sampleCount = this.getNodeParameter("options.sampleCount", i, 1);
121
+ const body = {
122
+ instances: [
123
+ {
124
+ prompt
125
+ }
126
+ ],
127
+ parameters: {
128
+ sampleCount
129
+ }
130
+ };
131
+ const response = await import_transport.apiRequest.call(this, "POST", `/v1beta/${model}:predict`, {
132
+ body
133
+ });
134
+ const promises = response.predictions.map(async (prediction) => {
135
+ const buffer = Buffer.from(prediction.bytesBase64Encoded ?? "", "base64");
136
+ const binaryData = await this.helpers.prepareBinaryData(
137
+ buffer,
138
+ "image.png",
139
+ prediction.mimeType
140
+ );
141
+ return {
142
+ binary: {
143
+ [binaryPropertyOutput]: binaryData
144
+ },
145
+ json: {
146
+ ...binaryData,
147
+ data: void 0
148
+ },
149
+ pairedItem: { item: i }
150
+ };
151
+ });
152
+ return await Promise.all(promises);
153
+ }
154
+ throw new import_n8n_workflow.NodeOperationError(
155
+ this.getNode(),
156
+ `Model ${model} is not supported for image generation`,
157
+ {
158
+ description: "Please check the model ID and try again."
159
+ }
160
+ );
161
+ }
162
+ // Annotate the CommonJS export names for ESM import in node:
163
+ 0 && (module.exports = {
164
+ description,
165
+ execute
166
+ });
167
+ //# sourceMappingURL=generate.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/image/generate.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { NodeOperationError, updateDisplayOptions } from 'n8n-workflow';\n\nimport type { GenerateContentResponse, ImagenResponse } from '../../helpers/interfaces';\nimport { apiRequest } from '../../transport';\nimport { modelRLC } from '../descriptions';\n\nconst properties: INodeProperties[] = [\n\tmodelRLC('imageGenerationModelSearch'),\n\t{\n\t\tdisplayName: 'Prompt',\n\t\tname: 'prompt',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. A cute cat eating a dinosaur',\n\t\tdescription: 'A text description of the desired image(s)',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 2,\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: 'Number of Images',\n\t\t\t\tname: 'sampleCount',\n\t\t\t\tdefault: 1,\n\t\t\t\tdescription:\n\t\t\t\t\t'Number of images to generate. Not supported by Gemini models, supported by Imagen models.',\n\t\t\t\ttype: 'number',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tminValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Put Output in Field',\n\t\t\t\tname: 'binaryPropertyOutput',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: 'data',\n\t\t\t\thint: 'The name of the output field to put the binary file data in',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['generate'],\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('modelId', i, '', { extractValue: true }) as string;\n\tconst prompt = this.getNodeParameter('prompt', i, '') as string;\n\tconst binaryPropertyOutput = this.getNodeParameter(\n\t\t'options.binaryPropertyOutput',\n\t\ti,\n\t\t'data',\n\t) as string;\n\n\tif (model.includes('gemini')) {\n\t\tconst generationConfig = {\n\t\t\tresponseModalities: ['IMAGE', 'TEXT'],\n\t\t};\n\t\tconst body = {\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\trole: 'user',\n\t\t\t\t\tparts: [{ text: prompt }],\n\t\t\t\t},\n\t\t\t],\n\t\t\tgenerationConfig,\n\t\t};\n\n\t\tconst response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:generateContent`, {\n\t\t\tbody,\n\t\t})) as GenerateContentResponse;\n\t\tconst promises = response.candidates.map(async (candidate) => {\n\t\t\tconst imagePart = candidate.content.parts.find((part) => 'inlineData' in part);\n\t\t\tconst buffer = Buffer.from(imagePart?.inlineData.data ?? '', 'base64');\n\t\t\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\t\t\tbuffer,\n\t\t\t\t'image.png',\n\t\t\t\timagePart?.inlineData.mimeType,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tbinary: {\n\t\t\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\t...binaryData,\n\t\t\t\t\tdata: undefined,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t};\n\t\t});\n\n\t\treturn await Promise.all(promises);\n\t} else if (model.includes('imagen')) {\n\t\t// Imagen models use a different endpoint and request/response structure\n\t\tconst sampleCount = this.getNodeParameter('options.sampleCount', i, 1) as number;\n\t\tconst body = {\n\t\t\tinstances: [\n\t\t\t\t{\n\t\t\t\t\tprompt,\n\t\t\t\t},\n\t\t\t],\n\t\t\tparameters: {\n\t\t\t\tsampleCount,\n\t\t\t},\n\t\t};\n\t\tconst response = (await apiRequest.call(this, 'POST', `/v1beta/${model}:predict`, {\n\t\t\tbody,\n\t\t})) as ImagenResponse;\n\n\t\tconst promises = response.predictions.map(async (prediction) => {\n\t\t\tconst buffer = Buffer.from(prediction.bytesBase64Encoded ?? '', 'base64');\n\t\t\tconst binaryData = await this.helpers.prepareBinaryData(\n\t\t\t\tbuffer,\n\t\t\t\t'image.png',\n\t\t\t\tprediction.mimeType,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tbinary: {\n\t\t\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\t...binaryData,\n\t\t\t\t\tdata: undefined,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t};\n\t\t});\n\n\t\treturn await Promise.all(promises);\n\t}\n\n\tthrow new NodeOperationError(\n\t\tthis.getNode(),\n\t\t`Model ${model} is not supported for image generation`,\n\t\t{\n\t\t\tdescription: 'Please check the model ID and try again.',\n\t\t},\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAyD;AAGzD,uBAA2B;AAC3B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,MACrC,8BAAS,4BAA4B;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,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AAQ;AAAA,IACb,SAAS,KAAK;AAAA,IACd;AAAA,MACC,aAAa;AAAA,IACd;AAAA,EACD;AACD;","names":[]}
@@ -0,0 +1,74 @@
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 image_exports = {};
30
+ __export(image_exports, {
31
+ analyze: () => analyze,
32
+ description: () => description,
33
+ generate: () => generate
34
+ });
35
+ module.exports = __toCommonJS(image_exports);
36
+ var analyze = __toESM(require("./analyze.operation"));
37
+ var generate = __toESM(require("./generate.operation"));
38
+ const description = [
39
+ {
40
+ displayName: "Operation",
41
+ name: "operation",
42
+ type: "options",
43
+ noDataExpression: true,
44
+ options: [
45
+ {
46
+ name: "Analyze Image",
47
+ value: "analyze",
48
+ action: "Analyze image",
49
+ description: "Take in images and answer questions about them"
50
+ },
51
+ {
52
+ name: "Generate an Image",
53
+ value: "generate",
54
+ action: "Generate an image",
55
+ description: "Creates an image from a text prompt"
56
+ }
57
+ ],
58
+ default: "generate",
59
+ displayOptions: {
60
+ show: {
61
+ resource: ["image"]
62
+ }
63
+ }
64
+ },
65
+ ...analyze.description,
66
+ ...generate.description
67
+ ];
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ analyze,
71
+ description,
72
+ generate
73
+ });
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/image/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as analyze from './analyze.operation';\nimport * as generate from './generate.operation';\n\nexport { analyze, generate };\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Analyze Image',\n\t\t\t\tvalue: 'analyze',\n\t\t\t\taction: 'Analyze image',\n\t\t\t\tdescription: 'Take in images and answer questions about them',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Generate an Image',\n\t\t\t\tvalue: 'generate',\n\t\t\t\taction: 'Generate an image',\n\t\t\t\tdescription: 'Creates an image from a text prompt',\n\t\t\t},\n\t\t],\n\t\tdefault: 'generate',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['image'],\n\t\t\t},\n\t\t},\n\t},\n\t...analyze.description,\n\t...generate.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,cAAyB;AACzB,eAA0B;AAInB,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,IACD;AAAA,IACA,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,OAAO;AAAA,MACnB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,QAAQ;AAAA,EACX,GAAG,SAAS;AACb;","names":[]}
@@ -0,0 +1,17 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var node_type_exports = {};
16
+ module.exports = __toCommonJS(node_type_exports);
17
+ //# sourceMappingURL=node.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/node.type.ts"],"sourcesContent":["import type { AllEntities } from 'n8n-workflow';\n\ntype NodeMap = {\n\ttext: 'message';\n\timage: 'analyze' | 'generate';\n\tvideo: 'analyze' | 'generate' | 'download';\n\taudio: 'transcribe' | 'analyze';\n\tdocument: 'analyze';\n\tfile: 'upload';\n};\n\nexport type GoogleGeminiType = AllEntities<NodeMap>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,97 @@
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 router_exports = {};
30
+ __export(router_exports, {
31
+ router: () => router
32
+ });
33
+ module.exports = __toCommonJS(router_exports);
34
+ var import_n8n_workflow = require("n8n-workflow");
35
+ var audio = __toESM(require("./audio"));
36
+ var document = __toESM(require("./document"));
37
+ var file = __toESM(require("./file"));
38
+ var image = __toESM(require("./image"));
39
+ var text = __toESM(require("./text"));
40
+ var video = __toESM(require("./video"));
41
+ async function router() {
42
+ const returnData = [];
43
+ const items = this.getInputData();
44
+ const resource = this.getNodeParameter("resource", 0);
45
+ const operation = this.getNodeParameter("operation", 0);
46
+ const googleGeminiTypeData = {
47
+ resource,
48
+ operation
49
+ };
50
+ let execute;
51
+ switch (googleGeminiTypeData.resource) {
52
+ case "audio":
53
+ execute = audio[googleGeminiTypeData.operation].execute;
54
+ break;
55
+ case "document":
56
+ execute = document[googleGeminiTypeData.operation].execute;
57
+ break;
58
+ case "file":
59
+ execute = file[googleGeminiTypeData.operation].execute;
60
+ break;
61
+ case "image":
62
+ execute = image[googleGeminiTypeData.operation].execute;
63
+ break;
64
+ case "text":
65
+ execute = text[googleGeminiTypeData.operation].execute;
66
+ break;
67
+ case "video":
68
+ execute = video[googleGeminiTypeData.operation].execute;
69
+ break;
70
+ default:
71
+ throw new import_n8n_workflow.NodeOperationError(
72
+ this.getNode(),
73
+ `The operation "${operation}" is not supported!`
74
+ );
75
+ }
76
+ for (let i = 0; i < items.length; i++) {
77
+ try {
78
+ const responseData = await execute.call(this, i);
79
+ returnData.push(...responseData);
80
+ } catch (error) {
81
+ if (this.continueOnFail()) {
82
+ returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
83
+ continue;
84
+ }
85
+ throw new import_n8n_workflow.NodeOperationError(this.getNode(), error, {
86
+ itemIndex: i,
87
+ description: error.description
88
+ });
89
+ }
90
+ }
91
+ return [returnData];
92
+ }
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ router
96
+ });
97
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../nodes/vendors/GoogleGemini/actions/router.ts"],"sourcesContent":["import { NodeOperationError, type IExecuteFunctions, type INodeExecutionData } from 'n8n-workflow';\n\nimport * as audio from './audio';\nimport * as document from './document';\nimport * as file from './file';\nimport * as image from './image';\nimport type { GoogleGeminiType } from './node.type';\nimport * as text from './text';\nimport * as video from './video';\n\nexport async function router(this: IExecuteFunctions) {\n\tconst returnData: INodeExecutionData[] = [];\n\n\tconst items = this.getInputData();\n\tconst resource = this.getNodeParameter('resource', 0);\n\tconst operation = this.getNodeParameter('operation', 0);\n\n\tconst googleGeminiTypeData = {\n\t\tresource,\n\t\toperation,\n\t} as GoogleGeminiType;\n\n\tlet execute;\n\tswitch (googleGeminiTypeData.resource) {\n\t\tcase 'audio':\n\t\t\texecute = audio[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'document':\n\t\t\texecute = document[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'file':\n\t\t\texecute = file[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'image':\n\t\t\texecute = image[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'text':\n\t\t\texecute = text[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'video':\n\t\t\texecute = video[googleGeminiTypeData.operation].execute;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`The operation \"${operation}\" is not supported!`,\n\t\t\t);\n\t}\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tconst responseData = await execute.call(this, i);\n\t\t\treturnData.push(...responseData);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\treturnData.push({ json: { error: error.message }, pairedItem: { item: i } });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\titemIndex: i,\n\t\t\t\tdescription: error.description,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn [returnData];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAoF;AAEpF,YAAuB;AACvB,eAA0B;AAC1B,WAAsB;AACtB,YAAuB;AAEvB,WAAsB;AACtB,YAAuB;AAEvB,eAAsB,SAAgC;AACrD,QAAM,aAAmC,CAAC;AAE1C,QAAM,QAAQ,KAAK,aAAa;AAChC,QAAM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.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 text_exports = {};
30
+ __export(text_exports, {
31
+ description: () => description,
32
+ message: () => message
33
+ });
34
+ module.exports = __toCommonJS(text_exports);
35
+ var message = __toESM(require("./message.operation"));
36
+ const description = [
37
+ {
38
+ displayName: "Operation",
39
+ name: "operation",
40
+ type: "options",
41
+ noDataExpression: true,
42
+ options: [
43
+ {
44
+ name: "Message a Model",
45
+ value: "message",
46
+ action: "Message a model",
47
+ description: "Create a completion with Google Gemini model"
48
+ }
49
+ ],
50
+ default: "message",
51
+ displayOptions: {
52
+ show: {
53
+ resource: ["text"]
54
+ }
55
+ }
56
+ },
57
+ ...message.description
58
+ ];
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ description,
62
+ message
63
+ });
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../nodes/vendors/GoogleGemini/actions/text/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as message from './message.operation';\n\nexport { message };\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Message a Model',\n\t\t\t\tvalue: 'message',\n\t\t\t\taction: 'Message a model',\n\t\t\t\tdescription: 'Create a completion with Google Gemini model',\n\t\t\t},\n\t\t],\n\t\tdefault: 'message',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['text'],\n\t\t\t},\n\t\t},\n\t},\n\t...message.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,cAAyB;AAIlB,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,MACd;AAAA,IACD;AAAA,IACA,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,MAAM;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,QAAQ;AACZ;","names":[]}