@n8n/n8n-nodes-langchain 1.102.0 → 1.103.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.
- package/dist/known/credentials.json +1 -0
- package/dist/known/nodes.json +4 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +7 -2
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js +2 -0
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +55 -5
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/loadOptions.js +11 -2
- package/dist/nodes/mcp/McpClientTool/loadOptions.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/types.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/utils.js +21 -11
- package/dist/nodes/mcp/McpClientTool/utils.js.map +1 -1
- package/dist/nodes/tools/ToolThink/ToolThink.node.js +5 -2
- package/dist/nodes/tools/ToolThink/ToolThink.node.js.map +1 -1
- package/dist/nodes/vendors/Anthropic/Anthropic.node.js +42 -0
- package/dist/nodes/vendors/Anthropic/Anthropic.node.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/descriptions.js +52 -0
- package/dist/nodes/vendors/Anthropic/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/document/analyze.operation.js +125 -0
- package/dist/nodes/vendors/Anthropic/actions/document/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/document/index.js +64 -0
- package/dist/nodes/vendors/Anthropic/actions/document/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/delete.operation.js +61 -0
- package/dist/nodes/vendors/Anthropic/actions/file/delete.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/get.operation.js +63 -0
- package/dist/nodes/vendors/Anthropic/actions/file/get.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/index.js +94 -0
- package/dist/nodes/vendors/Anthropic/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/list.operation.js +108 -0
- package/dist/nodes/vendors/Anthropic/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/file/upload.operation.js +126 -0
- package/dist/nodes/vendors/Anthropic/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/image/analyze.operation.js +125 -0
- package/dist/nodes/vendors/Anthropic/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/image/index.js +64 -0
- package/dist/nodes/vendors/Anthropic/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/node.type.js +17 -0
- package/dist/nodes/vendors/Anthropic/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/generate.operation.js +87 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/improve.operation.js +154 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/improve.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/index.js +95 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/templatize.operation.js +146 -0
- package/dist/nodes/vendors/Anthropic/actions/prompt/templatize.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/router.js +93 -0
- package/dist/nodes/vendors/Anthropic/actions/router.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/text/index.js +64 -0
- package/dist/nodes/vendors/Anthropic/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/text/message.operation.js +540 -0
- package/dist/nodes/vendors/Anthropic/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/actions/versionDescription.js +125 -0
- package/dist/nodes/vendors/Anthropic/actions/versionDescription.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/anthropic.svg +1 -0
- package/dist/nodes/vendors/Anthropic/helpers/baseAnalyze.js +109 -0
- package/dist/nodes/vendors/Anthropic/helpers/baseAnalyze.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/helpers/interfaces.js +17 -0
- package/dist/nodes/vendors/Anthropic/helpers/interfaces.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/helpers/utils.js +84 -0
- package/dist/nodes/vendors/Anthropic/helpers/utils.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/methods/index.js +39 -0
- package/dist/nodes/vendors/Anthropic/methods/index.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/methods/listSearch.js +42 -0
- package/dist/nodes/vendors/Anthropic/methods/listSearch.js.map +1 -0
- package/dist/nodes/vendors/Anthropic/transport/index.js +57 -0
- package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/actions/router.js +1 -1
- package/dist/nodes/vendors/OpenAi/actions/router.js.map +1 -1
- package/dist/types/credentials.json +1 -1
- package/dist/types/nodes.json +5 -4
- package/package.json +5 -4
|
@@ -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
|
+
import_descriptions.modelRLC,
|
|
30
|
+
{
|
|
31
|
+
displayName: "Text Input",
|
|
32
|
+
name: "text",
|
|
33
|
+
type: "string",
|
|
34
|
+
placeholder: "e.g. What's in this document?",
|
|
35
|
+
default: "What's in this document?",
|
|
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: "Document 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: "documentUrls",
|
|
59
|
+
type: "string",
|
|
60
|
+
placeholder: "e.g. https://example.com/document.pdf",
|
|
61
|
+
description: "URL(s) of the document(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 document(s), seperate 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: "maxTokens",
|
|
101
|
+
type: "number",
|
|
102
|
+
default: 1024,
|
|
103
|
+
typeOptions: {
|
|
104
|
+
minValue: 1
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
const displayOptions = {
|
|
111
|
+
show: {
|
|
112
|
+
operation: ["analyze"],
|
|
113
|
+
resource: ["document"]
|
|
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, "documentUrls", "document");
|
|
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/Anthropic/actions/document/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,\n\t{\n\t\tdisplayName: 'Text Input',\n\t\tname: 'text',\n\t\ttype: 'string',\n\t\tplaceholder: \"e.g. What's in this document?\",\n\t\tdefault: \"What's in this document?\",\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: 'Document 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: 'documentUrls',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. https://example.com/document.pdf',\n\t\tdescription:\n\t\t\t'URL(s) of the document(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 document(s), seperate 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: 'maxTokens',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 1024,\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: ['document'],\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, 'documentUrls', 'document');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,yBAA4B;AAC5B,0BAAyB;AAEzB,MAAM,aAAgC;AAAA,EACrC;AAAA,EACA;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,aACC;AAAA,IACD,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,UAAU;AAAA,EACtB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,SAAO,MAAM,+BAAY,KAAK,MAAM,GAAG,gBAAgB,UAAU;AAClE;","names":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
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 document_exports = {};
|
|
30
|
+
__export(document_exports, {
|
|
31
|
+
analyze: () => analyze,
|
|
32
|
+
description: () => description
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(document_exports);
|
|
35
|
+
var analyze = __toESM(require("./analyze.operation"));
|
|
36
|
+
const description = [
|
|
37
|
+
{
|
|
38
|
+
displayName: "Operation",
|
|
39
|
+
name: "operation",
|
|
40
|
+
type: "options",
|
|
41
|
+
noDataExpression: true,
|
|
42
|
+
options: [
|
|
43
|
+
{
|
|
44
|
+
name: "Analyze Document",
|
|
45
|
+
value: "analyze",
|
|
46
|
+
action: "Analyze document",
|
|
47
|
+
description: "Take in documents and answer questions about them"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
default: "analyze",
|
|
51
|
+
displayOptions: {
|
|
52
|
+
show: {
|
|
53
|
+
resource: ["document"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
...analyze.description
|
|
58
|
+
];
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
analyze,
|
|
62
|
+
description
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/document/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as analyze from './analyze.operation';\n\nexport { analyze };\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 Document',\n\t\t\t\tvalue: 'analyze',\n\t\t\t\taction: 'Analyze document',\n\t\t\t\tdescription: 'Take in documents and answer questions about them',\n\t\t\t},\n\t\t],\n\t\tdefault: 'analyze',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['document'],\n\t\t\t},\n\t\t},\n\t},\n\t...analyze.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,UAAU;AAAA,MACtB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,QAAQ;AACZ;","names":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 delete_operation_exports = {};
|
|
20
|
+
__export(delete_operation_exports, {
|
|
21
|
+
description: () => description,
|
|
22
|
+
execute: () => execute,
|
|
23
|
+
properties: () => properties
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(delete_operation_exports);
|
|
26
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
27
|
+
var import_transport = require("../../transport");
|
|
28
|
+
const properties = [
|
|
29
|
+
{
|
|
30
|
+
displayName: "File ID",
|
|
31
|
+
name: "fileId",
|
|
32
|
+
type: "string",
|
|
33
|
+
placeholder: "e.g. file_123",
|
|
34
|
+
description: "ID of the file to delete",
|
|
35
|
+
default: ""
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
const displayOptions = {
|
|
39
|
+
show: {
|
|
40
|
+
operation: ["deleteFile"],
|
|
41
|
+
resource: ["file"]
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
45
|
+
async function execute(i) {
|
|
46
|
+
const fileId = this.getNodeParameter("fileId", i, "");
|
|
47
|
+
const response = await import_transport.apiRequest.call(this, "DELETE", `/v1/files/${fileId}`);
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
json: response,
|
|
51
|
+
pairedItem: { item: i }
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
description,
|
|
58
|
+
execute,
|
|
59
|
+
properties
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=delete.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/file/delete.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport { apiRequest } from '../../transport';\n\nexport const properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'File ID',\n\t\tname: 'fileId',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. file_123',\n\t\tdescription: 'ID of the file to delete',\n\t\tdefault: '',\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['deleteFile'],\n\t\tresource: ['file'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst fileId = this.getNodeParameter('fileId', i, '') as string;\n\tconst response = (await apiRequest.call(this, 'DELETE', `/v1/files/${fileId}`)) as {\n\t\tid: string;\n\t};\n\treturn [\n\t\t{\n\t\t\tjson: response,\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAErC,uBAA2B;AAEpB,MAAM,aAAgC;AAAA,EAC5C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,EACV;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,YAAY;AAAA,IACxB,UAAU,CAAC,MAAM;AAAA,EAClB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,SAAS,KAAK,iBAAiB,UAAU,GAAG,EAAE;AACpD,QAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,UAAU,aAAa,MAAM,EAAE;AAG7E,SAAO;AAAA,IACN;AAAA,MACC,MAAM;AAAA,MACN,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 get_operation_exports = {};
|
|
20
|
+
__export(get_operation_exports, {
|
|
21
|
+
description: () => description,
|
|
22
|
+
execute: () => execute,
|
|
23
|
+
properties: () => properties
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(get_operation_exports);
|
|
26
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
27
|
+
var import_utils = require("../../helpers/utils");
|
|
28
|
+
var import_transport = require("../../transport");
|
|
29
|
+
const properties = [
|
|
30
|
+
{
|
|
31
|
+
displayName: "File ID",
|
|
32
|
+
name: "fileId",
|
|
33
|
+
type: "string",
|
|
34
|
+
placeholder: "e.g. file_123",
|
|
35
|
+
description: "ID of the file to get metadata for",
|
|
36
|
+
default: ""
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
const displayOptions = {
|
|
40
|
+
show: {
|
|
41
|
+
operation: ["get"],
|
|
42
|
+
resource: ["file"]
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
46
|
+
async function execute(i) {
|
|
47
|
+
const fileId = this.getNodeParameter("fileId", i, "");
|
|
48
|
+
const baseUrl = await import_utils.getBaseUrl.call(this);
|
|
49
|
+
const response = await import_transport.apiRequest.call(this, "GET", `/v1/files/${fileId}`);
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
json: { ...response, url: `${baseUrl}/v1/files/${response.id}` },
|
|
53
|
+
pairedItem: { item: i }
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
description,
|
|
60
|
+
execute,
|
|
61
|
+
properties
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=get.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/file/get.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { File } from '../../helpers/interfaces';\nimport { getBaseUrl } from '../../helpers/utils';\nimport { apiRequest } from '../../transport';\n\nexport const properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'File ID',\n\t\tname: 'fileId',\n\t\ttype: 'string',\n\t\tplaceholder: 'e.g. file_123',\n\t\tdescription: 'ID of the file to get metadata for',\n\t\tdefault: '',\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['get'],\n\t\tresource: ['file'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst fileId = this.getNodeParameter('fileId', i, '') as string;\n\tconst baseUrl = await getBaseUrl.call(this);\n\tconst response = (await apiRequest.call(this, 'GET', `/v1/files/${fileId}`)) as File;\n\treturn [\n\t\t{\n\t\t\tjson: { ...response, url: `${baseUrl}/v1/files/${response.id}` },\n\t\t\tpairedItem: { item: i },\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAGrC,mBAA2B;AAC3B,uBAA2B;AAEpB,MAAM,aAAgC;AAAA,EAC5C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,EACV;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,KAAK;AAAA,IACjB,UAAU,CAAC,MAAM;AAAA,EAClB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,SAAS,KAAK,iBAAiB,UAAU,GAAG,EAAE;AACpD,QAAM,UAAU,MAAM,wBAAW,KAAK,IAAI;AAC1C,QAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,OAAO,aAAa,MAAM,EAAE;AAC1E,SAAO;AAAA,IACN;AAAA,MACC,MAAM,EAAE,GAAG,UAAU,KAAK,GAAG,OAAO,aAAa,SAAS,EAAE,GAAG;AAAA,MAC/D,YAAY,EAAE,MAAM,EAAE;AAAA,IACvB;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
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 file_exports = {};
|
|
30
|
+
__export(file_exports, {
|
|
31
|
+
deleteFile: () => deleteFile,
|
|
32
|
+
description: () => description,
|
|
33
|
+
get: () => get,
|
|
34
|
+
list: () => list,
|
|
35
|
+
upload: () => upload
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(file_exports);
|
|
38
|
+
var deleteFile = __toESM(require("./delete.operation"));
|
|
39
|
+
var get = __toESM(require("./get.operation"));
|
|
40
|
+
var list = __toESM(require("./list.operation"));
|
|
41
|
+
var upload = __toESM(require("./upload.operation"));
|
|
42
|
+
const description = [
|
|
43
|
+
{
|
|
44
|
+
displayName: "Operation",
|
|
45
|
+
name: "operation",
|
|
46
|
+
type: "options",
|
|
47
|
+
noDataExpression: true,
|
|
48
|
+
options: [
|
|
49
|
+
{
|
|
50
|
+
name: "Upload File",
|
|
51
|
+
value: "upload",
|
|
52
|
+
action: "Upload a file",
|
|
53
|
+
description: "Upload a file to the Anthropic API for later use"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "Get File Metadata",
|
|
57
|
+
value: "get",
|
|
58
|
+
action: "Get file metadata",
|
|
59
|
+
description: "Get metadata for a file from the Anthropic API"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "List Files",
|
|
63
|
+
value: "list",
|
|
64
|
+
action: "List files",
|
|
65
|
+
description: "List files from the Anthropic API"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "Delete File",
|
|
69
|
+
value: "deleteFile",
|
|
70
|
+
action: "Delete a file",
|
|
71
|
+
description: "Delete a file from the Anthropic API"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
default: "upload",
|
|
75
|
+
displayOptions: {
|
|
76
|
+
show: {
|
|
77
|
+
resource: ["file"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
...deleteFile.description,
|
|
82
|
+
...get.description,
|
|
83
|
+
...list.description,
|
|
84
|
+
...upload.description
|
|
85
|
+
];
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
deleteFile,
|
|
89
|
+
description,
|
|
90
|
+
get,
|
|
91
|
+
list,
|
|
92
|
+
upload
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/file/index.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as deleteFile from './delete.operation';\nimport * as get from './get.operation';\nimport * as list from './list.operation';\nimport * as upload from './upload.operation';\n\nexport { deleteFile, get, list, upload };\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: 'Upload File',\n\t\t\t\tvalue: 'upload',\n\t\t\t\taction: 'Upload a file',\n\t\t\t\tdescription: 'Upload a file to the Anthropic API for later use',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Get File Metadata',\n\t\t\t\tvalue: 'get',\n\t\t\t\taction: 'Get file metadata',\n\t\t\t\tdescription: 'Get metadata for a file from the Anthropic API',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'List Files',\n\t\t\t\tvalue: 'list',\n\t\t\t\taction: 'List files',\n\t\t\t\tdescription: 'List files from the Anthropic API',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Delete File',\n\t\t\t\tvalue: 'deleteFile',\n\t\t\t\taction: 'Delete a file',\n\t\t\t\tdescription: 'Delete a file from the Anthropic API',\n\t\t\t},\n\t\t],\n\t\tdefault: 'upload',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['file'],\n\t\t\t},\n\t\t},\n\t},\n\t...deleteFile.description,\n\t...get.description,\n\t...list.description,\n\t...upload.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAA4B;AAC5B,UAAqB;AACrB,WAAsB;AACtB,aAAwB;AAIjB,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,MACA;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,MAAM;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG,WAAW;AAAA,EACd,GAAG,IAAI;AAAA,EACP,GAAG,KAAK;AAAA,EACR,GAAG,OAAO;AACX;","names":[]}
|
|
@@ -0,0 +1,108 @@
|
|
|
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 list_operation_exports = {};
|
|
20
|
+
__export(list_operation_exports, {
|
|
21
|
+
description: () => description,
|
|
22
|
+
execute: () => execute,
|
|
23
|
+
properties: () => properties
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(list_operation_exports);
|
|
26
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
27
|
+
var import_utils = require("../../helpers/utils");
|
|
28
|
+
var import_transport = require("../../transport");
|
|
29
|
+
const properties = [
|
|
30
|
+
{
|
|
31
|
+
displayName: "Return All",
|
|
32
|
+
name: "returnAll",
|
|
33
|
+
type: "boolean",
|
|
34
|
+
default: false,
|
|
35
|
+
description: "Whether to return all results or only up to a given limit"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
displayName: "Limit",
|
|
39
|
+
name: "limit",
|
|
40
|
+
type: "number",
|
|
41
|
+
typeOptions: {
|
|
42
|
+
minValue: 1,
|
|
43
|
+
maxValue: 1e3
|
|
44
|
+
},
|
|
45
|
+
default: 50,
|
|
46
|
+
description: "Max number of results to return",
|
|
47
|
+
displayOptions: {
|
|
48
|
+
show: {
|
|
49
|
+
returnAll: [false]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
const displayOptions = {
|
|
55
|
+
show: {
|
|
56
|
+
operation: ["list"],
|
|
57
|
+
resource: ["file"]
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const description = (0, import_n8n_workflow.updateDisplayOptions)(displayOptions, properties);
|
|
61
|
+
async function execute(i) {
|
|
62
|
+
const returnAll = this.getNodeParameter("returnAll", i, false);
|
|
63
|
+
const limit = this.getNodeParameter("limit", i, 50);
|
|
64
|
+
const baseUrl = await import_utils.getBaseUrl.call(this);
|
|
65
|
+
if (returnAll) {
|
|
66
|
+
return await getAllFiles.call(this, baseUrl, i);
|
|
67
|
+
} else {
|
|
68
|
+
return await getFiles.call(this, baseUrl, i, limit);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function getAllFiles(baseUrl, i) {
|
|
72
|
+
let hasMore = true;
|
|
73
|
+
let lastId = void 0;
|
|
74
|
+
const files = [];
|
|
75
|
+
while (hasMore) {
|
|
76
|
+
const response = await import_transport.apiRequest.call(this, "GET", "/v1/files", {
|
|
77
|
+
qs: {
|
|
78
|
+
limit: 1e3,
|
|
79
|
+
after_id: lastId
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
hasMore = response.has_more;
|
|
83
|
+
lastId = response.last_id;
|
|
84
|
+
files.push(...response.data);
|
|
85
|
+
}
|
|
86
|
+
return files.map((file) => ({
|
|
87
|
+
json: { ...file, url: `${baseUrl}/v1/files/${file.id}` },
|
|
88
|
+
pairedItem: { item: i }
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
async function getFiles(baseUrl, i, limit) {
|
|
92
|
+
const response = await import_transport.apiRequest.call(this, "GET", "/v1/files", {
|
|
93
|
+
qs: {
|
|
94
|
+
limit
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return response.data.map((file) => ({
|
|
98
|
+
json: { ...file, url: `${baseUrl}/v1/files/${file.id}` },
|
|
99
|
+
pairedItem: { item: i }
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
description,
|
|
105
|
+
execute,
|
|
106
|
+
properties
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=list.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/vendors/Anthropic/actions/file/list.operation.ts"],"sourcesContent":["import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';\nimport { updateDisplayOptions } from 'n8n-workflow';\n\nimport type { File } from '../../helpers/interfaces';\nimport { getBaseUrl } from '../../helpers/utils';\nimport { apiRequest } from '../../transport';\n\ninterface FileListResponse {\n\tdata: File[];\n\tfirst_id: string;\n\tlast_id: string;\n\thas_more: boolean;\n}\n\nexport const properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Return All',\n\t\tname: 'returnAll',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription: 'Whether to return all results or only up to a given limit',\n\t},\n\t{\n\t\tdisplayName: 'Limit',\n\t\tname: 'limit',\n\t\ttype: 'number',\n\t\ttypeOptions: {\n\t\t\tminValue: 1,\n\t\t\tmaxValue: 1000,\n\t\t},\n\t\tdefault: 50,\n\t\tdescription: 'Max number of results to return',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\treturnAll: [false],\n\t\t\t},\n\t\t},\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['list'],\n\t\tresource: ['file'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst returnAll = this.getNodeParameter('returnAll', i, false);\n\tconst limit = this.getNodeParameter('limit', i, 50);\n\tconst baseUrl = await getBaseUrl.call(this);\n\tif (returnAll) {\n\t\treturn await getAllFiles.call(this, baseUrl, i);\n\t} else {\n\t\treturn await getFiles.call(this, baseUrl, i, limit);\n\t}\n}\n\nasync function getAllFiles(this: IExecuteFunctions, baseUrl: string, i: number) {\n\tlet hasMore = true;\n\tlet lastId: string | undefined = undefined;\n\tconst files: File[] = [];\n\twhile (hasMore) {\n\t\tconst response = (await apiRequest.call(this, 'GET', '/v1/files', {\n\t\t\tqs: {\n\t\t\t\tlimit: 1000,\n\t\t\t\tafter_id: lastId,\n\t\t\t},\n\t\t})) as FileListResponse;\n\n\t\thasMore = response.has_more;\n\t\tlastId = response.last_id;\n\t\tfiles.push(...response.data);\n\t}\n\n\treturn files.map((file) => ({\n\t\tjson: { ...file, url: `${baseUrl}/v1/files/${file.id}` },\n\t\tpairedItem: { item: i },\n\t}));\n}\n\nasync function getFiles(this: IExecuteFunctions, baseUrl: string, i: number, limit: number) {\n\tconst response = (await apiRequest.call(this, 'GET', '/v1/files', {\n\t\tqs: {\n\t\t\tlimit,\n\t\t},\n\t})) as FileListResponse;\n\n\treturn response.data.map((file) => ({\n\t\tjson: { ...file, url: `${baseUrl}/v1/files/${file.id}` },\n\t\tpairedItem: { item: i },\n\t}));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAqC;AAGrC,mBAA2B;AAC3B,uBAA2B;AASpB,MAAM,aAAgC;AAAA,EAC5C;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,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,UAAU;AAAA,MACV,UAAU;AAAA,IACX;AAAA,IACA,SAAS;AAAA,IACT,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,KAAK;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,WAAW,CAAC,MAAM;AAAA,IAClB,UAAU,CAAC,MAAM;AAAA,EAClB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;AAE1E,eAAsB,QAAiC,GAA0C;AAChG,QAAM,YAAY,KAAK,iBAAiB,aAAa,GAAG,KAAK;AAC7D,QAAM,QAAQ,KAAK,iBAAiB,SAAS,GAAG,EAAE;AAClD,QAAM,UAAU,MAAM,wBAAW,KAAK,IAAI;AAC1C,MAAI,WAAW;AACd,WAAO,MAAM,YAAY,KAAK,MAAM,SAAS,CAAC;AAAA,EAC/C,OAAO;AACN,WAAO,MAAM,SAAS,KAAK,MAAM,SAAS,GAAG,KAAK;AAAA,EACnD;AACD;AAEA,eAAe,YAAqC,SAAiB,GAAW;AAC/E,MAAI,UAAU;AACd,MAAI,SAA6B;AACjC,QAAM,QAAgB,CAAC;AACvB,SAAO,SAAS;AACf,UAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,OAAO,aAAa;AAAA,MACjE,IAAI;AAAA,QACH,OAAO;AAAA,QACP,UAAU;AAAA,MACX;AAAA,IACD,CAAC;AAED,cAAU,SAAS;AACnB,aAAS,SAAS;AAClB,UAAM,KAAK,GAAG,SAAS,IAAI;AAAA,EAC5B;AAEA,SAAO,MAAM,IAAI,CAAC,UAAU;AAAA,IAC3B,MAAM,EAAE,GAAG,MAAM,KAAK,GAAG,OAAO,aAAa,KAAK,EAAE,GAAG;AAAA,IACvD,YAAY,EAAE,MAAM,EAAE;AAAA,EACvB,EAAE;AACH;AAEA,eAAe,SAAkC,SAAiB,GAAW,OAAe;AAC3F,QAAM,WAAY,MAAM,4BAAW,KAAK,MAAM,OAAO,aAAa;AAAA,IACjE,IAAI;AAAA,MACH;AAAA,IACD;AAAA,EACD,CAAC;AAED,SAAO,SAAS,KAAK,IAAI,CAAC,UAAU;AAAA,IACnC,MAAM,EAAE,GAAG,MAAM,KAAK,GAAG,OAAO,aAAa,KAAK,EAAE,GAAG;AAAA,IACvD,YAAY,EAAE,MAAM,EAAE;AAAA,EACvB,EAAE;AACH;","names":[]}
|