refactor: inline auth, data, triggers and actions in apps

This commit is contained in:
Ali BARIN
2022-10-28 15:48:39 +02:00
parent 179fe512af
commit 9a973c8257
47 changed files with 233 additions and 167 deletions

View File

@@ -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,

View File

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

View File

@@ -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: [
{

View File

@@ -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,
});

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',
key: 'searchTerm',
type: 'string',
type: 'string' as const,
required: true,
},
],

View File

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