chore: remove redundant generate auth url mutation
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
// Converted mutations
|
// Converted mutations
|
||||||
import verifyConnection from './mutations/verify-connection.js';
|
import verifyConnection from './mutations/verify-connection.js';
|
||||||
import generateAuthUrl from './mutations/generate-auth-url.js';
|
|
||||||
import resetConnection from './mutations/reset-connection.js';
|
import resetConnection from './mutations/reset-connection.js';
|
||||||
import updateConnection from './mutations/update-connection.js';
|
import updateConnection from './mutations/update-connection.js';
|
||||||
|
|
||||||
const mutationResolvers = {
|
const mutationResolvers = {
|
||||||
generateAuthUrl,
|
|
||||||
resetConnection,
|
resetConnection,
|
||||||
updateConnection,
|
updateConnection,
|
||||||
verifyConnection,
|
verifyConnection,
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
import globalVariable from '../../helpers/global-variable.js';
|
|
||||||
import App from '../../models/app.js';
|
|
||||||
|
|
||||||
const generateAuthUrl = async (_parent, params, context) => {
|
|
||||||
context.currentUser.can('create', 'Connection');
|
|
||||||
|
|
||||||
const connection = await context.currentUser
|
|
||||||
.$relatedQuery('connections')
|
|
||||||
.findOne({
|
|
||||||
id: params.input.id,
|
|
||||||
})
|
|
||||||
.throwIfNotFound();
|
|
||||||
|
|
||||||
if (!connection.formattedData) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const authInstance = (
|
|
||||||
await import(`../../apps/${connection.key}/auth/index.js`)
|
|
||||||
).default;
|
|
||||||
|
|
||||||
const app = await App.findOneByKey(connection.key);
|
|
||||||
|
|
||||||
const $ = await globalVariable({ connection, app });
|
|
||||||
await authInstance.generateAuthUrl($);
|
|
||||||
|
|
||||||
return connection.formattedData;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default generateAuthUrl;
|
|
@@ -1,23 +1,13 @@
|
|||||||
type Query {
|
type Query {
|
||||||
placeholderQuery(name: String): Boolean
|
placeholderQuery(name: String): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
|
|
||||||
resetConnection(input: ResetConnectionInput): Connection
|
resetConnection(input: ResetConnectionInput): Connection
|
||||||
updateConnection(input: UpdateConnectionInput): Connection
|
updateConnection(input: UpdateConnectionInput): Connection
|
||||||
verifyConnection(input: VerifyConnectionInput): Connection
|
verifyConnection(input: VerifyConnectionInput): Connection
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
|
||||||
Exposes a URL that specifies the behaviour of this scalar.
|
|
||||||
"""
|
|
||||||
directive @specifiedBy(
|
|
||||||
"""
|
|
||||||
The URL that specifies the behaviour of this scalar.
|
|
||||||
"""
|
|
||||||
url: String!
|
|
||||||
) on SCALAR
|
|
||||||
|
|
||||||
type Trigger {
|
type Trigger {
|
||||||
name: String
|
name: String
|
||||||
key: String
|
key: String
|
||||||
@@ -130,10 +120,6 @@ type AuthenticationStepProperty {
|
|||||||
value: String
|
value: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthLink {
|
|
||||||
url: String
|
|
||||||
}
|
|
||||||
|
|
||||||
type Connection {
|
type Connection {
|
||||||
id: String
|
id: String
|
||||||
key: String
|
key: String
|
||||||
@@ -200,10 +186,6 @@ type SamlAuthProvidersRoleMapping {
|
|||||||
remoteRoleName: String
|
remoteRoleName: String
|
||||||
}
|
}
|
||||||
|
|
||||||
input GenerateAuthUrlInput {
|
|
||||||
id: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
input UpdateConnectionInput {
|
input UpdateConnectionInput {
|
||||||
id: String!
|
id: String!
|
||||||
formattedData: JSONObject
|
formattedData: JSONObject
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
export const GENERATE_AUTH_URL = gql`
|
|
||||||
mutation generateAuthUrl($input: GenerateAuthUrlInput) {
|
|
||||||
generateAuthUrl(input: $input) {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
@@ -1,12 +1,11 @@
|
|||||||
import { UPDATE_CONNECTION } from './update-connection';
|
import { UPDATE_CONNECTION } from './update-connection';
|
||||||
import { VERIFY_CONNECTION } from './verify-connection';
|
import { VERIFY_CONNECTION } from './verify-connection';
|
||||||
import { RESET_CONNECTION } from './reset-connection';
|
import { RESET_CONNECTION } from './reset-connection';
|
||||||
import { GENERATE_AUTH_URL } from './generate-auth-url';
|
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
updateConnection: UPDATE_CONNECTION,
|
updateConnection: UPDATE_CONNECTION,
|
||||||
verifyConnection: VERIFY_CONNECTION,
|
verifyConnection: VERIFY_CONNECTION,
|
||||||
resetConnection: RESET_CONNECTION,
|
resetConnection: RESET_CONNECTION,
|
||||||
generateAuthUrl: GENERATE_AUTH_URL,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default mutations;
|
export default mutations;
|
||||||
|
Reference in New Issue
Block a user