n8n-nodes-openapi-compatible 0.1.0 → 0.1.2
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/README.md +4 -1
- package/dist/package.json +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/credentials/ExampleCredentialsApi.credentials.d.ts +0 -8
- package/dist/credentials/ExampleCredentialsApi.credentials.js +0 -46
- package/dist/credentials/ExampleCredentialsApi.credentials.js.map +0 -1
- package/dist/credentials/HttpBinApi.credentials.d.ts +0 -9
- package/dist/credentials/HttpBinApi.credentials.js +0 -43
- package/dist/credentials/HttpBinApi.credentials.js.map +0 -1
- package/dist/nodes/ExampleNode/ExampleNode.node.d.ts +0 -5
- package/dist/nodes/ExampleNode/ExampleNode.node.js +0 -59
- package/dist/nodes/ExampleNode/ExampleNode.node.js.map +0 -1
- package/dist/nodes/HttpBin/HttpBin.node.d.ts +0 -4
- package/dist/nodes/HttpBin/HttpBin.node.js +0 -55
- package/dist/nodes/HttpBin/HttpBin.node.js.map +0 -1
- package/dist/nodes/HttpBin/HttpBin.node.json +0 -18
- package/dist/nodes/HttpBin/HttpVerbDescription.d.ts +0 -3
- package/dist/nodes/HttpBin/HttpVerbDescription.js +0 -234
- package/dist/nodes/HttpBin/HttpVerbDescription.js.map +0 -1
- package/dist/nodes/OpenAPINode/OpenAPIDescription.d.ts +0 -3
- package/dist/nodes/OpenAPINode/OpenAPIDescription.js +0 -145
- package/dist/nodes/OpenAPINode/OpenAPIDescription.js.map +0 -1
- package/dist/nodes/OpenAPINode/OpenAPIHelper.d.ts +0 -3
- package/dist/nodes/OpenAPINode/OpenAPIHelper.js +0 -79
- package/dist/nodes/OpenAPINode/OpenAPIHelper.js.map +0 -1
- package/dist/nodes/OpenAPINode/OpenAPINode.node.d.ts +0 -10
- package/dist/nodes/OpenAPINode/OpenAPINode.node.js +0 -117
- package/dist/nodes/OpenAPINode/OpenAPINode.node.js.map +0 -1
- package/dist/nodes/OpenAPINode/OpenApi.credentials.d.ts +0 -14
- package/dist/nodes/OpenAPINode/OpenApi.credentials.js +0 -71
- package/dist/nodes/OpenAPINode/OpenApi.credentials.js.map +0 -1
- package/dist/nodes/OpenAPINode/OpenApi.svg +0 -0
- package/dist/nodes/OpenAPINode/openapi.png +0 -0
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OpenAPINode = void 0;
|
|
4
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
-
const OpenAPIDescription_1 = require("./OpenAPIDescription");
|
|
6
|
-
const OpenAPIHelper_1 = require("./OpenAPIHelper");
|
|
7
|
-
class OpenAPINode {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.description = {
|
|
10
|
-
displayName: 'OpenAPI',
|
|
11
|
-
name: 'openApiNode',
|
|
12
|
-
icon: 'file:openapi.svg',
|
|
13
|
-
group: ['transform'],
|
|
14
|
-
version: 1,
|
|
15
|
-
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
16
|
-
description: 'Consume any OpenAPI/Swagger based API',
|
|
17
|
-
defaults: {
|
|
18
|
-
name: 'OpenAPI',
|
|
19
|
-
},
|
|
20
|
-
inputs: ['main'],
|
|
21
|
-
outputs: ['main'],
|
|
22
|
-
credentials: [
|
|
23
|
-
{
|
|
24
|
-
name: 'openApiAuth',
|
|
25
|
-
required: false,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
properties: [
|
|
29
|
-
{
|
|
30
|
-
displayName: 'OpenAPI Specification URL',
|
|
31
|
-
name: 'openApiUrl',
|
|
32
|
-
type: 'string',
|
|
33
|
-
default: '',
|
|
34
|
-
required: true,
|
|
35
|
-
description: 'URL of the OpenAPI/Swagger specification',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
displayName: 'Resource',
|
|
39
|
-
name: 'resource',
|
|
40
|
-
type: 'options',
|
|
41
|
-
noDataExpression: true,
|
|
42
|
-
options: [
|
|
43
|
-
{
|
|
44
|
-
name: 'API Endpoint',
|
|
45
|
-
value: 'apiEndpoint',
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
default: 'apiEndpoint',
|
|
49
|
-
},
|
|
50
|
-
...OpenAPIDescription_1.openApiOperations,
|
|
51
|
-
...OpenAPIDescription_1.openApiFields,
|
|
52
|
-
],
|
|
53
|
-
};
|
|
54
|
-
this.methods = {
|
|
55
|
-
loadOptions: {
|
|
56
|
-
async loadOperations() {
|
|
57
|
-
const openApiUrl = this.getNodeParameter('openApiUrl', 0);
|
|
58
|
-
try {
|
|
59
|
-
const spec = await (0, OpenAPIHelper_1.loadOpenApiSpec)(openApiUrl);
|
|
60
|
-
const operations = [];
|
|
61
|
-
for (const path in spec.paths) {
|
|
62
|
-
for (const method in spec.paths[path]) {
|
|
63
|
-
const operation = spec.paths[path][method];
|
|
64
|
-
operations.push({
|
|
65
|
-
name: `${method.toUpperCase()} ${path} - ${operation.summary || operation.operationId || ''}`,
|
|
66
|
-
value: `${method}:${path}`,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return operations;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to load OpenAPI spec: ${error.message}`);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
async execute() {
|
|
80
|
-
const items = this.getInputData();
|
|
81
|
-
const returnItems = [];
|
|
82
|
-
const openApiUrl = this.getNodeParameter('openApiUrl', 0);
|
|
83
|
-
const spec = await (0, OpenAPIHelper_1.loadOpenApiSpec)(openApiUrl);
|
|
84
|
-
for (let i = 0; i < items.length; i++) {
|
|
85
|
-
try {
|
|
86
|
-
const operation = this.getNodeParameter('operation', i);
|
|
87
|
-
const [method, path] = operation.split(':');
|
|
88
|
-
const parameters = this.getNodeParameter('parameters', i, {});
|
|
89
|
-
const requestBody = this.getNodeParameter('requestBody', i, {});
|
|
90
|
-
const response = await (0, OpenAPIHelper_1.executeOpenApiRequest)(spec, method, path, parameters, requestBody, this.getCredentials('openApiAuth'));
|
|
91
|
-
returnItems.push({
|
|
92
|
-
json: response,
|
|
93
|
-
pairedItem: {
|
|
94
|
-
item: i,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
if (this.continueOnFail()) {
|
|
100
|
-
returnItems.push({
|
|
101
|
-
json: {
|
|
102
|
-
error: error.message,
|
|
103
|
-
},
|
|
104
|
-
pairedItem: {
|
|
105
|
-
item: i,
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
throw error;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return [returnItems];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.OpenAPINode = OpenAPINode;
|
|
117
|
-
//# sourceMappingURL=OpenAPINode.node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAPINode.node.js","sourceRoot":"","sources":["../../../nodes/OpenAPINode/OpenAPINode.node.ts"],"names":[],"mappings":";;;AASA,+CAAkD;AAClD,6DAAwE;AACxE,mDAAyE;AAEzE,MAAa,WAAW;IAAxB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE;gBACT,IAAI,EAAE,SAAS;aACf;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE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,CAAC;oBAChB,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACX,IAAI,EAAE,CAAC;qBACP;iBACD,CAAC,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,WAAW,CAAC,IAAI,CAAC;wBAChB,IAAI,EAAE;4BACL,KAAK,EAAE,KAAK,CAAC,OAAO;yBACpB;wBACD,UAAU,EAAE;4BACX,IAAI,EAAE,CAAC;yBACP;qBACD,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,WAAW,CAAC,CAAC;IACtB,CAAC;CACD;AAjID,kCAiIC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
export declare class OpenApi implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
documentationUrl: string;
|
|
6
|
-
properties: INodeProperties[];
|
|
7
|
-
authenticate: IAuthenticateGeneric;
|
|
8
|
-
test: {
|
|
9
|
-
request: {
|
|
10
|
-
baseURL: string;
|
|
11
|
-
url: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OpenApi = void 0;
|
|
4
|
-
class OpenApi {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = 'openApi';
|
|
7
|
-
this.displayName = 'OpenAPI Auth';
|
|
8
|
-
this.documentationUrl = 'https://docs.n8n.io/integrations/creating-nodes/build/credentials/';
|
|
9
|
-
this.properties = [
|
|
10
|
-
{
|
|
11
|
-
displayName: 'API Key Name',
|
|
12
|
-
name: 'apiKeyName',
|
|
13
|
-
type: 'string',
|
|
14
|
-
typeOptions: {
|
|
15
|
-
password: true,
|
|
16
|
-
},
|
|
17
|
-
default: 'X-API-Key',
|
|
18
|
-
description: 'Name of the API key header or query parameter',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
displayName: 'API Key',
|
|
22
|
-
name: 'apiKey',
|
|
23
|
-
type: 'string',
|
|
24
|
-
typeOptions: {
|
|
25
|
-
password: true,
|
|
26
|
-
},
|
|
27
|
-
default: '',
|
|
28
|
-
description: 'The API key value',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
displayName: 'Username',
|
|
32
|
-
name: 'username',
|
|
33
|
-
type: 'string',
|
|
34
|
-
default: '',
|
|
35
|
-
description: 'Username for Basic Authentication',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
displayName: 'Password',
|
|
39
|
-
name: 'password',
|
|
40
|
-
type: 'string',
|
|
41
|
-
typeOptions: {
|
|
42
|
-
password: true,
|
|
43
|
-
},
|
|
44
|
-
default: '',
|
|
45
|
-
description: 'Password for Basic Authentication',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
displayName: 'Token',
|
|
49
|
-
name: 'token',
|
|
50
|
-
type: 'string',
|
|
51
|
-
typeOptions: {
|
|
52
|
-
password: true,
|
|
53
|
-
},
|
|
54
|
-
default: '',
|
|
55
|
-
description: 'Bearer token for Authentication',
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
this.authenticate = {
|
|
59
|
-
type: 'generic',
|
|
60
|
-
properties: {},
|
|
61
|
-
};
|
|
62
|
-
this.test = {
|
|
63
|
-
request: {
|
|
64
|
-
baseURL: '={{$credentials.url}}',
|
|
65
|
-
url: '/',
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.OpenApi = OpenApi;
|
|
71
|
-
//# sourceMappingURL=OpenApi.credentials.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Op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