refactor: inline auth, data, triggers and actions in apps
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { IActionOutput } from '@automatisch/types';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
export default defineAction({
|
||||
@@ -17,7 +16,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Tweet body',
|
||||
key: 'tweet',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
description: 'The content of your new tweet.',
|
||||
variables: true,
|
||||
|
3
packages/backend/src/apps/twitter/actions/index.ts
Normal file
3
packages/backend/src/apps/twitter/actions/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import createTweet from './create-tweet';
|
||||
|
||||
export default [createTweet];
|
@@ -7,7 +7,7 @@ export default {
|
||||
{
|
||||
key: 'oAuthRedirectUrl',
|
||||
label: 'OAuth Redirect URL',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: true,
|
||||
value: '{WEB_APP_URL}/app/twitter/connections/add',
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
{
|
||||
key: 'consumerKey',
|
||||
label: 'API Key',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -30,7 +30,7 @@ export default {
|
||||
{
|
||||
key: 'consumerSecret',
|
||||
label: 'API Secret',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'openWithPopup',
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
@@ -89,7 +89,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -123,7 +123,7 @@ export default {
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -134,7 +134,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -159,7 +159,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
@@ -170,7 +170,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'openWithPopup',
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
@@ -181,7 +181,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -202,7 +202,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 6,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import actions from './actions';
|
||||
import triggers from './triggers';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Twitter',
|
||||
@@ -11,4 +14,7 @@ export default defineApp({
|
||||
apiBaseUrl: 'https://api.twitter.com',
|
||||
primaryColor: '1da1f2',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
actions,
|
||||
});
|
||||
|
11
packages/backend/src/apps/twitter/triggers/index.ts
Normal file
11
packages/backend/src/apps/twitter/triggers/index.ts
Normal 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,
|
||||
];
|
@@ -19,7 +19,7 @@ export default defineTrigger({
|
||||
{
|
||||
label: 'Search Term',
|
||||
key: 'searchTerm',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
|
@@ -18,7 +18,7 @@ export default defineTrigger({
|
||||
{
|
||||
label: 'Username',
|
||||
key: 'username',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
|
Reference in New Issue
Block a user