Beta plugins

This commit is contained in:
HaveAGitGat 2023-09-03 18:39:33 +01:00
parent 50a795dc97
commit e2cb06f0f2
117 changed files with 4414 additions and 168 deletions

View file

@ -0,0 +1,53 @@
import {
IpluginDetails,
IpluginInputArgs,
IpluginOutputArgs,
} from '../../../../FlowHelpers/1.0.0/interfaces/interfaces';
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
const details = (): IpluginDetails => ({
name: 'Comment',
nameUI: {
type: 'textarea',
style: {
height: '250px',
},
},
description: `Add a comment to your flow. Can place anywhere and link together.
Any file input into the comment will be passed straight through.`,
style: {
borderColor: 'white',
borderRadius: '10px',
backgroundColor: '#043775',
},
tags: '',
isStartPlugin: false,
pType: '',
requiresVersion: '2.11.01',
sidebarPosition: -1,
icon: 'faComment',
inputs: [],
outputs: [
{
number: 1,
tooltip: 'Continue to next plugin',
},
],
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
const lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
return {
outputFileObj: args.inputFileObj,
outputNumber: 1,
variables: args.variables,
};
};
export {
details,
plugin,
};

View file

@ -13,6 +13,8 @@ const details = ():IpluginDetails => ({
},
tags: '',
isStartPlugin: false,
pType: '',
requiresVersion: '2.11.01',
sidebarPosition: -1,
icon: 'faExclamationTriangle',
inputs: [],

View file

@ -9,14 +9,26 @@ const details = ():IpluginDetails => ({
name: 'Go To Flow',
description: 'Go to a different flow',
style: {
borderColor: 'red',
opacity: 0.5,
borderColor: 'green',
},
tags: '',
isStartPlugin: false,
pType: '',
requiresVersion: '2.11.01',
sidebarPosition: -1,
icon: 'faArrowRight',
inputs: [],
inputs: [
{
name: 'flowId',
type: 'string',
defaultValue: '',
inputUI: {
type: 'dropdown',
options: [],
},
tooltip: 'Specify flow ID to go to',
},
],
outputs: [],
});

View file

@ -0,0 +1,45 @@
import {
IpluginDetails,
IpluginInputArgs,
IpluginOutputArgs,
} from '../../../../FlowHelpers/1.0.0/interfaces/interfaces';
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
const details = ():IpluginDetails => ({
name: 'On Flow Error',
description: `Runs if an error occurs in this specific flow.
Won't run if error occurs in after going to a different flow (unless that flow comes back to this one).`,
style: {
borderColor: 'red',
},
tags: '',
isStartPlugin: false,
pType: 'onFlowError',
requiresVersion: '2.11.01',
sidebarPosition: -1,
icon: 'faArrowRight',
inputs: [],
outputs: [
{
number: 1,
tooltip: 'Continue to next plugin',
},
],
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (args:IpluginInputArgs):IpluginOutputArgs => {
const lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
return {
outputFileObj: args.inputFileObj,
outputNumber: 1,
variables: args.variables,
};
};
export {
details,
plugin,
};

View file

@ -0,0 +1,46 @@
import {
IpluginDetails,
IpluginInputArgs,
IpluginOutputArgs,
} from '../../../../FlowHelpers/1.0.0/interfaces/interfaces';
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
const details = (): IpluginDetails => ({
name: 'Require Review',
description: `Makes the flow pause.
The file will stay in the staging section on the Tdarr tab until the user clicks the "Reviewed" button.
`,
style: {
borderColor: 'yellow',
},
tags: '',
isStartPlugin: false,
pType: '',
requiresVersion: '2.11.01',
sidebarPosition: -1,
icon: 'faHand',
inputs: [],
outputs: [
{
number: 1,
tooltip: 'Continue to next plugin',
},
],
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
const lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
return {
outputFileObj: args.inputFileObj,
outputNumber: 1,
variables: args.variables,
};
};
export {
details,
plugin,
};

View file

@ -15,6 +15,8 @@ const details = ():IpluginDetails => ({
},
tags: '',
isStartPlugin: false,
pType: '',
requiresVersion: '2.11.01',
sidebarPosition: -1,
icon: '',
inputs: [],

View file

@ -5,18 +5,72 @@ import {
} from '../../../../FlowHelpers/1.0.0/interfaces/interfaces';
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
const details = ():IpluginDetails => ({
const details = (): IpluginDetails => ({
name: 'Send Web Request',
description: 'Send Web Request',
style: {
borderColor: 'green',
opacity: 0.5,
},
tags: '',
isStartPlugin: false,
pType: '',
requiresVersion: '2.11.01',
sidebarPosition: -1,
icon: 'faArrowRight',
inputs: [],
inputs: [
{
name: 'method',
type: 'string',
defaultValue: 'post',
inputUI: {
type: 'dropdown',
options: [
'get',
'post',
'put',
'delete',
],
},
tooltip: 'Specify request method',
},
{
name: 'requestUrl',
type: 'string',
defaultValue: 'http://example.com',
inputUI: {
type: 'text',
},
tooltip: 'Specify request URL',
},
{
name: 'requestHeaders',
type: 'string',
defaultValue: `{
"Content-Type": "application/json"
}`,
inputUI: {
type: 'textarea',
style: {
height: '100px',
},
},
tooltip: 'Specify request URL',
},
{
name: 'requestBody',
type: 'string',
defaultValue: `{
"test": "test"
}`,
inputUI: {
type: 'textarea',
style: {
height: '100px',
},
},
tooltip: 'Specify request body',
},
],
outputs: [
{
number: 1,
@ -26,11 +80,32 @@ const details = ():IpluginDetails => ({
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (args:IpluginInputArgs):IpluginOutputArgs => {
const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
const lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
const method = String(args.inputs.method);
const requestUrl = String(args.inputs.requestUrl);
const requestHeaders = JSON.parse(String(args.inputs.requestHeaders));
const requestBody = JSON.parse(String(args.inputs.requestBody));
const requestConfig = {
method,
url: requestUrl,
headers: requestHeaders,
data: requestBody,
};
try {
const res = await args.deps.axios(requestConfig);
args.jobLog(`Web request succeeded: Status Code: ${res.status}`);
} catch (err) {
args.jobLog('Web Request Failed');
args.jobLog(JSON.stringify(err));
throw new Error('Web Request Failed');
}
return {
outputFileObj: args.inputFileObj,
outputNumber: 1,