refactor: inline auth, data, triggers and actions in apps
This commit is contained in:
@@ -18,7 +18,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Repo',
|
||||
key: 'repo',
|
||||
type: 'dropdown',
|
||||
type: 'dropdown' as const,
|
||||
required: false,
|
||||
variables: false,
|
||||
source: {
|
||||
@@ -35,14 +35,14 @@ export default defineAction({
|
||||
{
|
||||
label: 'Title',
|
||||
key: 'title',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Body',
|
||||
key: 'body',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
variables: true,
|
||||
},
|
||||
|
3
packages/backend/src/apps/github/actions/index.ts
Normal file
3
packages/backend/src/apps/github/actions/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import createIssue from './create-issue';
|
||||
|
||||
export default [createIssue];
|
@@ -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/github/connections/add',
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
{
|
||||
key: 'consumerKey',
|
||||
label: 'Client ID',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
{
|
||||
key: 'consumerSecret',
|
||||
label: 'Client Secret',
|
||||
type: 'string',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -44,7 +44,7 @@ export default {
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -69,7 +69,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
@@ -80,7 +80,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'openWithPopup',
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
@@ -91,7 +91,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -112,7 +112,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -125,7 +125,7 @@ export default {
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -136,7 +136,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -161,7 +161,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
@@ -172,7 +172,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'openWithPopup',
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
@@ -183,7 +183,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
@@ -204,7 +204,7 @@ export default {
|
||||
},
|
||||
{
|
||||
step: 6,
|
||||
type: 'mutation',
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
|
7
packages/backend/src/apps/github/data/index.ts
Normal file
7
packages/backend/src/apps/github/data/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import listLabels from './list-labels';
|
||||
import listRepos from './list-repos';
|
||||
|
||||
export default [
|
||||
listLabels,
|
||||
listRepos,
|
||||
];
|
@@ -1,5 +1,9 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
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({
|
||||
name: 'Github',
|
||||
@@ -11,4 +15,8 @@ export default defineApp({
|
||||
primaryColor: '000000',
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
triggers,
|
||||
actions,
|
||||
data,
|
||||
});
|
||||
|
11
packages/backend/src/apps/github/triggers/index.ts
Normal file
11
packages/backend/src/apps/github/triggers/index.ts
Normal 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,
|
||||
];
|
@@ -18,7 +18,7 @@ export default defineTrigger({
|
||||
{
|
||||
label: 'Repo',
|
||||
key: 'repo',
|
||||
type: 'dropdown',
|
||||
type: 'dropdown' as const,
|
||||
required: false,
|
||||
variables: false,
|
||||
source: {
|
||||
@@ -35,7 +35,7 @@ export default defineTrigger({
|
||||
{
|
||||
label: 'Which types of issues should this trigger on?',
|
||||
key: 'issueType',
|
||||
type: 'dropdown',
|
||||
type: 'dropdown' as const,
|
||||
description: 'Defaults to any issue you can see.',
|
||||
required: true,
|
||||
variables: false,
|
||||
@@ -66,7 +66,7 @@ export default defineTrigger({
|
||||
{
|
||||
label: 'Label',
|
||||
key: 'label',
|
||||
type: 'dropdown',
|
||||
type: 'dropdown' as const,
|
||||
description: 'Only trigger on issues when this label is added.',
|
||||
required: false,
|
||||
variables: false,
|
||||
|
@@ -18,7 +18,7 @@ export default defineTrigger({
|
||||
{
|
||||
label: 'Repo',
|
||||
key: 'repo',
|
||||
type: 'dropdown',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
variables: false,
|
||||
source: {
|
||||
|
@@ -18,7 +18,7 @@ export default defineTrigger({
|
||||
{
|
||||
label: 'Repo',
|
||||
key: 'repo',
|
||||
type: 'dropdown',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
variables: false,
|
||||
source: {
|
||||
|
@@ -18,7 +18,7 @@ export default defineTrigger({
|
||||
{
|
||||
label: 'Repo',
|
||||
key: 'repo',
|
||||
type: 'dropdown',
|
||||
type: 'dropdown' as const,
|
||||
required: true,
|
||||
variables: false,
|
||||
source: {
|
||||
|
Reference in New Issue
Block a user