Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10359948
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/nodes/Phabricator/Phabricator.node.ts b/nodes/Phabricator/Phabricator.node.ts
index 7c40746..8dc9ff1 100644
--- a/nodes/Phabricator/Phabricator.node.ts
+++ b/nodes/Phabricator/Phabricator.node.ts
@@ -1,105 +1,104 @@
import {
IExecuteFunctions,
INodeExecutionData,
INodeType,
INodeTypeDescription,
NodeExecutionWithMetadata,
} from 'n8n-workflow';
import { methods, apps, short_descriptions, fields } from './methods';
-import { PhabricatorApi } from '../../credentials/PhabricatorApi.credentials';
export class Phabricator implements INodeType {
description: INodeTypeDescription = {
displayName: 'Phabricator',
name: 'phabricator',
icon: 'file:phabricator.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"]}}',
description: 'Interact with Phabricator',
defaults: {
name: 'Phabricator',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'phabricatorApi',
required: true,
},
],
requestDefaults: {
method: 'POST',
baseURL: 'https://hub.sealcode.org',
},
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: apps.map((method) => ({
name: method,
value: method,
action: method,
description: `Call ${method} Conduit method`,
})),
default: 'user.whoami',
},
...apps.map((app) => ({
displayName: 'Operation',
name: 'operation',
type: <const>'options',
noDataExpression: true,
description: 'Choose an operation',
required: true,
displayOptions: {
show: {
resource: [app],
},
},
options: Object.entries(methods)
.filter(([method_name]) => {
return method_name.startsWith(app + '.');
})
.map(([method_name, method]) => ({
name: method_name,
value: method_name,
description: method.description,
action:
method_name.split('.').slice(1).join('.') + ': ' + short_descriptions[method_name],
routing: {
request: {
method: <const>'POST',
url: '/api/' + method_name,
},
},
})),
default: Object.keys(methods).filter((method_name) => method_name.startsWith(app + '.'))[0],
})),
...fields,
],
};
async execute(
this: IExecuteFunctions,
): Promise<INodeExecutionData[][] | NodeExecutionWithMetadata[][] | null> {
this.sendMessageToUI('I AM EXECUTED');
const { token, domain } = (await this.getCredentials('phabricatorApi')) as {
token: string;
domain: string;
};
const request = {
url: domain + '/api' + this.getNodeParameter('method', 0),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({ token }),
method: <const>'POST',
};
this.sendMessageToUI(request);
await this.helpers.httpRequest(request);
return [];
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 8, 03:26 (15 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1033965
Default Alt Text
(2 KB)
Attached To
Mode
rNPN n8n-phabricator-node
Attached
Detach File
Event Timeline
Log In to Comment