Merge pull request #657 from automatisch/embed-actions-triggers-data-auth-in-app

refactor: inline auth, data, triggers and actions in apps
This commit is contained in:
Ömer Faruk Aydın
2022-10-28 23:33:22 +02:00
committed by GitHub
47 changed files with 233 additions and 167 deletions

View File

@@ -7,7 +7,7 @@ export default {
{ {
key: 'oAuthRedirectUrl', key: 'oAuthRedirectUrl',
label: 'OAuth Redirect URL', label: 'OAuth Redirect URL',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: true, readOnly: true,
value: '{WEB_APP_URL}/app/flickr/connections/add', value: '{WEB_APP_URL}/app/flickr/connections/add',
@@ -19,7 +19,7 @@ export default {
{ {
key: 'consumerKey', key: 'consumerKey',
label: 'Consumer Key', label: 'Consumer Key',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -31,7 +31,7 @@ export default {
{ {
key: 'consumerSecret', key: 'consumerSecret',
label: 'Consumer Secret', label: 'Consumer Secret',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -44,7 +44,7 @@ export default {
authenticationSteps: [ authenticationSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'createConnection', name: 'createConnection',
arguments: [ arguments: [
{ {
@@ -69,7 +69,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'createAuthData', name: 'createAuthData',
arguments: [ arguments: [
{ {
@@ -80,7 +80,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'openWithPopup', type: 'openWithPopup' as const,
name: 'openAuthPopup', name: 'openAuthPopup',
arguments: [ arguments: [
{ {
@@ -91,7 +91,7 @@ export default {
}, },
{ {
step: 4, step: 4,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -112,7 +112,7 @@ export default {
}, },
{ {
step: 5, step: 5,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {
@@ -125,7 +125,7 @@ export default {
reconnectionSteps: [ reconnectionSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'resetConnection', name: 'resetConnection',
arguments: [ arguments: [
{ {
@@ -136,7 +136,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -161,7 +161,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'mutation', type: 'mutation' as const,
name: 'createAuthData', name: 'createAuthData',
arguments: [ arguments: [
{ {
@@ -172,7 +172,7 @@ export default {
}, },
{ {
step: 4, step: 4,
type: 'openWithPopup', type: 'openWithPopup' as const,
name: 'openAuthPopup', name: 'openAuthPopup',
arguments: [ arguments: [
{ {
@@ -183,7 +183,7 @@ export default {
}, },
{ {
step: 5, step: 5,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -204,7 +204,7 @@ export default {
}, },
{ {
step: 6, step: 6,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {

View File

@@ -0,0 +1,3 @@
import listAlbums from './list-albums';
export default [listAlbums];

View File

@@ -1,5 +1,8 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import triggers from './triggers';
import data from './data';
export default defineApp({ export default defineApp({
name: 'Flickr', name: 'Flickr',
@@ -12,4 +15,7 @@ export default defineApp({
baseUrl: 'https://www.flickr.com/', baseUrl: 'https://www.flickr.com/',
apiBaseUrl: 'https://www.flickr.com/services', apiBaseUrl: 'https://www.flickr.com/services',
beforeRequest: [addAuthHeader], beforeRequest: [addAuthHeader],
auth,
triggers,
data,
}); });

View File

@@ -0,0 +1,11 @@
import newAlbums from './new-albums';
import newFavoritePhotos from './new-favorite-photos';
import newPhotos from './new-photos';
import newPhotosInAlbums from './new-photos-in-album';
export default [
newAlbums,
newFavoritePhotos,
newPhotos,
newPhotosInAlbums,
];

View File

@@ -18,7 +18,7 @@ export default defineTrigger({
{ {
label: 'Album', label: 'Album',
key: 'album', key: 'album',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
variables: false, variables: false,
source: { source: {

View File

@@ -18,7 +18,7 @@ export default defineAction({
{ {
label: 'Repo', label: 'Repo',
key: 'repo', key: 'repo',
type: 'dropdown', type: 'dropdown' as const,
required: false, required: false,
variables: false, variables: false,
source: { source: {
@@ -35,14 +35,14 @@ export default defineAction({
{ {
label: 'Title', label: 'Title',
key: 'title', key: 'title',
type: 'string', type: 'string' as const,
required: true, required: true,
variables: true, variables: true,
}, },
{ {
label: 'Body', label: 'Body',
key: 'body', key: 'body',
type: 'string', type: 'string' as const,
required: true, required: true,
variables: true, variables: true,
}, },

View File

@@ -0,0 +1,3 @@
import createIssue from './create-issue';
export default [createIssue];

View File

@@ -7,7 +7,7 @@ export default {
{ {
key: 'oAuthRedirectUrl', key: 'oAuthRedirectUrl',
label: 'OAuth Redirect URL', label: 'OAuth Redirect URL',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: true, readOnly: true,
value: '{WEB_APP_URL}/app/github/connections/add', value: '{WEB_APP_URL}/app/github/connections/add',
@@ -19,7 +19,7 @@ export default {
{ {
key: 'consumerKey', key: 'consumerKey',
label: 'Client ID', label: 'Client ID',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -31,7 +31,7 @@ export default {
{ {
key: 'consumerSecret', key: 'consumerSecret',
label: 'Client Secret', label: 'Client Secret',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -44,7 +44,7 @@ export default {
authenticationSteps: [ authenticationSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'createConnection', name: 'createConnection',
arguments: [ arguments: [
{ {
@@ -69,7 +69,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'createAuthData', name: 'createAuthData',
arguments: [ arguments: [
{ {
@@ -80,7 +80,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'openWithPopup', type: 'openWithPopup' as const,
name: 'openAuthPopup', name: 'openAuthPopup',
arguments: [ arguments: [
{ {
@@ -91,7 +91,7 @@ export default {
}, },
{ {
step: 4, step: 4,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -112,7 +112,7 @@ export default {
}, },
{ {
step: 5, step: 5,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {
@@ -125,7 +125,7 @@ export default {
reconnectionSteps: [ reconnectionSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'resetConnection', name: 'resetConnection',
arguments: [ arguments: [
{ {
@@ -136,7 +136,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -161,7 +161,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'mutation', type: 'mutation' as const,
name: 'createAuthData', name: 'createAuthData',
arguments: [ arguments: [
{ {
@@ -172,7 +172,7 @@ export default {
}, },
{ {
step: 4, step: 4,
type: 'openWithPopup', type: 'openWithPopup' as const,
name: 'openAuthPopup', name: 'openAuthPopup',
arguments: [ arguments: [
{ {
@@ -183,7 +183,7 @@ export default {
}, },
{ {
step: 5, step: 5,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -204,7 +204,7 @@ export default {
}, },
{ {
step: 6, step: 6,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {

View File

@@ -0,0 +1,7 @@
import listLabels from './list-labels';
import listRepos from './list-repos';
export default [
listLabels,
listRepos,
];

View File

@@ -1,5 +1,9 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import triggers from './triggers';
import actions from './actions';
import data from './data';
export default defineApp({ export default defineApp({
name: 'Github', name: 'Github',
@@ -11,4 +15,8 @@ export default defineApp({
primaryColor: '000000', primaryColor: '000000',
supportsConnections: true, supportsConnections: true,
beforeRequest: [addAuthHeader], beforeRequest: [addAuthHeader],
auth,
triggers,
actions,
data,
}); });

View File

@@ -0,0 +1,11 @@
import newIssues from './new-issues';
import newPullRequests from './new-pull-requests';
import newStargazers from './new-stargazers';
import newWatchers from './new-watchers';
export default [
newIssues,
newPullRequests,
newStargazers,
newWatchers,
];

View File

@@ -18,7 +18,7 @@ export default defineTrigger({
{ {
label: 'Repo', label: 'Repo',
key: 'repo', key: 'repo',
type: 'dropdown', type: 'dropdown' as const,
required: false, required: false,
variables: false, variables: false,
source: { source: {
@@ -35,7 +35,7 @@ export default defineTrigger({
{ {
label: 'Which types of issues should this trigger on?', label: 'Which types of issues should this trigger on?',
key: 'issueType', key: 'issueType',
type: 'dropdown', type: 'dropdown' as const,
description: 'Defaults to any issue you can see.', description: 'Defaults to any issue you can see.',
required: true, required: true,
variables: false, variables: false,
@@ -66,7 +66,7 @@ export default defineTrigger({
{ {
label: 'Label', label: 'Label',
key: 'label', key: 'label',
type: 'dropdown', type: 'dropdown' as const,
description: 'Only trigger on issues when this label is added.', description: 'Only trigger on issues when this label is added.',
required: false, required: false,
variables: false, variables: false,

View File

@@ -18,7 +18,7 @@ export default defineTrigger({
{ {
label: 'Repo', label: 'Repo',
key: 'repo', key: 'repo',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
variables: false, variables: false,
source: { source: {

View File

@@ -18,7 +18,7 @@ export default defineTrigger({
{ {
label: 'Repo', label: 'Repo',
key: 'repo', key: 'repo',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
variables: false, variables: false,
source: { source: {

View File

@@ -18,7 +18,7 @@ export default defineTrigger({
{ {
label: 'Repo', label: 'Repo',
key: 'repo', key: 'repo',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
variables: false, variables: false,
source: { source: {

View File

@@ -1,4 +1,5 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app';
import triggers from './triggers';
export default defineApp({ export default defineApp({
name: 'RSS', name: 'RSS',
@@ -10,4 +11,5 @@ export default defineApp({
apiBaseUrl: '', apiBaseUrl: '',
primaryColor: 'ff8800', primaryColor: 'ff8800',
beforeRequest: [], beforeRequest: [],
triggers,
}); });

View File

@@ -0,0 +1,3 @@
import newItemsInFeed from './new-items-in-feed';
export default [newItemsInFeed];

View File

@@ -14,7 +14,7 @@ export default defineTrigger({
{ {
label: 'Feed URL', label: 'Feed URL',
key: 'feedUrl', key: 'feedUrl',
type: 'string', type: 'string' as const,
required: true, required: true,
description: 'Paste your publicly accessible RSS URL here.', description: 'Paste your publicly accessible RSS URL here.',
variables: false, variables: false,

View File

@@ -1,9 +1,16 @@
export default { import defineApp from "../../helpers/define-app";
import triggers from './triggers';
export default defineApp({
name: "Scheduler", name: "Scheduler",
key: "scheduler", key: "scheduler",
iconUrl: "{BASE_URL}/apps/scheduler/assets/favicon.svg", iconUrl: "{BASE_URL}/apps/scheduler/assets/favicon.svg",
docUrl: "https://automatisch.io/docs/scheduler", docUrl: "https://automatisch.io/docs/scheduler",
authDocUrl: "https://automatisch.io/docs/connections/scheduler", authDocUrl: "https://automatisch.io/docs/connections/scheduler",
baseUrl: '',
apiBaseUrl: '',
primaryColor: "0059F7", primaryColor: "0059F7",
beforeRequest: [],
supportsConnections: false, supportsConnections: false,
}; triggers,
});

View File

@@ -17,7 +17,7 @@ export default defineTrigger({
{ {
label: 'Trigger on weekends?', label: 'Trigger on weekends?',
key: 'triggersOnWeekend', key: 'triggersOnWeekend',
type: 'dropdown', type: 'dropdown' as const,
description: 'Should this flow trigger on Saturday and Sunday?', description: 'Should this flow trigger on Saturday and Sunday?',
required: true, required: true,
value: true, value: true,
@@ -36,7 +36,7 @@ export default defineTrigger({
{ {
label: 'Time of day', label: 'Time of day',
key: 'hour', key: 'hour',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
value: null, value: null,
variables: false, variables: false,

View File

@@ -17,7 +17,7 @@ export default defineTrigger({
{ {
label: 'Trigger on weekends?', label: 'Trigger on weekends?',
key: 'triggersOnWeekend', key: 'triggersOnWeekend',
type: 'dropdown', type: 'dropdown' as const,
description: 'Should this flow trigger on Saturday and Sunday?', description: 'Should this flow trigger on Saturday and Sunday?',
required: true, required: true,
value: true, value: true,

View File

@@ -17,7 +17,7 @@ export default defineTrigger({
{ {
label: 'Day of the month', label: 'Day of the month',
key: 'day', key: 'day',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
value: null, value: null,
variables: false, variables: false,
@@ -151,7 +151,7 @@ export default defineTrigger({
{ {
label: 'Time of day', label: 'Time of day',
key: 'hour', key: 'hour',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
value: null, value: null,
variables: false, variables: false,

View File

@@ -17,7 +17,7 @@ export default defineTrigger({
{ {
label: 'Day of the week', label: 'Day of the week',
key: 'weekday', key: 'weekday',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
value: null, value: null,
variables: false, variables: false,
@@ -55,7 +55,7 @@ export default defineTrigger({
{ {
label: 'Time of day', label: 'Time of day',
key: 'hour', key: 'hour',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
value: null, value: null,
variables: false, variables: false,

View File

@@ -0,0 +1,11 @@
import everyHour from './every-hour';
import everyDay from './every-day';
import everyWeek from './every-week';
import everyMonth from './every-month';
export default [
everyHour,
everyDay,
everyWeek,
everyMonth,
];

View File

@@ -17,7 +17,7 @@ export default defineAction({
{ {
label: 'Search Query', label: 'Search Query',
key: 'query', key: 'query',
type: 'string', type: 'string' as const,
required: true, required: true,
description: description:
'Search query to use for finding matching messages. See the Slack Search Documentation for more information on constructing a query.', 'Search query to use for finding matching messages. See the Slack Search Documentation for more information on constructing a query.',
@@ -26,7 +26,7 @@ export default defineAction({
{ {
label: 'Sort by', label: 'Sort by',
key: 'sortBy', key: 'sortBy',
type: 'dropdown', type: 'dropdown' as const,
description: description:
'Sort messages by their match strength or by their date. Default is score.', 'Sort messages by their match strength or by their date. Default is score.',
required: true, required: true,
@@ -46,7 +46,7 @@ export default defineAction({
{ {
label: 'Sort direction', label: 'Sort direction',
key: 'sortDirection', key: 'sortDirection',
type: 'dropdown', type: 'dropdown' as const,
description: description:
'Sort matching messages in ascending or descending order. Default is descending.', 'Sort matching messages in ascending or descending order. Default is descending.',
required: true, required: true,

View File

@@ -0,0 +1,7 @@
import findMessage from './find-message';
import sendMessageToChannel from './send-a-message-to-channel';
export default [
findMessage,
sendMessageToChannel,
];

View File

@@ -17,7 +17,7 @@ export default defineAction({
{ {
label: 'Channel', label: 'Channel',
key: 'channel', key: 'channel',
type: 'dropdown', type: 'dropdown' as const,
required: true, required: true,
description: 'Pick a channel to send the message to.', description: 'Pick a channel to send the message to.',
variables: false, variables: false,
@@ -35,7 +35,7 @@ export default defineAction({
{ {
label: 'Message text', label: 'Message text',
key: 'message', key: 'message',
type: 'string', type: 'string' as const,
required: true, required: true,
description: 'The content of your new message.', description: 'The content of your new message.',
variables: true, variables: true,

View File

@@ -6,7 +6,7 @@ export default {
{ {
key: 'accessToken', key: 'accessToken',
label: 'Access Token', label: 'Access Token',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -18,7 +18,7 @@ export default {
authenticationSteps: [ authenticationSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'createConnection', name: 'createConnection',
arguments: [ arguments: [
{ {
@@ -39,7 +39,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {
@@ -52,7 +52,7 @@ export default {
reconnectionSteps: [ reconnectionSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'resetConnection', name: 'resetConnection',
arguments: [ arguments: [
{ {
@@ -63,7 +63,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -84,7 +84,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {

View File

@@ -0,0 +1,3 @@
import listChannels from './list-channels';
export default [listChannels];

View File

@@ -1,5 +1,8 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header';
import actions from './actions';
import auth from './auth';
import data from './data';
export default defineApp({ export default defineApp({
name: 'Slack', name: 'Slack',
@@ -11,4 +14,7 @@ export default defineApp({
apiBaseUrl: 'https://slack.com/api', apiBaseUrl: 'https://slack.com/api',
primaryColor: '4a154b', primaryColor: '4a154b',
beforeRequest: [addAuthHeader], beforeRequest: [addAuthHeader],
auth,
actions,
data,
}); });

View File

@@ -0,0 +1,3 @@
import sendEmail from './send-email';
export default [sendEmail];

View File

@@ -18,7 +18,7 @@ export default defineAction({
{ {
label: 'From name', label: 'From name',
key: 'fromName', key: 'fromName',
type: 'string', type: 'string' as const,
required: false, required: false,
description: 'Display name of the sender.', description: 'Display name of the sender.',
variables: true, variables: true,
@@ -26,7 +26,7 @@ export default defineAction({
{ {
label: 'From email', label: 'From email',
key: 'fromEmail', key: 'fromEmail',
type: 'string', type: 'string' as const,
required: true, required: true,
description: 'Email address of the sender.', description: 'Email address of the sender.',
variables: true, variables: true,
@@ -34,7 +34,7 @@ export default defineAction({
{ {
label: 'Reply to', label: 'Reply to',
key: 'replyTo', key: 'replyTo',
type: 'string', type: 'string' as const,
required: false, required: false,
description: description:
'Email address to reply to. Defaults to the from email address.', 'Email address to reply to. Defaults to the from email address.',
@@ -43,7 +43,7 @@ export default defineAction({
{ {
label: 'To', label: 'To',
key: 'to', key: 'to',
type: 'string', type: 'string' as const,
required: true, required: true,
description: description:
'Comma seperated list of email addresses to send the email to.', 'Comma seperated list of email addresses to send the email to.',
@@ -52,7 +52,7 @@ export default defineAction({
{ {
label: 'Cc', label: 'Cc',
key: 'cc', key: 'cc',
type: 'string', type: 'string' as const,
required: false, required: false,
description: 'Comma seperated list of email addresses.', description: 'Comma seperated list of email addresses.',
variables: true, variables: true,
@@ -60,7 +60,7 @@ export default defineAction({
{ {
label: 'Bcc', label: 'Bcc',
key: 'bcc', key: 'bcc',
type: 'string', type: 'string' as const,
required: false, required: false,
description: 'Comma seperated list of email addresses.', description: 'Comma seperated list of email addresses.',
variables: true, variables: true,
@@ -68,7 +68,7 @@ export default defineAction({
{ {
label: 'Subject', label: 'Subject',
key: 'subject', key: 'subject',
type: 'string', type: 'string' as const,
required: true, required: true,
description: 'Subject of the email.', description: 'Subject of the email.',
variables: true, variables: true,
@@ -76,7 +76,7 @@ export default defineAction({
{ {
label: 'Body', label: 'Body',
key: 'body', key: 'body',
type: 'string', type: 'string' as const,
required: true, required: true,
description: 'Body of the email.', description: 'Body of the email.',
variables: true, variables: true,

View File

@@ -6,7 +6,7 @@ export default {
{ {
key: 'host', key: 'host',
label: 'Host', label: 'Host',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -18,7 +18,7 @@ export default {
{ {
key: 'username', key: 'username',
label: 'Email/Username', label: 'Email/Username',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -30,7 +30,7 @@ export default {
{ {
key: 'password', key: 'password',
label: 'Password', label: 'Password',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -42,7 +42,7 @@ export default {
{ {
key: 'useTls', key: 'useTls',
label: 'Use TLS?', label: 'Use TLS?',
type: 'dropdown', type: 'dropdown' as const,
required: false, required: false,
readOnly: false, readOnly: false,
value: false, value: false,
@@ -64,10 +64,10 @@ export default {
{ {
key: 'port', key: 'port',
label: 'Port', label: 'Port',
type: 'string', type: 'string' as const,
required: false, required: false,
readOnly: false, readOnly: false,
value: 25, value: '25',
placeholder: null, placeholder: null,
description: null, description: null,
docUrl: 'https://automatisch.io/docs/smtp#port', docUrl: 'https://automatisch.io/docs/smtp#port',
@@ -76,7 +76,7 @@ export default {
{ {
key: 'fromEmail', key: 'fromEmail',
label: 'From Email', label: 'From Email',
type: 'string', type: 'string' as const,
required: false, required: false,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -89,7 +89,7 @@ export default {
authenticationSteps: [ authenticationSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'createConnection', name: 'createConnection',
arguments: [ arguments: [
{ {
@@ -130,7 +130,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {
@@ -143,7 +143,7 @@ export default {
reconnectionSteps: [ reconnectionSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'resetConnection', name: 'resetConnection',
arguments: [ arguments: [
{ {
@@ -154,7 +154,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -195,7 +195,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {

View File

@@ -1,4 +1,6 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app';
import auth from './auth';
import actions from './actions';
export default defineApp({ export default defineApp({
name: 'SMTP', name: 'SMTP',
@@ -10,4 +12,6 @@ export default defineApp({
apiBaseUrl: '', apiBaseUrl: '',
primaryColor: '2DAAE1', primaryColor: '2DAAE1',
beforeRequest: [], beforeRequest: [],
auth,
actions,
}); });

View File

@@ -0,0 +1,3 @@
import sendSms from './send-sms';
export default [sendSms];

View File

@@ -16,7 +16,7 @@ export default defineAction({
{ {
label: 'From Number', label: 'From Number',
key: 'fromNumber', key: 'fromNumber',
type: 'string', type: 'string' as const,
required: true, required: true,
description: description:
'The number to send the SMS from. Include country code. Example: 15551234567', 'The number to send the SMS from. Include country code. Example: 15551234567',
@@ -25,7 +25,7 @@ export default defineAction({
{ {
label: 'To Number', label: 'To Number',
key: 'toNumber', key: 'toNumber',
type: 'string', type: 'string' as const,
required: true, required: true,
description: description:
'The number to send the SMS to. Include country code. Example: 15551234567', 'The number to send the SMS to. Include country code. Example: 15551234567',
@@ -34,7 +34,7 @@ export default defineAction({
{ {
label: 'Message', label: 'Message',
key: 'message', key: 'message',
type: 'string', type: 'string' as const,
required: true, required: true,
description: 'The message to send.', description: 'The message to send.',
variables: true, variables: true,

View File

@@ -6,7 +6,7 @@ export default {
{ {
key: 'accountSid', key: 'accountSid',
label: 'Account SID', label: 'Account SID',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -18,7 +18,7 @@ export default {
{ {
key: 'authToken', key: 'authToken',
label: 'Auth Token', label: 'Auth Token',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -30,7 +30,7 @@ export default {
authenticationSteps: [ authenticationSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'createConnection', name: 'createConnection',
arguments: [ arguments: [
{ {
@@ -55,7 +55,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {
@@ -68,7 +68,7 @@ export default {
reconnectionSteps: [ reconnectionSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'resetConnection', name: 'resetConnection',
arguments: [ arguments: [
{ {
@@ -79,7 +79,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -104,7 +104,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {

View File

@@ -1,5 +1,7 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import actions from './actions';
export default defineApp({ export default defineApp({
name: 'Twilio', name: 'Twilio',
@@ -11,4 +13,6 @@ export default defineApp({
apiBaseUrl: 'https://api.twilio.com', apiBaseUrl: 'https://api.twilio.com',
primaryColor: 'e1000f', primaryColor: 'e1000f',
beforeRequest: [addAuthHeader], beforeRequest: [addAuthHeader],
auth,
actions,
}); });

View File

@@ -1,4 +1,3 @@
import { IActionOutput } from '@automatisch/types';
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action';
export default defineAction({ export default defineAction({
@@ -17,7 +16,7 @@ export default defineAction({
{ {
label: 'Tweet body', label: 'Tweet body',
key: 'tweet', key: 'tweet',
type: 'string', type: 'string' as const,
required: true, required: true,
description: 'The content of your new tweet.', description: 'The content of your new tweet.',
variables: true, variables: true,

View File

@@ -0,0 +1,3 @@
import createTweet from './create-tweet';
export default [createTweet];

View File

@@ -7,7 +7,7 @@ export default {
{ {
key: 'oAuthRedirectUrl', key: 'oAuthRedirectUrl',
label: 'OAuth Redirect URL', label: 'OAuth Redirect URL',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: true, readOnly: true,
value: '{WEB_APP_URL}/app/twitter/connections/add', value: '{WEB_APP_URL}/app/twitter/connections/add',
@@ -19,7 +19,7 @@ export default {
{ {
key: 'consumerKey', key: 'consumerKey',
label: 'API Key', label: 'API Key',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -30,7 +30,7 @@ export default {
{ {
key: 'consumerSecret', key: 'consumerSecret',
label: 'API Secret', label: 'API Secret',
type: 'string', type: 'string' as const,
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -42,7 +42,7 @@ export default {
authenticationSteps: [ authenticationSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'createConnection', name: 'createConnection',
arguments: [ arguments: [
{ {
@@ -67,7 +67,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'createAuthData', name: 'createAuthData',
arguments: [ arguments: [
{ {
@@ -78,7 +78,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'openWithPopup', type: 'openWithPopup' as const,
name: 'openAuthPopup', name: 'openAuthPopup',
arguments: [ arguments: [
{ {
@@ -89,7 +89,7 @@ export default {
}, },
{ {
step: 4, step: 4,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -110,7 +110,7 @@ export default {
}, },
{ {
step: 5, step: 5,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {
@@ -123,7 +123,7 @@ export default {
reconnectionSteps: [ reconnectionSteps: [
{ {
step: 1, step: 1,
type: 'mutation', type: 'mutation' as const,
name: 'resetConnection', name: 'resetConnection',
arguments: [ arguments: [
{ {
@@ -134,7 +134,7 @@ export default {
}, },
{ {
step: 2, step: 2,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -159,7 +159,7 @@ export default {
}, },
{ {
step: 3, step: 3,
type: 'mutation', type: 'mutation' as const,
name: 'createAuthData', name: 'createAuthData',
arguments: [ arguments: [
{ {
@@ -170,7 +170,7 @@ export default {
}, },
{ {
step: 4, step: 4,
type: 'openWithPopup', type: 'openWithPopup' as const,
name: 'openAuthPopup', name: 'openAuthPopup',
arguments: [ arguments: [
{ {
@@ -181,7 +181,7 @@ export default {
}, },
{ {
step: 5, step: 5,
type: 'mutation', type: 'mutation' as const,
name: 'updateConnection', name: 'updateConnection',
arguments: [ arguments: [
{ {
@@ -202,7 +202,7 @@ export default {
}, },
{ {
step: 6, step: 6,
type: 'mutation', type: 'mutation' as const,
name: 'verifyConnection', name: 'verifyConnection',
arguments: [ arguments: [
{ {

View File

@@ -1,5 +1,8 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import actions from './actions';
import triggers from './triggers';
export default defineApp({ export default defineApp({
name: 'Twitter', name: 'Twitter',
@@ -11,4 +14,7 @@ export default defineApp({
apiBaseUrl: 'https://api.twitter.com', apiBaseUrl: 'https://api.twitter.com',
primaryColor: '1da1f2', primaryColor: '1da1f2',
beforeRequest: [addAuthHeader], beforeRequest: [addAuthHeader],
auth,
triggers,
actions,
}); });

View File

@@ -0,0 +1,11 @@
import myTweets from './my-tweets';
import newFollowerOfMe from './new-follower-of-me';
import searchTweets from './search-tweets';
import userTweets from './user-tweets';
export default [
myTweets,
newFollowerOfMe,
searchTweets,
userTweets,
];

View File

@@ -19,7 +19,7 @@ export default defineTrigger({
{ {
label: 'Search Term', label: 'Search Term',
key: 'searchTerm', key: 'searchTerm',
type: 'string', type: 'string' as const,
required: true, required: true,
}, },
], ],

View File

@@ -18,7 +18,7 @@ export default defineTrigger({
{ {
label: 'Username', label: 'Username',
key: 'username', key: 'username',
type: 'string', type: 'string' as const,
required: true, required: true,
}, },
], ],

View File

@@ -1,8 +1,4 @@
import fs from 'fs'; import { IApp } from '@automatisch/types';
import { join } from 'path';
import { IApp, IAuth, IAction, ITrigger, IData } from '@automatisch/types';
const appsPath = join(__dirname, '../apps');
async function getDefaultExport(path: string) { async function getDefaultExport(path: string) {
return (await import(path)).default; return (await import(path)).default;
@@ -12,63 +8,12 @@ function stripFunctions<C>(data: C): C {
return JSON.parse(JSON.stringify(data)); return JSON.parse(JSON.stringify(data));
} }
async function getFileContent<C>(
path: string,
stripFuncs: boolean
): Promise<C> {
const fileContent = await getDefaultExport(path);
if (stripFuncs) {
return stripFunctions(fileContent);
}
return fileContent;
}
async function getChildrenContentInDirectory<C>(
path: string,
stripFuncs: boolean
): Promise<C[]> {
const appSubdirectory = join(appsPath, path);
const childrenContent = [];
if (fs.existsSync(appSubdirectory)) {
const filesInSubdirectory = fs.readdirSync(appSubdirectory);
for (const filename of filesInSubdirectory) {
const filePath = join(appSubdirectory, filename);
const fileContent = await getFileContent<C>(filePath, stripFuncs);
childrenContent.push(fileContent);
}
return childrenContent;
}
return [];
}
const getApp = async (appKey: string, stripFuncs = true) => { const getApp = async (appKey: string, stripFuncs = true) => {
const appData: IApp = await getDefaultExport(`../apps/${appKey}`); const appData: IApp = await getDefaultExport(`../apps/${appKey}`);
if (appData.supportsConnections) { if (stripFuncs) {
appData.auth = await getFileContent<IAuth>( return stripFunctions(appData);
`../apps/${appKey}/auth`,
stripFuncs
);
} }
appData.triggers = await getChildrenContentInDirectory<ITrigger>(
`${appKey}/triggers`,
stripFuncs
);
appData.actions = await getChildrenContentInDirectory<IAction>(
`${appKey}/actions`,
stripFuncs
);
appData.data = await getChildrenContentInDirectory<IData>(
`${appKey}/data`,
stripFuncs
);
return appData; return appData;
}; };

View File

@@ -136,7 +136,7 @@ export type IField = IFieldDropdown | IFieldText;
export interface IAuthenticationStepField { export interface IAuthenticationStepField {
name: string; name: string;
value: string | null; value: string | null;
properties: { properties?: {
name: string; name: string;
value: string; value: string;
}[]; }[];
@@ -178,7 +178,7 @@ export interface IData {
} }
export interface IAuth { export interface IAuth {
createAuthData($: IGlobalVariable): Promise<void>; createAuthData?($: IGlobalVariable): Promise<void>;
verifyCredentials($: IGlobalVariable): Promise<any>; verifyCredentials($: IGlobalVariable): Promise<any>;
isStillVerified($: IGlobalVariable): Promise<boolean>; isStillVerified($: IGlobalVariable): Promise<boolean>;
fields: IField[]; fields: IField[];