graphql-lint-clint-platform
Version:
GraphQL unused fields linter for Clint platform - Custom patterns and actions.graphql support
79 lines (68 loc) • 1.89 kB
text/typescript
// Simulação de código da Clint Platform para testes
import { gql } from 'graphql-tag';
// Exemplos de uso das actions do Hasura
export const userActions = {
// Actions em uso
getUserProfile: gql`
query GetUserProfile($userId: ID!) {
user_get_profile(userId: $userId) {
id
name
email
}
}
`,
updateUserProfile: gql`
mutation UpdateUserProfile($userId: ID!, $input: UserUpdateInput!) {
user_update_profile(userId: $userId, input: $input) {
success
user {
id
name
}
}
}
`,
getWalletBalance: gql`
query GetWalletBalance($walletId: ID!) {
wallet_get_balance(walletId: $walletId) {
balance
currency
}
}
`,
processPayment: gql`
mutation ProcessPayment($input: PaymentInput!) {
payment_process_transaction(input: $input) {
transactionId
status
}
}
`,
// Sagas usage patterns
fetchUserProfileSaga: function* (action: any) {
// Saga usando action indiretamente
const { userId } = action.payload;
yield call(clint.user.getProfile, userId);
},
fetchWalletBalanceSaga: function* (action: any) {
const walletId = action.payload.walletId;
yield call(clint.wallet.getBalance, walletId);
},
companyAnalyticsSaga: function* () {
yield call(clint.company.getAnalytics, { companyId: '123' });
},
// Uso de variáveis de padrões
notificationUsage: {
markRead: 'clint.notification.markRead',
getUnread: 'clint.notificationGetUnread'
},
// Actions usadas em strings/configs
apiEndpoints: {
userProfile: 'userGetProfile',
walletBalance: 'walletGetBalance',
analytics: 'analyticsGetReports'
}
};
// Muitas actions ficaram sem uso e devem aparecer como não utilizadas
// Exemplo: file_upload, search_global, system_get_health, etc.