Merge pull request #674 from automatisch/remove-reconnection-steps
Remove reconnection steps
This commit is contained in:
@@ -55,7 +55,6 @@ export default {
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
@@ -84,7 +83,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
@@ -95,7 +93,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
@@ -106,7 +103,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
@@ -127,7 +123,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
@@ -138,102 +133,6 @@ export default {
|
||||
]
|
||||
}
|
||||
],
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}'
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}'
|
||||
},
|
||||
{
|
||||
name: 'botToken',
|
||||
value: '{fields.botToken}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.code}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 6,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
verifyCredentials,
|
||||
|
@@ -43,7 +43,6 @@ export default {
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
@@ -68,7 +67,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
@@ -79,7 +77,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
@@ -90,7 +87,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
@@ -111,7 +107,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
@@ -122,98 +117,6 @@ export default {
|
||||
]
|
||||
}
|
||||
],
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}'
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.oauth_verifier}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 6,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
verifyCredentials,
|
||||
|
@@ -43,7 +43,6 @@ export default {
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
@@ -68,7 +67,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
@@ -79,7 +77,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
@@ -90,7 +87,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
@@ -111,7 +107,6 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
@@ -122,98 +117,6 @@ export default {
|
||||
]
|
||||
}
|
||||
],
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}'
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.code}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
step: 6,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
verifyCredentials,
|
||||
|
@@ -41,7 +41,6 @@ export default {
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
@@ -66,7 +65,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
@@ -77,7 +75,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
@@ -88,7 +85,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
@@ -113,7 +109,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
@@ -124,102 +119,6 @@ export default {
|
||||
],
|
||||
},
|
||||
],
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}',
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'code',
|
||||
value: '{openAuthPopup.code}',
|
||||
},
|
||||
{
|
||||
name: 'state',
|
||||
value: '{openAuthPopup.state}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 6,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
verifyCredentials,
|
||||
|
@@ -88,7 +88,6 @@ export default {
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
@@ -129,7 +128,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
@@ -140,71 +138,6 @@ export default {
|
||||
],
|
||||
},
|
||||
],
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'host',
|
||||
value: '{fields.host}',
|
||||
},
|
||||
{
|
||||
name: 'username',
|
||||
value: '{fields.username}',
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
value: '{fields.password}',
|
||||
},
|
||||
{
|
||||
name: 'useTLS',
|
||||
value: '{fields.useTls}',
|
||||
},
|
||||
{
|
||||
name: 'port',
|
||||
value: '{fields.port}',
|
||||
},
|
||||
{
|
||||
name: 'fromEmail',
|
||||
value: '{fields.fromEmail}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
||||
|
@@ -29,7 +29,6 @@ export default {
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
@@ -54,7 +53,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
@@ -65,55 +63,6 @@ export default {
|
||||
],
|
||||
},
|
||||
],
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'accountSid',
|
||||
value: '{fields.accountSid}',
|
||||
},
|
||||
{
|
||||
name: 'authToken',
|
||||
value: '{fields.authToken}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
|
@@ -41,7 +41,6 @@ export default {
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'createConnection',
|
||||
arguments: [
|
||||
@@ -66,7 +65,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
@@ -77,7 +75,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
@@ -88,7 +85,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
@@ -109,7 +105,6 @@ export default {
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
@@ -120,98 +115,6 @@ export default {
|
||||
],
|
||||
},
|
||||
],
|
||||
reconnectionSteps: [
|
||||
{
|
||||
step: 1,
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 2,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}',
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 3,
|
||||
type: 'mutation' as const,
|
||||
name: 'createAuthData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 4,
|
||||
type: 'openWithPopup' as const,
|
||||
name: 'openAuthPopup',
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 5,
|
||||
type: 'mutation' as const,
|
||||
name: 'updateConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
value: null,
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.oauth_verifier}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: 6,
|
||||
type: 'mutation' as const,
|
||||
name: 'verifyConnection',
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
verifyCredentials,
|
||||
|
@@ -126,7 +126,6 @@ type Auth {
|
||||
}
|
||||
|
||||
type AuthenticationStep {
|
||||
step: Int
|
||||
type: String
|
||||
name: String
|
||||
arguments: [AuthenticationStepArgument]
|
||||
@@ -316,7 +315,6 @@ input PreviousStepInput {
|
||||
}
|
||||
|
||||
type ReconnectionStep {
|
||||
step: Int
|
||||
type: String
|
||||
name: String
|
||||
arguments: [ReconnectionStepArgument]
|
||||
|
81
packages/backend/src/helpers/add-reconnection-steps.ts
Normal file
81
packages/backend/src/helpers/add-reconnection-steps.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { IApp, IAuthenticationStep, IAuthenticationStepField } from '@automatisch/types';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
|
||||
const connectionIdArgument = {
|
||||
name: 'id',
|
||||
value: '{connection.id}',
|
||||
};
|
||||
|
||||
const resetConnectionStep = {
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
connectionIdArgument,
|
||||
],
|
||||
};
|
||||
|
||||
function replaceCreateConnection(string: string) {
|
||||
return string.replace(
|
||||
'{createConnection.id}',
|
||||
'{connection.id}'
|
||||
);
|
||||
}
|
||||
|
||||
function removeAppKeyArgument(args: IAuthenticationStepField[]) {
|
||||
return args.filter((argument) => argument.name !== 'key');
|
||||
}
|
||||
|
||||
function addConnectionId(step: IAuthenticationStep) {
|
||||
step.arguments = step.arguments.map((argument) => {
|
||||
if (typeof argument.value === 'string') {
|
||||
argument.value = replaceCreateConnection(argument.value);
|
||||
}
|
||||
|
||||
if (argument.properties) {
|
||||
argument.properties = argument.properties.map((property) => {
|
||||
return {
|
||||
name: property.name,
|
||||
value: replaceCreateConnection(property.value),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return argument;
|
||||
});
|
||||
|
||||
return step;
|
||||
}
|
||||
|
||||
function replaceCreateConnectionsWithUpdate(steps: IAuthenticationStep[]) {
|
||||
const updatedSteps = cloneDeep(steps);
|
||||
return updatedSteps.map((step) => {
|
||||
const updatedStep = addConnectionId(step);
|
||||
|
||||
if (step.name === 'createConnection') {
|
||||
updatedStep.name = 'updateConnection';
|
||||
updatedStep.arguments = removeAppKeyArgument(updatedStep.arguments);
|
||||
updatedStep.arguments.unshift(connectionIdArgument);
|
||||
|
||||
return updatedStep;
|
||||
}
|
||||
|
||||
return step;
|
||||
})
|
||||
}
|
||||
|
||||
function addReconnectionSteps(app: IApp): IApp {
|
||||
const hasReconnectionSteps = app.auth.reconnectionSteps;
|
||||
|
||||
if (hasReconnectionSteps) return app;
|
||||
|
||||
const updatedSteps = replaceCreateConnectionsWithUpdate(app.auth.authenticationSteps);
|
||||
|
||||
app.auth.reconnectionSteps = [
|
||||
resetConnectionStep,
|
||||
...updatedSteps,
|
||||
]
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
export default addReconnectionSteps;
|
@@ -6,6 +6,7 @@ import {
|
||||
ITrigger,
|
||||
} from '@automatisch/types';
|
||||
import { omit, cloneDeep } from 'lodash';
|
||||
import addReconnectionSteps from './add-reconnection-steps';
|
||||
|
||||
async function getDefaultExport(path: string) {
|
||||
return (await import(path)).default;
|
||||
@@ -16,7 +17,11 @@ function stripFunctions<C>(data: C): C {
|
||||
}
|
||||
|
||||
const getApp = async (appKey: string, stripFuncs = true) => {
|
||||
const appData: IApp = cloneDeep(await getDefaultExport(`../apps/${appKey}`));
|
||||
let appData: IApp = cloneDeep(await getDefaultExport(`../apps/${appKey}`));
|
||||
|
||||
if (appData.auth) {
|
||||
appData = addReconnectionSteps(appData);
|
||||
}
|
||||
|
||||
appData.triggers = appData?.triggers?.map((trigger: IRawTrigger) => {
|
||||
return addStaticSubsteps('trigger', appData, trigger);
|
||||
|
3
packages/types/index.d.ts
vendored
3
packages/types/index.d.ts
vendored
@@ -143,7 +143,6 @@ export interface IAuthenticationStepField {
|
||||
}
|
||||
|
||||
export interface IAuthenticationStep {
|
||||
step: number;
|
||||
type: 'mutation' | 'openWithPopup';
|
||||
name: string;
|
||||
arguments: IAuthenticationStepField[];
|
||||
@@ -183,7 +182,7 @@ export interface IAuth {
|
||||
isStillVerified($: IGlobalVariable): Promise<boolean>;
|
||||
fields: IField[];
|
||||
authenticationSteps: IAuthenticationStep[];
|
||||
reconnectionSteps: IAuthenticationStep[];
|
||||
reconnectionSteps?: IAuthenticationStep[];
|
||||
}
|
||||
|
||||
export interface IService {
|
||||
|
@@ -87,7 +87,7 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement {
|
||||
alignItems="flex-start"
|
||||
spacing={1}
|
||||
>
|
||||
<Typography variant="h6">
|
||||
<Typography variant="h6" sx={{ textAlign: 'left' }}>
|
||||
{formattedData?.screenName}
|
||||
</Typography>
|
||||
|
||||
|
@@ -27,7 +27,6 @@ export const GET_APP = gql`
|
||||
}
|
||||
}
|
||||
authenticationSteps {
|
||||
step
|
||||
type
|
||||
name
|
||||
arguments {
|
||||
@@ -41,7 +40,6 @@ export const GET_APP = gql`
|
||||
}
|
||||
}
|
||||
reconnectionSteps {
|
||||
step
|
||||
type
|
||||
name
|
||||
arguments {
|
||||
|
@@ -24,7 +24,6 @@ export const GET_APPS = gql`
|
||||
clickToCopy
|
||||
}
|
||||
authenticationSteps {
|
||||
step
|
||||
type
|
||||
name
|
||||
arguments {
|
||||
@@ -38,7 +37,6 @@ export const GET_APPS = gql`
|
||||
}
|
||||
}
|
||||
reconnectionSteps {
|
||||
step
|
||||
type
|
||||
name
|
||||
arguments {
|
||||
|
Reference in New Issue
Block a user