Skip to content

Commit

Permalink
feat: remove vite-plugin-graphql-loader HP-2410
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkojamG committed May 3, 2024
1 parent 77a43e3 commit a732953
Show file tree
Hide file tree
Showing 33 changed files with 1,508 additions and 429 deletions.
7 changes: 6 additions & 1 deletion codegen.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
overwrite: true
schema: 'https://profile-api.dev.hel.ninja/graphql/'
documents: ['./src/**/*.graphql']
documents: ['./src/gdprApi/graphql/*.ts', './src/profile/graphql/*.ts']
config:
# typescript
avoidOptionals:
Expand All @@ -15,6 +15,10 @@ config:
dedupeOperationSuffix: true
preResolveTypes: true
skipTypeNameForRoot: true

#typescript-react-apollo
withHooks: true
withComponent: false
generates:
./src/graphql/generatedTypes.ts:
plugins:
Expand All @@ -26,3 +30,4 @@ generates:
- '// This file was automatically generated and should not be edited.'
- 'typescript'
- 'typescript-operations'
- 'typescript-react-apollo'
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@
"validator": "^13.7.0",
"vite": "^5.1.7",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-graphql-loader": "^3.0.1",
"vite-plugin-node-polyfills": "^0.21.0",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.1",
"vitest": "^1.3.1",
"vitest": "^1.5.2",
"vitest-fetch-mock": "^0.2.2",
"yup": "^0.32.5"
},
Expand Down Expand Up @@ -113,6 +112,7 @@
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/typescript": "^4.0.6",
"@graphql-codegen/typescript-operations": "^4.2.0",
"@graphql-codegen/typescript-react-apollo": "^4.3.0",
"@vitest/coverage-istanbul": "^1.3.1",
"cross-env": "^7.0.3",
"helsinki-utils": "City-of-Helsinki/helsinki-utils-js#0.1.0",
Expand Down
1 change: 1 addition & 0 deletions src/BrowserApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { disableTrackingCookiesUntilConsentGiven } from './common/helpers/tracki

function BrowserApp(): React.ReactElement {
disableTrackingCookiesUntilConsentGiven();

return (
<I18nextProvider i18n={i18n}>
<BrowserRouter>
Expand Down
2 changes: 1 addition & 1 deletion src/gdprApi/actions/deleteProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import parseDeleteProfileResult, {
} from '../../profile/helpers/parseDeleteProfileResult';
import { convertStringToTranslationLanguage } from '../../profile/helpers/createServiceConnectionsQueryVariables';
import reportErrorsToSentry from '../../common/sentry/reportErrorsToSentry';
import DELETE_PROFILE from '../graphql/GdprDeleteMyProfileMutation.graphql';
import { DELETE_PROFILE } from '../graphql/GdprDeleteMyProfileMutation';
import parseGraphQLError from '../../profile/helpers/parseGraphQLError';

export const deleteProfileType = 'deleteProfile';
Expand Down
2 changes: 1 addition & 1 deletion src/gdprApi/actions/deleteServiceConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getStoredTunnistamoAuthCode,
} from './authCodeParser';
import reportErrorsToSentry from '../../common/sentry/reportErrorsToSentry';
import DELETE_SERVICE_DATA from '../graphql/GdprDeleteServiceDataMutation.graphql';
import { DELETE_SERVICE_DATA } from '../graphql/GdprDeleteServiceDataMutation';
import parseGraphQLError from '../../profile/helpers/parseGraphQLError';

export const deleteServiceConnectionType = 'deleteServiceConnection';
Expand Down
2 changes: 1 addition & 1 deletion src/gdprApi/actions/getDownloadData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
getStoredTunnistamoAuthCode,
} from './authCodeParser';
import reportErrorsToSentry from '../../common/sentry/reportErrorsToSentry';
import DOWNLOAD_MY_PROFILE from '../../profile/graphql/DownloadMyProfileQuery.graphql';
import { DOWNLOAD_MY_PROFILE } from '../../profile/graphql/DownloadMyProfileQuery';
import parseGraphQLError from '../../profile/helpers/parseGraphQLError';

const downloadDataType = 'downloadData';
Expand Down
2 changes: 1 addition & 1 deletion src/gdprApi/actions/getServiceConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '../../common/actionQueue/actionQueue';
import { getActionResultAndErrorMessage } from './utils';
import reportErrorsToSentry from '../../common/sentry/reportErrorsToSentry';
import GDPR_SERVICE_CONNECTIONS from '../graphql/GdprServiceConnectionsQuery.graphql';
import { GDPR_SERVICE_CONNECTIONS } from '../graphql/GdprServiceConnectionsQuery';

const serviceConnectionsType = 'serviceConnections';

Expand Down
29 changes: 0 additions & 29 deletions src/gdprApi/graphql/GdprDeleteMyProfileMutation.graphql

This file was deleted.

33 changes: 33 additions & 0 deletions src/gdprApi/graphql/GdprDeleteMyProfileMutation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import gql from 'graphql-tag';

export const DELETE_PROFILE = gql`
fragment GdprDeleteMyProfileMutationDeleteMyProfileResultsErrors on ServiceConnectionDeletionError {
code
}
fragment GdprDeleteMyProfileMutationDeleteMyProfileResults on ServiceConnectionDeletionResult {
success
errors {
...GdprDeleteMyProfileMutationDeleteMyProfileResultsErrors
}
service {
name
title(language: $language)
}
}
fragment GdprDeleteMyProfileMutationDeleteMyProfile on DeleteMyProfileMutationPayload {
results {
...GdprDeleteMyProfileMutationDeleteMyProfileResults
}
}
mutation GdprDeleteMyProfile(
$input: DeleteMyProfileMutationInput!
$language: TranslationLanguage!
) {
deleteMyProfile(input: $input) {
...GdprDeleteMyProfileMutationDeleteMyProfile
}
}
`;
14 changes: 0 additions & 14 deletions src/gdprApi/graphql/GdprDeleteServiceDataMutation.graphql

This file was deleted.

18 changes: 18 additions & 0 deletions src/gdprApi/graphql/GdprDeleteServiceDataMutation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import gql from 'graphql-tag';

export const DELETE_SERVICE_DATA = gql`
fragment GdprDeleteMyServiceDataMutation on ServiceConnectionDeletionResult {
success
errors {
code
}
}
mutation GdprDeleteMyServiceData($input: DeleteMyServiceDataMutationInput!) {
deleteMyServiceData(input: $input) {
result {
...GdprDeleteMyServiceDataMutation
}
}
}
`;
33 changes: 0 additions & 33 deletions src/gdprApi/graphql/GdprServiceConnectionsQuery.graphql

This file was deleted.

37 changes: 37 additions & 0 deletions src/gdprApi/graphql/GdprServiceConnectionsQuery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import gql from 'graphql-tag';

export const GDPR_SERVICE_CONNECTIONS = gql`
fragment GdprServiceConnectionsQueryMyProfileServiceConnectionsEdgesNodeService on ServiceNode {
name
gdprQueryScope
gdprDeleteScope
isPureKeycloak
}
fragment GdprServiceConnectionsQueryMyProfileServiceConnectionsEdgesNode on ServiceConnectionType {
service {
...GdprServiceConnectionsQueryMyProfileServiceConnectionsEdgesNodeService
}
}
fragment GdprServiceConnectionsQueryMyProfileServiceConnections on ServiceConnectionTypeConnection {
edges {
node {
...GdprServiceConnectionsQueryMyProfileServiceConnectionsEdgesNode
}
}
}
fragment GdprServiceConnectionsQueryMyProfile on ProfileNode {
id
serviceConnections {
...GdprServiceConnectionsQueryMyProfileServiceConnections
}
}
query GdprServiceConnections {
myProfile {
...GdprServiceConnectionsQueryMyProfile
}
}
`;
Loading

0 comments on commit a732953

Please sign in to comment.