diff --git a/docs/technical-design/howto-migrations.md b/docs/technical-design/howto-migrations.md index 185dbdfdd8..030d88b42e 100644 --- a/docs/technical-design/howto-migrations.md +++ b/docs/technical-design/howto-migrations.md @@ -1,35 +1,56 @@ # How to complete migrations ## Background + Migrations are a controlled way to change existing records in the database or else change the shape of tables/relationships. They are necessary when fields are added, removed, or when the meaning behind fields and their relationships change. ## General Guidance -- Prioritize testing in environments that have data similar to production. If you are testing on a review app, you should pre-populate data through using the deployed app as a user or via Cypress runs to have a diversity of test data available. -- Run in all deployed environments and validate for each environment. -- Write migrations that can be tested repeatedly. Include logic to skip or handle data that has already been changed or doesn't need to be migrated, so repeated runs of the lambda don't result in bad data. -- Avoid making migrations directly dependent on a specific feature being available in production. + +- Prioritize testing in environments that have data similar to production. If you are testing on a review app, you should pre-populate data through using the deployed app as a user or via Cypress runs to have a diversity of test data available. +- Run in all deployed environments and validate for each environment. +- Write migrations that can be tested repeatedly. Include logic to skip or handle data that has already been changed or doesn't need to be migrated, so repeated runs of the lambda don't result in bad data. +- Avoid making migrations directly dependent on a specific feature being available in production. ## Data Migrations -Currently data migrations change existing records in the database. They are run as standalone lambdas that developers must manually trigger by environment. -### Steps +Currently data migrations change existing records in the database. They are run as standalone lambdas that developers must manually trigger by environment. They can be prototyped for fast feedback in the local environment, and then tested more thoroughly in lower environments. + +### Local prototyping + +1. Log into the AWS console (you'll need to be connected to the CMS VPN). +1. Go to the Dev environment dropdown: Cloud Access Roles --> Developer Admin --> Short-term Access Keys. +1. Choose option 1, and copy those values to the clipboard. +1. Paste the values into your .envrc.local file. Be sure that you're overwriting any previous values, and don't have duplicates. +1. If the app is running anywhere, stop it. +1. Run `DIRENV ALLOW` in the terminal in the directory where you'll start the app. +1. Start the app. +1. When the app is running, connect to the local database so that you can inspect the changes you're making. Use the DATABASE_URL from your .envrc.local file to connect to the database interface of your choice. You can connect via the terminal, or an app like TablePlus, dBeaver, Postico, DataGrip, etc. +1. Run some Cypress tests to populate the database. The CMSWorkflow tests are a good choice, since they create two entries which contain rates, one of which has a revision. +1. Verify that in the local database you can see entries in the HealthPlanPackageTable and HealthPlanRevisionTable. +1. Now you're ready to run your lambda. In a different terminal instance, run `DIRENV ALLOW` again. +1. Navigate to `services/app-api`. +1. Run `npx serverless invoke local --function `name_of_your_lambda``. You should see it build with webpack, then run. Any log statements you've put in your code will display in this window. +1. You can inspect the database again and should see any changes or additions you've made. + +### Running in a lower environment + 1. Prepare for manual testing in lower environments. - Build a PR review app off `main` to start out. Try to populate with submissions similar to what is in production (For example, populate submissions via Cypress and if there are specific submissions types you know you will need to test, make sure add them). 1. Write the migration with verbose logs. - - The migration will be written as a [Node lambda](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html) and live in `app-api/src/handlers`. Make sure you use ES6 async await. + - The migration will be written as a [Node lambda](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html) and live in `app-api/src/handlers`. Make sure you use ES6 async await. - Console statements are essential because there are line numbers in Cloudwatch when the migration fails or does not apply correctly. There is little additional context about why a run execution paused or failed. - Here is an example of verbose debug console statements wrapping a loop: - ![debug consoles in data migration script](../../.images/verbose-logs-example.png) + ![debug consoles in data migration script](../../.images/verbose-logs-example.png) 1. Write unit tests. - Consider including a test for `migration can be run repeatedly without data loss or unexpected results". Using repeatable migrations (when possible) makes it easier on developers and easier to unwind work. 1. Manually test the migration in your review app. - Log into [AWS Lambda Console](https://console.aws.amazon.com/lambda/home) and find the lambda. This means choosing `app-api-` lambda with your branch name and migration name included. - Click the Test tab and the `Test` button. Use the generic hello world event. - All output will appear inline on the same page as the lambda run. All consoles appear there as well. You can also click into a link from there into Cloudwatch to be able to see the entire output of logs around the lambda execution. - - If you need to debug quickly, without waiting for redeploy in review app use the severless CLI script. - - `serverless deploy function --function name_of_migration --stage my_branch && echo "DEPLOYED" && serverless logs --function name_of_migration --stage my_branch --tail` can be run in your `app-api` directory. This script deploys your local handler code directly to AWS, without going through our normal CI build process. `my_branch`is the name of your deployed Github branch and `name_of_migration` is the name of the migration file mind the file path. + - If you need to debug quickly, without waiting for redeploy in review app use the severless CLI script. + - `serverless deploy function --function name_of_migration --stage my_branch && echo "DEPLOYED" && serverless logs --function name_of_migration --stage my_branch --tail` can be run in your `app-api` directory. This script deploys your local handler code directly to AWS, without going through our normal CI build process. `my_branch`is the name of your deployed Github branch and `name_of_migration` is the name of the migration file mind the file path. - If this is to be run in DEV (`main`) you will have to reshape your `envrc.local` to imitate configuration on that stage. See AWS console for Lambda to reference the shape of config. - ![lambda configuration panel in aws](../../.images/aws-console-lambda-config.png) + ![lambda configuration panel in aws](../../.images/aws-console-lambda-config.png) - Command line serverless scripts should not be used on PROD. Ideally do not use in VAL either. Running a migration via the AWS lambda console web interface is preferred because it is guaranteed to build off merged code and use similar configuration to how our application is deployed in CI. 1. Define clear acceptance criteria, this will be re-used. - How do you know migration applied? What will be checked either in the app, via api request, or in the reports CSV? @@ -37,13 +58,12 @@ Currently data migrations change existing records in the database. They are run - If verification involves looking into reports and comparing fields, consider using a CSV tool like [CSVKit](https://csvkit.readthedocs.io/en/latest/index.html) if the comparisons seem involved. 1. After the PR merges and promotes,run in higher environments. - Start with DEV. Follow similar steps Step #4 but now using the `main` lambda for your migration. - - Run the migration DEV > VAL > PROD in order, verifying in the application (or via reporting output) after each run. - + - Run the migration DEV > VAL > PROD in order, verifying in the application (or via reporting output) after each run. ## Schema Migrations + We use Prisma to perform schema migrations. Right now the developer process for schema migrations is described a bit [here](../../README.md#updating-the-database). More detailed steps forthcoming. ## Proto migrations -The [proto migrations approach](../../services/app-proto/README.md#adding-a-new-migration) is no longer recommended - we are moving off protos. - +The [proto migrations approach](../../services/app-proto/README.md#adding-a-new-migration) is no longer recommended - we are moving off protos. diff --git a/services/app-api/.eslintrc b/services/app-api/.eslintrc index 08dcf5c2cd..e08580b989 100644 --- a/services/app-api/.eslintrc +++ b/services/app-api/.eslintrc @@ -24,6 +24,8 @@ "jest/no-identical-title": "error", "@typescript-eslint/no-floating-promises": "error", "no-unused-vars": "off", + "@typescript-eslint/consistent-type-exports": "error", + "@typescript-eslint/consistent-type-imports": "error", "@typescript-eslint/no-unused-vars": [ "warn", { "argsIgnorePattern": "^_*" } diff --git a/services/app-api/src/authn/authn.ts b/services/app-api/src/authn/authn.ts index 6655d4b27f..9efb168192 100644 --- a/services/app-api/src/authn/authn.ts +++ b/services/app-api/src/authn/authn.ts @@ -1,6 +1,6 @@ -import { Result } from 'neverthrow' -import { UserType } from '../domain-models' -import { Store } from '../postgres' +import type { Result } from 'neverthrow' +import type { UserType } from '../domain-models' +import type { Store } from '../postgres' export type userFromAuthProvider = ( authProvider: string, diff --git a/services/app-api/src/authn/cognitoAuthn.test.ts b/services/app-api/src/authn/cognitoAuthn.test.ts index ee625b3eff..c4c3c92b8a 100644 --- a/services/app-api/src/authn/cognitoAuthn.test.ts +++ b/services/app-api/src/authn/cognitoAuthn.test.ts @@ -1,6 +1,7 @@ -import { Result, ok, err } from 'neverthrow' +import type { Result } from 'neverthrow' +import { ok, err } from 'neverthrow' import { parseAuthProvider, userTypeFromAttributes } from './cognitoAuthn' -import { UserType } from '../domain-models' +import type { UserType } from '../domain-models' describe('cognitoAuthn', () => { describe('parseAuthProvider', () => { diff --git a/services/app-api/src/authn/cognitoAuthn.ts b/services/app-api/src/authn/cognitoAuthn.ts index 503bb08368..208d4b6b31 100644 --- a/services/app-api/src/authn/cognitoAuthn.ts +++ b/services/app-api/src/authn/cognitoAuthn.ts @@ -1,13 +1,15 @@ -import { Result, ok, err } from 'neverthrow' +import type { Result } from 'neverthrow' +import { ok, err } from 'neverthrow' +import type { UserType as CognitoUserType } from '@aws-sdk/client-cognito-identity-provider' import { CognitoIdentityProviderClient, ListUsersCommand, - UserType as CognitoUserType, } from '@aws-sdk/client-cognito-identity-provider' -import { UserType } from '../domain-models' +import type { UserType } from '../domain-models' import { performance } from 'perf_hooks' -import { Store, InsertUserArgsType, isStoreError } from '../postgres' +import type { Store, InsertUserArgsType } from '../postgres' +import { isStoreError } from '../postgres' import { isValidCmsDivison } from '../domain-models' export function parseAuthProvider( diff --git a/services/app-api/src/authn/index.ts b/services/app-api/src/authn/index.ts index cf6e2c7a29..485ebb656a 100644 --- a/services/app-api/src/authn/index.ts +++ b/services/app-api/src/authn/index.ts @@ -1,4 +1,4 @@ -export { userFromAuthProvider } from './authn' +export type { userFromAuthProvider } from './authn' export { userFromCognitoAuthProvider, lookupUserAurora } from './cognitoAuthn' diff --git a/services/app-api/src/authn/localAuthn.ts b/services/app-api/src/authn/localAuthn.ts index 5a9e0d547b..b0ccbc66fb 100644 --- a/services/app-api/src/authn/localAuthn.ts +++ b/services/app-api/src/authn/localAuthn.ts @@ -1,6 +1,8 @@ -import { Result, ok, err } from 'neverthrow' -import { UserType } from '../domain-models/index' -import { Store, InsertUserArgsType, isStoreError } from '../postgres' +import type { Result } from 'neverthrow' +import { ok, err } from 'neverthrow' +import type { UserType } from '../domain-models/index' +import type { Store, InsertUserArgsType } from '../postgres' +import { isStoreError } from '../postgres' import { lookupUserAurora } from './cognitoAuthn' export async function userFromLocalAuthProvider( diff --git a/services/app-api/src/domain-models/HealthPlanPackageType.d.ts b/services/app-api/src/domain-models/HealthPlanPackageType.d.ts index f6c33bf170..283ed1d008 100644 --- a/services/app-api/src/domain-models/HealthPlanPackageType.d.ts +++ b/services/app-api/src/domain-models/HealthPlanPackageType.d.ts @@ -1,4 +1,4 @@ -import { IndexQuestionsPayload } from './QuestionsType' +import type { IndexQuestionsPayload } from './QuestionsType' type HealthPlanPackageStatusType = | 'DRAFT' @@ -27,7 +27,7 @@ type HealthPlanRevisionType = { formDataProto: Uint8Array } -export { +export type { HealthPlanPackageStatusType, HealthPlanPackageType, UpdateInfoType, diff --git a/services/app-api/src/domain-models/QuestionResponseType.ts b/services/app-api/src/domain-models/QuestionResponseType.ts index dc4127c4eb..6faa2de340 100644 --- a/services/app-api/src/domain-models/QuestionResponseType.ts +++ b/services/app-api/src/domain-models/QuestionResponseType.ts @@ -1,4 +1,4 @@ -import { StateUserType } from './UserType' +import type { StateUserType } from './UserType' type QuestionResponseDocument = { name: string diff --git a/services/app-api/src/domain-models/QuestionsType.ts b/services/app-api/src/domain-models/QuestionsType.ts index 93df247ff0..7849aca2ee 100644 --- a/services/app-api/src/domain-models/QuestionsType.ts +++ b/services/app-api/src/domain-models/QuestionsType.ts @@ -1,6 +1,6 @@ -import { CMSUserType } from './UserType' -import { QuestionResponseType } from './QuestionResponseType' -import { DivisionType } from './DivisionType' +import type { CMSUserType } from './UserType' +import type { QuestionResponseType } from './QuestionResponseType' +import type { DivisionType } from './DivisionType' type Document = { name: string diff --git a/services/app-api/src/domain-models/UserType.d.ts b/services/app-api/src/domain-models/UserType.d.ts index b849f17299..3af2242568 100644 --- a/services/app-api/src/domain-models/UserType.d.ts +++ b/services/app-api/src/domain-models/UserType.d.ts @@ -1,5 +1,5 @@ -import { StateType } from './StateType' -import { DivisionType } from './DivisionType' +import type { StateType } from './StateType' +import type { DivisionType } from './DivisionType' type UserType = StateUserType | CMSUserType | AdminUserType | HelpdeskUserType diff --git a/services/app-api/src/domain-models/contractAndRates/index.ts b/services/app-api/src/domain-models/contractAndRates/index.ts index 0afb15232c..df42044686 100644 --- a/services/app-api/src/domain-models/contractAndRates/index.ts +++ b/services/app-api/src/domain-models/contractAndRates/index.ts @@ -19,4 +19,4 @@ export type { ContractFormDataType, } from './contractTypes' -export { ContractStatusType, UpdateInfoType } from './updateInfoType' +export type { ContractStatusType, UpdateInfoType } from './updateInfoType' diff --git a/services/app-api/src/domain-models/contractAndRates/updateInfoType.ts b/services/app-api/src/domain-models/contractAndRates/updateInfoType.ts index b7204919d3..5dff83667e 100644 --- a/services/app-api/src/domain-models/contractAndRates/updateInfoType.ts +++ b/services/app-api/src/domain-models/contractAndRates/updateInfoType.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { contractSchema } from './contractTypes' +import type { contractSchema } from './contractTypes' const updateInfoSchema = z.object({ updatedAt: z.date(), diff --git a/services/app-api/src/domain-models/division.ts b/services/app-api/src/domain-models/division.ts index af052c26c0..856c7845bd 100644 --- a/services/app-api/src/domain-models/division.ts +++ b/services/app-api/src/domain-models/division.ts @@ -1,4 +1,4 @@ -import { DivisionType } from './DivisionType' +import type { DivisionType } from './DivisionType' function isValidCmsDivison(division: string): division is DivisionType { return ['DMCO', 'DMCP', 'OACT'].includes(division) diff --git a/services/app-api/src/domain-models/healthPlanPackage.test.ts b/services/app-api/src/domain-models/healthPlanPackage.test.ts index 511cee5e6a..8b48fdef43 100644 --- a/services/app-api/src/domain-models/healthPlanPackage.test.ts +++ b/services/app-api/src/domain-models/healthPlanPackage.test.ts @@ -3,7 +3,7 @@ import { packageSubmittedAt, packageSubmitters, } from './healthPlanPackage' -import { +import type { HealthPlanPackageStatusType, HealthPlanPackageType, } from './HealthPlanPackageType' diff --git a/services/app-api/src/domain-models/healthPlanPackage.ts b/services/app-api/src/domain-models/healthPlanPackage.ts index 2a5dfa593b..7a8220ec16 100644 --- a/services/app-api/src/domain-models/healthPlanPackage.ts +++ b/services/app-api/src/domain-models/healthPlanPackage.ts @@ -1,11 +1,11 @@ -import { +import type { HealthPlanRevisionType, HealthPlanPackageStatusType, HealthPlanPackageType, } from './HealthPlanPackageType' import { pruneDuplicateEmails } from '../emailer/formatters' -import { ContractType } from './contractAndRates' -import { +import type { ContractType } from './contractAndRates' +import type { SubmissionDocument, UnlockedHealthPlanFormDataType, } from '../../../app-web/src/common-code/healthPlanFormDataType' diff --git a/services/app-api/src/domain-models/user.ts b/services/app-api/src/domain-models/user.ts index 53f402998a..9da6f2973c 100644 --- a/services/app-api/src/domain-models/user.ts +++ b/services/app-api/src/domain-models/user.ts @@ -1,11 +1,11 @@ -import { +import type { StateUserType, CMSUserType, UserType, AdminUserType, HelpdeskUserType, } from './UserType' -import { User as PrismaUser } from '@prisma/client' +import type { User as PrismaUser } from '@prisma/client' function isUser(user: unknown): user is UserType { if (user && typeof user === 'object') { diff --git a/services/app-api/src/emailer/awsSES.ts b/services/app-api/src/emailer/awsSES.ts index 474c66ab06..c7f4d8ed49 100644 --- a/services/app-api/src/emailer/awsSES.ts +++ b/services/app-api/src/emailer/awsSES.ts @@ -1,11 +1,10 @@ -import { - SESClient, +import type { SESServiceException, SendEmailRequest, SendEmailResponse, - SendEmailCommand, } from '@aws-sdk/client-ses' -import { EmailData } from './' +import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses' +import type { EmailData } from './' const ses = new SESClient({ region: 'us-east-1' }) diff --git a/services/app-api/src/emailer/emailer.ts b/services/app-api/src/emailer/emailer.ts index cf4ba47553..696206d713 100644 --- a/services/app-api/src/emailer/emailer.ts +++ b/services/app-api/src/emailer/emailer.ts @@ -9,11 +9,11 @@ import { resubmitPackageStateEmail, resubmitPackageCMSEmail, } from './' -import { +import type { LockedHealthPlanFormDataType, UnlockedHealthPlanFormDataType, } from '../../../app-web/src/common-code/healthPlanFormDataType' -import { UpdateInfoType, ProgramType } from '../domain-models' +import type { UpdateInfoType, ProgramType } from '../domain-models' import { SESServiceException } from '@aws-sdk/client-ses' // See more discussion of configuration in docs/Configuration.md diff --git a/services/app-api/src/emailer/emails/newPackageCMSEmail.test.ts b/services/app-api/src/emailer/emails/newPackageCMSEmail.test.ts index dc3d4d1309..aa3088371f 100644 --- a/services/app-api/src/emailer/emails/newPackageCMSEmail.test.ts +++ b/services/app-api/src/emailer/emails/newPackageCMSEmail.test.ts @@ -9,9 +9,9 @@ import { mockMNState, mockMSState, } from '../../testHelpers/emailerHelpers' +import type { LockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { generateRateName, - LockedHealthPlanFormDataType, packageName, } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { newPackageCMSEmail } from './index' @@ -331,7 +331,7 @@ test('includes expected data summary for a multi-rate contract and rates submiss documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('10/17/2022'), rateProgramIDs: ['3fd36500-bf2c-47bc-80e8-e7aa417184c5'], rateCertificationName: @@ -359,7 +359,7 @@ test('includes expected data summary for a multi-rate contract and rates submiss documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('10/17/2022'), rateProgramIDs: ['abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce'], rateCertificationName: @@ -387,7 +387,7 @@ test('includes expected data summary for a multi-rate contract and rates submiss documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('10/17/2022'), rateProgramIDs: [ 'ea16a6c0-5fc6-4df8-adac-c627e76660ab', @@ -510,7 +510,7 @@ test('includes expected data summary for a contract amendment submission', async documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('10/17/2022'), rateProgramIDs: ['3fd36500-bf2c-47bc-80e8-e7aa417184c5'], rateCertificationName: @@ -591,7 +591,7 @@ test('includes expected data summary for a rate amendment submission CMS email', documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('10/17/2022'), rateProgramIDs: ['3fd36500-bf2c-47bc-80e8-e7aa417184c5'], rateCertificationName: @@ -855,7 +855,7 @@ test('CHIP contract and rate submission does include state specific analysts ema documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateStart: new Date(), rateDateEnd: new Date(), rateDateCertified: new Date(), @@ -940,7 +940,7 @@ test('CHIP contract and rate submission does not include oactEmails', async () = documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateStart: new Date('2021-02-02'), rateDateEnd: new Date('2021-11-31'), rateDateCertified: new Date('2020-12-01'), @@ -1019,7 +1019,7 @@ test('renders overall email as expected', async () => { documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('01/02/2021'), rateProgramIDs: ['3fd36500-bf2c-47bc-80e8-e7aa417184c5'], rateCertificationName: @@ -1047,7 +1047,7 @@ test('renders overall email as expected', async () => { documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('02/02/2022'), rateProgramIDs: ['abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce'], rateCertificationName: diff --git a/services/app-api/src/emailer/emails/newPackageCMSEmail.ts b/services/app-api/src/emailer/emails/newPackageCMSEmail.ts index 8095962aca..e96c0868bb 100644 --- a/services/app-api/src/emailer/emails/newPackageCMSEmail.ts +++ b/services/app-api/src/emailer/emails/newPackageCMSEmail.ts @@ -1,9 +1,7 @@ -import { - LockedHealthPlanFormDataType, - packageName as generatePackageName, -} from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { LockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import { packageName as generatePackageName } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { formatCalendarDate } from '../../../../app-web/src/common-code/dateHelpers' -import { EmailConfiguration, EmailData, StateAnalystsEmails } from '..' +import type { EmailConfiguration, EmailData, StateAnalystsEmails } from '..' import { stripHTMLFromTemplate, SubmissionTypeRecord, @@ -11,7 +9,7 @@ import { renderTemplate, findPackagePrograms, } from '../templateHelpers' -import { ProgramType } from '../../domain-models' +import type { ProgramType } from '../../domain-models' import { submissionSummaryURL } from '../generateURLs' export const newPackageCMSEmail = async ( diff --git a/services/app-api/src/emailer/emails/newPackageStateEmail.test.ts b/services/app-api/src/emailer/emails/newPackageStateEmail.test.ts index 5303b6af65..a381256c1f 100644 --- a/services/app-api/src/emailer/emails/newPackageStateEmail.test.ts +++ b/services/app-api/src/emailer/emails/newPackageStateEmail.test.ts @@ -5,8 +5,8 @@ import { mockContractAndRatesFormData, mockMNState, } from '../../testHelpers/emailerHelpers' +import type { LockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { - LockedHealthPlanFormDataType, generateRateName, packageName, } from '../../../../app-web/src/common-code/healthPlanFormDataType' @@ -335,7 +335,7 @@ test('includes expected data summary for a multi-rate contract and rates submiss documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('01/02/2021'), rateProgramIDs: ['3fd36500-bf2c-47bc-80e8-e7aa417184c5'], rateCertificationName: @@ -363,7 +363,7 @@ test('includes expected data summary for a multi-rate contract and rates submiss documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('02/02/2022'), rateProgramIDs: ['abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce'], rateCertificationName: @@ -391,7 +391,7 @@ test('includes expected data summary for a multi-rate contract and rates submiss documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('01/02/2021'), rateProgramIDs: [ 'ea16a6c0-5fc6-4df8-adac-c627e76660ab', @@ -502,7 +502,7 @@ test('includes expected data summary for a rate amendment submission State email documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('10/19/2022'), rateProgramIDs: ['abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce'], rateCertificationName: @@ -584,7 +584,7 @@ test('renders overall email for a new package with a rate amendment as expected' documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('01/02/2021'), rateProgramIDs: ['3fd36500-bf2c-47bc-80e8-e7aa417184c5'], rateCertificationName: diff --git a/services/app-api/src/emailer/emails/newPackageStateEmail.ts b/services/app-api/src/emailer/emails/newPackageStateEmail.ts index ab8ed90b92..76332c97e5 100644 --- a/services/app-api/src/emailer/emails/newPackageStateEmail.ts +++ b/services/app-api/src/emailer/emails/newPackageStateEmail.ts @@ -1,11 +1,9 @@ -import { - LockedHealthPlanFormDataType, - packageName as generatePackageName, -} from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { LockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import { packageName as generatePackageName } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { formatCalendarDate } from '../../../../app-web/src/common-code/dateHelpers' import { formatEmailAddresses, pruneDuplicateEmails } from '../formatters' -import { EmailConfiguration, EmailData } from '..' -import { ProgramType } from '../../domain-models' +import type { EmailConfiguration, EmailData } from '..' +import type { ProgramType } from '../../domain-models' import { stripHTMLFromTemplate, SubmissionTypeRecord, diff --git a/services/app-api/src/emailer/emails/resubmitPackageCMSEmail.test.ts b/services/app-api/src/emailer/emails/resubmitPackageCMSEmail.test.ts index 2ea9537b79..b5f15e832e 100644 --- a/services/app-api/src/emailer/emails/resubmitPackageCMSEmail.test.ts +++ b/services/app-api/src/emailer/emails/resubmitPackageCMSEmail.test.ts @@ -7,9 +7,9 @@ import { mockMSState, } from '../../testHelpers/emailerHelpers' import { resubmitPackageCMSEmail } from './index' +import type { LockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { generateRateName, - LockedHealthPlanFormDataType, packageName, } from '../../../../app-web/src/common-code/healthPlanFormDataType' diff --git a/services/app-api/src/emailer/emails/resubmitPackageCMSEmail.ts b/services/app-api/src/emailer/emails/resubmitPackageCMSEmail.ts index ed309b1b57..8079a0bddf 100644 --- a/services/app-api/src/emailer/emails/resubmitPackageCMSEmail.ts +++ b/services/app-api/src/emailer/emails/resubmitPackageCMSEmail.ts @@ -1,7 +1,5 @@ -import { - LockedHealthPlanFormDataType, - packageName as generatePackageName, -} from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { LockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import { packageName as generatePackageName } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { formatCalendarDate } from '../../../../app-web/src/common-code/dateHelpers' import { stripHTMLFromTemplate, @@ -11,7 +9,7 @@ import { } from '../templateHelpers' import type { EmailData, EmailConfiguration, StateAnalystsEmails } from '../' -import { ProgramType, UpdateInfoType } from '../../domain-models' +import type { ProgramType, UpdateInfoType } from '../../domain-models' import { submissionSummaryURL } from '../generateURLs' export const resubmitPackageCMSEmail = async ( diff --git a/services/app-api/src/emailer/emails/resubmitPackageStateEmail.test.ts b/services/app-api/src/emailer/emails/resubmitPackageStateEmail.test.ts index 57a39179d0..1a9363caa0 100644 --- a/services/app-api/src/emailer/emails/resubmitPackageStateEmail.test.ts +++ b/services/app-api/src/emailer/emails/resubmitPackageStateEmail.test.ts @@ -4,9 +4,9 @@ import { mockMNState, } from '../../testHelpers/emailerHelpers' import { resubmitPackageStateEmail } from './index' +import type { LockedHealthPlanFormDataType } from 'app-web/src/common-code/healthPlanFormDataType' import { generateRateName, - LockedHealthPlanFormDataType, packageName, } from 'app-web/src/common-code/healthPlanFormDataType' diff --git a/services/app-api/src/emailer/emails/resubmitPackageStateEmail.ts b/services/app-api/src/emailer/emails/resubmitPackageStateEmail.ts index e4ad535376..eb978fcec7 100644 --- a/services/app-api/src/emailer/emails/resubmitPackageStateEmail.ts +++ b/services/app-api/src/emailer/emails/resubmitPackageStateEmail.ts @@ -1,9 +1,7 @@ -import { - LockedHealthPlanFormDataType, - packageName as generatePackageName, -} from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { LockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import { packageName as generatePackageName } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { formatCalendarDate } from '../../../../app-web/src/common-code/dateHelpers' -import { UpdateInfoType, ProgramType } from '../../domain-models' +import type { UpdateInfoType, ProgramType } from '../../domain-models' import { renderTemplate, stripHTMLFromTemplate, diff --git a/services/app-api/src/emailer/emails/unlockPackageCMSEmail.test.ts b/services/app-api/src/emailer/emails/unlockPackageCMSEmail.test.ts index c1ea69e023..11f8d22e4e 100644 --- a/services/app-api/src/emailer/emails/unlockPackageCMSEmail.test.ts +++ b/services/app-api/src/emailer/emails/unlockPackageCMSEmail.test.ts @@ -7,10 +7,10 @@ import { mockMSState, } from '../../testHelpers/emailerHelpers' import { unlockPackageCMSEmail } from './index' +import type { UnlockedHealthPlanFormDataType } from 'app-web/src/common-code/healthPlanFormDataType' import { generateRateName, packageName, - UnlockedHealthPlanFormDataType, } from 'app-web/src/common-code/healthPlanFormDataType' const unlockData = { @@ -172,7 +172,7 @@ describe('unlockPackageCMSEmail', () => { documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('10/17/2022'), rateProgramIDs: ['abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce'], rateCertificationName: @@ -200,7 +200,7 @@ describe('unlockPackageCMSEmail', () => { documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateCertified: new Date('10/17/2022'), rateProgramIDs: [ 'ea16a6c0-5fc6-4df8-adac-c627e76660ab', @@ -583,7 +583,7 @@ describe('unlockPackageCMSEmail', () => { documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateStart: new Date(), rateDateEnd: new Date(), rateDateCertified: new Date(), @@ -638,7 +638,7 @@ describe('unlockPackageCMSEmail', () => { documentCategories: ['RATES' as const], }, ], - supportingDocuments: [], + supportingDocuments: [], rateDateStart: new Date(), rateDateEnd: new Date(), rateDateCertified: new Date(), diff --git a/services/app-api/src/emailer/emails/unlockPackageCMSEmail.ts b/services/app-api/src/emailer/emails/unlockPackageCMSEmail.ts index 333ac6fdde..566d32b4da 100644 --- a/services/app-api/src/emailer/emails/unlockPackageCMSEmail.ts +++ b/services/app-api/src/emailer/emails/unlockPackageCMSEmail.ts @@ -1,7 +1,5 @@ -import { - UnlockedHealthPlanFormDataType, - packageName as generatePackageName, -} from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { UnlockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import { packageName as generatePackageName } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { formatCalendarDate } from '../../../../app-web/src/common-code/dateHelpers' import { stripHTMLFromTemplate, @@ -10,7 +8,7 @@ import { findPackagePrograms, } from '../templateHelpers' import type { EmailData, EmailConfiguration, StateAnalystsEmails } from '../' -import { ProgramType, UpdateInfoType } from '../../domain-models' +import type { ProgramType, UpdateInfoType } from '../../domain-models' export const unlockPackageCMSEmail = async ( pkg: UnlockedHealthPlanFormDataType, diff --git a/services/app-api/src/emailer/emails/unlockPackageStateEmail.test.ts b/services/app-api/src/emailer/emails/unlockPackageStateEmail.test.ts index c31d890900..2d3bf0558f 100644 --- a/services/app-api/src/emailer/emails/unlockPackageStateEmail.test.ts +++ b/services/app-api/src/emailer/emails/unlockPackageStateEmail.test.ts @@ -4,10 +4,10 @@ import { mockMNState, } from '../../testHelpers/emailerHelpers' import { unlockPackageStateEmail } from './index' +import type { UnlockedHealthPlanFormDataType } from 'app-web/src/common-code/healthPlanFormDataType' import { generateRateName, packageName, - UnlockedHealthPlanFormDataType, } from 'app-web/src/common-code/healthPlanFormDataType' const unlockData = { diff --git a/services/app-api/src/emailer/emails/unlockPackageStateEmail.ts b/services/app-api/src/emailer/emails/unlockPackageStateEmail.ts index 9d39f7cfc8..d281950f96 100644 --- a/services/app-api/src/emailer/emails/unlockPackageStateEmail.ts +++ b/services/app-api/src/emailer/emails/unlockPackageStateEmail.ts @@ -1,7 +1,5 @@ -import { - UnlockedHealthPlanFormDataType, - packageName as generatePackageName, -} from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { UnlockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import { packageName as generatePackageName } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { formatCalendarDate } from '../../../../app-web/src/common-code/dateHelpers' import { renderTemplate, @@ -9,7 +7,7 @@ import { findPackagePrograms, } from '../templateHelpers' import type { EmailData, EmailConfiguration } from '../' -import { ProgramType, UpdateInfoType } from '../../domain-models' +import type { ProgramType, UpdateInfoType } from '../../domain-models' import { reviewAndSubmitURL } from '../generateURLs' import { pruneDuplicateEmails } from '../formatters' diff --git a/services/app-api/src/emailer/templateHelpers.test.ts b/services/app-api/src/emailer/templateHelpers.test.ts index 833251f48c..66163daea6 100644 --- a/services/app-api/src/emailer/templateHelpers.test.ts +++ b/services/app-api/src/emailer/templateHelpers.test.ts @@ -3,14 +3,14 @@ import { generateCMSReviewerEmails, handleAsCHIPSubmission, } from './templateHelpers' -import { UnlockedHealthPlanFormDataType } from 'app-web/src/common-code/healthPlanFormDataType' +import type { UnlockedHealthPlanFormDataType } from 'app-web/src/common-code/healthPlanFormDataType' import { mockUnlockedContractAndRatesFormData, mockUnlockedContractOnlyFormData, testEmailConfig, testStateAnalystsEmails, } from '../testHelpers/emailerHelpers' -import { EmailConfiguration, StateAnalystsEmails } from './emailer' +import type { EmailConfiguration, StateAnalystsEmails } from './emailer' describe('templateHelpers', () => { const contractOnlyWithValidRateData: { diff --git a/services/app-api/src/emailer/templateHelpers.ts b/services/app-api/src/emailer/templateHelpers.ts index 072bf7fe74..066c84054a 100644 --- a/services/app-api/src/emailer/templateHelpers.ts +++ b/services/app-api/src/emailer/templateHelpers.ts @@ -1,13 +1,13 @@ import * as Eta from 'eta' import * as path from 'path' -import { +import type { LockedHealthPlanFormDataType, UnlockedHealthPlanFormDataType, SubmissionType, } from '../../../app-web/src/common-code/healthPlanFormDataType' -import { EmailConfiguration, StateAnalystsEmails } from '.' -import { ProgramType } from '../domain-models' +import type { EmailConfiguration, StateAnalystsEmails } from '.' +import type { ProgramType } from '../domain-models' import { logError } from '../logger' import { pruneDuplicateEmails } from './formatters' diff --git a/services/app-api/src/handlers/add_sha.test.ts b/services/app-api/src/handlers/add_sha.test.ts index 1e29d2611a..2737316eba 100644 --- a/services/app-api/src/handlers/add_sha.test.ts +++ b/services/app-api/src/handlers/add_sha.test.ts @@ -1,11 +1,11 @@ import { main } from './add_sha' import * as add_sha from './add_sha' -import { SubmissionDocument } from 'app-web/src/common-code/healthPlanFormDataType' +import type { SubmissionDocument } from 'app-web/src/common-code/healthPlanFormDataType' import { unlockedWithALittleBitOfEverything } from 'app-web/src/common-code/healthPlanFormDataMocks' -import { Context } from 'aws-lambda' -import { HealthPlanRevisionTable } from '@prisma/client' -import { Store } from '../postgres' -import { Event } from '@aws-sdk/client-s3' +import type { Context } from 'aws-lambda' +import type { HealthPlanRevisionTable } from '@prisma/client' +import type { Store } from '../postgres' +import type { Event } from '@aws-sdk/client-s3' import { toProtoBuffer } from 'app-web/src/common-code/proto/healthPlanFormDataProto' const mockStore: Store = { diff --git a/services/app-api/src/handlers/add_sha.ts b/services/app-api/src/handlers/add_sha.ts index 95a5b513a6..1aa740c8ab 100644 --- a/services/app-api/src/handlers/add_sha.ts +++ b/services/app-api/src/handlers/add_sha.ts @@ -1,17 +1,18 @@ -import { Handler } from 'aws-lambda' -import { Readable } from 'stream' +import type { Handler } from 'aws-lambda' +import type { Readable } from 'stream' import { configurePostgres } from './configuration' import { NewPostgresStore } from '../postgres/postgresStore' -import { HealthPlanRevisionTable } from '@prisma/client' -import { +import type { HealthPlanRevisionTable } from '@prisma/client' +import type { HealthPlanFormDataType, SubmissionDocument, } from '../../../app-web/src/common-code/healthPlanFormDataType' import { toDomain } from '../../../app-web/src/common-code/proto/healthPlanFormDataProto' -import { isStoreError, StoreError } from '../postgres/storeError' +import type { StoreError } from '../postgres/storeError' +import { isStoreError } from '../postgres/storeError' import { S3Client, GetObjectCommand } from '@aws-sdk/client-s3' import { createHash } from 'crypto' -import { Store } from '../postgres' +import type { Store } from '../postgres' import { parseKey, parseBucketName, diff --git a/services/app-api/src/handlers/apollo_gql.ts b/services/app-api/src/handlers/apollo_gql.ts index 80b098a485..30561d7432 100644 --- a/services/app-api/src/handlers/apollo_gql.ts +++ b/services/app-api/src/handlers/apollo_gql.ts @@ -1,21 +1,16 @@ -import { - propagation, - ROOT_CONTEXT, - Span, - SpanKind, - Tracer, -} from '@opentelemetry/api' +import type { Span, Tracer } from '@opentelemetry/api' +import { propagation, ROOT_CONTEXT, SpanKind } from '@opentelemetry/api' import { ApolloServer } from 'apollo-server-lambda' -import { +import type { APIGatewayProxyEvent, APIGatewayProxyHandler, Handler, } from 'aws-lambda' import typeDefs from '../../../app-graphql/src/schema.graphql' import { assertIsAuthMode } from '../../../app-web/src/common-code/config' -import { UserType } from '../domain-models' +import type { UserType } from '../domain-models' +import type { userFromAuthProvider } from '../authn' import { - userFromAuthProvider, userFromCognitoAuthProvider, userFromLocalAuthProvider, } from '../authn' @@ -29,12 +24,9 @@ import { newAWSEmailParameterStore, newLocalEmailParameterStore, } from '../parameterStore' -import { - LDService, - ldService, - offlineLDService, -} from '../launchDarkly/launchDarkly' -import { LDClient } from '@launchdarkly/node-server-sdk' +import type { LDService } from '../launchDarkly/launchDarkly' +import { ldService, offlineLDService } from '../launchDarkly/launchDarkly' +import type { LDClient } from '@launchdarkly/node-server-sdk' import * as ld from '@launchdarkly/node-server-sdk' import { ApolloServerPluginLandingPageLocalDefault, diff --git a/services/app-api/src/handlers/bulk_download.ts b/services/app-api/src/handlers/bulk_download.ts index 87eecef2d5..99e9a63002 100644 --- a/services/app-api/src/handlers/bulk_download.ts +++ b/services/app-api/src/handlers/bulk_download.ts @@ -1,12 +1,12 @@ +import type { PutObjectCommandInput } from '@aws-sdk/client-s3' import { S3Client, GetObjectCommand, HeadObjectCommand, - PutObjectCommandInput, } from '@aws-sdk/client-s3' import { Upload } from '@aws-sdk/lib-storage' import { Readable, Writable, PassThrough } from 'stream' -import { APIGatewayProxyHandler } from 'aws-lambda' +import type { APIGatewayProxyHandler } from 'aws-lambda' import Archiver from 'archiver' const s3 = new S3Client({ region: 'us-east-1' }) diff --git a/services/app-api/src/handlers/cleanup.ts b/services/app-api/src/handlers/cleanup.ts index f06f652e22..f77dde617d 100644 --- a/services/app-api/src/handlers/cleanup.ts +++ b/services/app-api/src/handlers/cleanup.ts @@ -1,8 +1,10 @@ +import type { + DescribeDBClusterSnapshotsCommandInput, + DeleteDBClusterSnapshotCommandInput, +} from '@aws-sdk/client-rds' import { RDSClient, - DescribeDBClusterSnapshotsCommandInput, DescribeDBClusterSnapshotsCommand, - DeleteDBClusterSnapshotCommandInput, DeleteDBClusterSnapshotCommand, } from '@aws-sdk/client-rds' diff --git a/services/app-api/src/handlers/configuration.ts b/services/app-api/src/handlers/configuration.ts index 89ea74d250..2543277576 100644 --- a/services/app-api/src/handlers/configuration.ts +++ b/services/app-api/src/handlers/configuration.ts @@ -1,4 +1,4 @@ -import { PrismaClient } from '@prisma/client' +import type { PrismaClient } from '@prisma/client' import { NewPrismaClient } from '../postgres' import { FetchSecrets, getConnectionURL } from '../secrets' diff --git a/services/app-api/src/handlers/email_submit.ts b/services/app-api/src/handlers/email_submit.ts index bb789148e2..d7a2a6ff00 100644 --- a/services/app-api/src/handlers/email_submit.ts +++ b/services/app-api/src/handlers/email_submit.ts @@ -1,4 +1,4 @@ -import { Handler } from 'aws-lambda' +import type { Handler } from 'aws-lambda' import { SESServiceException } from '@aws-sdk/client-ses' import { sendSESEmail } from '../emailer' diff --git a/services/app-api/src/handlers/global.d.ts b/services/app-api/src/handlers/global.d.ts index de9a97c409..0d8daec56e 100644 --- a/services/app-api/src/handlers/global.d.ts +++ b/services/app-api/src/handlers/global.d.ts @@ -1,7 +1,7 @@ // Typescript needs to be made happy with raw-loader to load a static file at build time // see where we load the graphql schema in our graphql handler declare module '*.graphql' { - import { DocumentNode } from 'graphql' + import type { DocumentNode } from 'graphql' const Schema: DocumentNode export = Schema diff --git a/services/app-api/src/handlers/health_check.ts b/services/app-api/src/handlers/health_check.ts index 1d3a76432f..1542d6aba7 100644 --- a/services/app-api/src/handlers/health_check.ts +++ b/services/app-api/src/handlers/health_check.ts @@ -1,4 +1,4 @@ -import { APIGatewayProxyHandler } from 'aws-lambda' +import type { APIGatewayProxyHandler } from 'aws-lambda' const ldClientKey = process.env.LD_SDK_KEY ?? '' if (ldClientKey === '') { diff --git a/services/app-api/src/handlers/migrate_rate_documents.test.ts b/services/app-api/src/handlers/migrate_rate_documents.test.ts index c7a6aa8002..f1a56560f3 100644 --- a/services/app-api/src/handlers/migrate_rate_documents.test.ts +++ b/services/app-api/src/handlers/migrate_rate_documents.test.ts @@ -1,6 +1,6 @@ import { main } from './migrate_rate_documents' import * as migrate_rate_documents from './migrate_rate_documents' -import { +import type { ActuaryCommunicationType, DocumentCategoryType, RateCapitationType, @@ -8,10 +8,10 @@ import { SubmissionDocument, } from 'app-web/src/common-code/healthPlanFormDataType' import { unlockedWithALittleBitOfEverything } from 'app-web/src/common-code/healthPlanFormDataMocks' -import { Context } from 'aws-lambda' -import { HealthPlanRevisionTable } from '@prisma/client' -import { Store } from '../postgres' -import { Event } from '@aws-sdk/client-s3' +import type { Context } from 'aws-lambda' +import type { HealthPlanRevisionTable } from '@prisma/client' +import type { Store } from '../postgres' +import type { Event } from '@aws-sdk/client-s3' import { toProtoBuffer } from 'app-web/src/common-code/proto/healthPlanFormDataProto' const mockStore: Store = { diff --git a/services/app-api/src/handlers/migrate_rate_documents.ts b/services/app-api/src/handlers/migrate_rate_documents.ts index 8fa2634a2f..224be0605b 100644 --- a/services/app-api/src/handlers/migrate_rate_documents.ts +++ b/services/app-api/src/handlers/migrate_rate_documents.ts @@ -1,11 +1,12 @@ -import { Handler } from 'aws-lambda' +import type { Handler } from 'aws-lambda' import { configurePostgres } from './configuration' import { NewPostgresStore } from '../postgres/postgresStore' -import { HealthPlanRevisionTable } from '@prisma/client' -import { HealthPlanFormDataType } from '../../../app-web/src/common-code/healthPlanFormDataType' +import type { HealthPlanRevisionTable } from '@prisma/client' +import type { HealthPlanFormDataType } from '../../../app-web/src/common-code/healthPlanFormDataType' import { toDomain } from '../../../app-web/src/common-code/proto/healthPlanFormDataProto' -import { isStoreError, StoreError } from '../postgres/storeError' -import { Store } from '../postgres' +import type { StoreError } from '../postgres/storeError' +import { isStoreError } from '../postgres/storeError' +import type { Store } from '../postgres' import { initTracer, initMeter, diff --git a/services/app-api/src/handlers/otel_proxy.ts b/services/app-api/src/handlers/otel_proxy.ts index 29f08e6f9f..f3dd8bce09 100644 --- a/services/app-api/src/handlers/otel_proxy.ts +++ b/services/app-api/src/handlers/otel_proxy.ts @@ -1,4 +1,4 @@ -import { APIGatewayProxyHandler } from 'aws-lambda' +import type { APIGatewayProxyHandler } from 'aws-lambda' import axios from 'axios' export const main: APIGatewayProxyHandler = async (event) => { diff --git a/services/app-api/src/handlers/postgres_migrate.ts b/services/app-api/src/handlers/postgres_migrate.ts index a219a2c659..7e797c36d8 100644 --- a/services/app-api/src/handlers/postgres_migrate.ts +++ b/services/app-api/src/handlers/postgres_migrate.ts @@ -1,4 +1,4 @@ -import { Handler, APIGatewayProxyResultV2 } from 'aws-lambda' +import type { Handler, APIGatewayProxyResultV2 } from 'aws-lambda' import { RDSClient, CreateDBClusterSnapshotCommand } from '@aws-sdk/client-rds' import { spawnSync } from 'child_process' import { getDBClusterID, getPostgresURL } from './configuration' diff --git a/services/app-api/src/handlers/proto_to_db.ts b/services/app-api/src/handlers/proto_to_db.ts index 2395036d97..c87d966d13 100644 --- a/services/app-api/src/handlers/proto_to_db.ts +++ b/services/app-api/src/handlers/proto_to_db.ts @@ -1,10 +1,11 @@ -import { Handler, APIGatewayProxyResultV2 } from 'aws-lambda' +import type { Handler, APIGatewayProxyResultV2 } from 'aws-lambda' import { initTracer, initMeter } from '../../../uploads/src/lib/otel' import { configurePostgres } from './configuration' import { NewPostgresStore } from '../postgres/postgresStore' -import { Store } from '../postgres' -import { HealthPlanRevisionTable } from '@prisma/client' -import { isStoreError, StoreError } from '../postgres/storeError' +import type { Store } from '../postgres' +import type { HealthPlanRevisionTable } from '@prisma/client' +import type { StoreError } from '../postgres/storeError' +import { isStoreError } from '../postgres/storeError' export const getDatabaseConnection = async (): Promise => { const dbURL = process.env.DATABASE_URL diff --git a/services/app-api/src/handlers/reports.ts b/services/app-api/src/handlers/reports.ts index d48bd030ca..c1239e1da8 100644 --- a/services/app-api/src/handlers/reports.ts +++ b/services/app-api/src/handlers/reports.ts @@ -1,18 +1,19 @@ -import { APIGatewayProxyHandler } from 'aws-lambda' +import type { APIGatewayProxyHandler } from 'aws-lambda' import { configurePostgres } from './configuration' import { NewPostgresStore } from '../postgres/postgresStore' import { Parser, transforms } from 'json2csv' -import { HealthPlanRevisionTable } from '@prisma/client' -import { ProgramArgType } from '../../../app-web/src/common-code/healthPlanFormDataType/State' -import { +import type { HealthPlanRevisionTable } from '@prisma/client' +import type { ProgramArgType } from '../../../app-web/src/common-code/healthPlanFormDataType/State' +import type { HealthPlanFormDataType, RateInfoType, - packageName, } from '../../../app-web/src/common-code/healthPlanFormDataType' +import { packageName } from '../../../app-web/src/common-code/healthPlanFormDataType' import { toDomain } from '../../../app-web/src/common-code/proto/healthPlanFormDataProto' import statePrograms from '../../../app-web/src/common-code/data/statePrograms.json' -import { isStoreError, StoreError } from '../postgres/storeError' -import { HealthPlanPackageStatusType } from '../domain-models' +import type { StoreError } from '../postgres/storeError' +import { isStoreError } from '../postgres/storeError' +import type { HealthPlanPackageStatusType } from '../domain-models' import { userFromCognitoAuthProvider, userFromLocalAuthProvider, diff --git a/services/app-api/src/launchDarkly/launchDarkly.ts b/services/app-api/src/launchDarkly/launchDarkly.ts index 9ec2f5546f..b3fa8ac12a 100644 --- a/services/app-api/src/launchDarkly/launchDarkly.ts +++ b/services/app-api/src/launchDarkly/launchDarkly.ts @@ -1,12 +1,14 @@ -import { - featureFlagKeys, - featureFlags, +import type { FlagValue, FeatureFlagLDConstant, FeatureFlagSettings, } from '../../../app-web/src/common-code/featureFlags' -import { LDClient } from '@launchdarkly/node-server-sdk' -import { Context } from '../handlers/apollo_gql' +import { + featureFlagKeys, + featureFlags, +} from '../../../app-web/src/common-code/featureFlags' +import type { LDClient } from '@launchdarkly/node-server-sdk' +import type { Context } from '../handlers/apollo_gql' import { logError } from '../logger' import { setErrorAttributesOnActiveSpan } from '../resolvers/attributeHelper' diff --git a/services/app-api/src/otel/otel_handler.ts b/services/app-api/src/otel/otel_handler.ts index 5a21698615..6af3d42f7a 100644 --- a/services/app-api/src/otel/otel_handler.ts +++ b/services/app-api/src/otel/otel_handler.ts @@ -1,4 +1,5 @@ -import { trace, Tracer } from '@opentelemetry/api' +import type { Tracer } from '@opentelemetry/api' +import { trace } from '@opentelemetry/api' import { Resource } from '@opentelemetry/resources' import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' diff --git a/services/app-api/src/parameterStore/emailParameterStore/emailParameterStore.ts b/services/app-api/src/parameterStore/emailParameterStore/emailParameterStore.ts index d244931843..a25e56d925 100644 --- a/services/app-api/src/parameterStore/emailParameterStore/emailParameterStore.ts +++ b/services/app-api/src/parameterStore/emailParameterStore/emailParameterStore.ts @@ -1,4 +1,4 @@ -import { StateCodeType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { StateCodeType } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { getStateAnalystsEmails, getStateAnalystsEmailsLocal, diff --git a/services/app-api/src/parameterStore/emailParameterStore/helpers.ts b/services/app-api/src/parameterStore/emailParameterStore/helpers.ts index f91cdc91e5..4eac6b8eea 100644 --- a/services/app-api/src/parameterStore/emailParameterStore/helpers.ts +++ b/services/app-api/src/parameterStore/emailParameterStore/helpers.ts @@ -1,4 +1,4 @@ -import { ParameterType } from '../awsParameterStore' +import type { ParameterType } from '../awsParameterStore' const validateAndReturnValueArray = ( storeResponse: ParameterType, diff --git a/services/app-api/src/parameterStore/emailParameterStore/stateAnalystsEmails/getStateAnalystsSettings.ts b/services/app-api/src/parameterStore/emailParameterStore/stateAnalystsEmails/getStateAnalystsSettings.ts index 1c09686103..2e1693c31c 100644 --- a/services/app-api/src/parameterStore/emailParameterStore/stateAnalystsEmails/getStateAnalystsSettings.ts +++ b/services/app-api/src/parameterStore/emailParameterStore/stateAnalystsEmails/getStateAnalystsSettings.ts @@ -1,7 +1,5 @@ -import { - isValidStateCode, - StateCodeType, -} from '../../../../../app-web/src/common-code/healthPlanFormDataType' +import type { StateCodeType } from '../../../../../app-web/src/common-code/healthPlanFormDataType' +import { isValidStateCode } from '../../../../../app-web/src/common-code/healthPlanFormDataType' import { ParameterStore } from '../../awsParameterStore' type StateAnalystsWithState = { diff --git a/services/app-api/src/postgres/contractAndRates/findContractWithHistory.ts b/services/app-api/src/postgres/contractAndRates/findContractWithHistory.ts index 329c66e15b..9e9f42808a 100644 --- a/services/app-api/src/postgres/contractAndRates/findContractWithHistory.ts +++ b/services/app-api/src/postgres/contractAndRates/findContractWithHistory.ts @@ -1,5 +1,5 @@ -import { PrismaTransactionType } from '../prismaTypes' -import { ContractType } from '../../domain-models/contractAndRates' +import type { PrismaTransactionType } from '../prismaTypes' +import type { ContractType } from '../../domain-models/contractAndRates' import { NotFoundError } from '../storeError' import { parseContractWithHistory } from './parseContractWithHistory' import { includeFullContract } from './prismaSubmittedContractHelpers' diff --git a/services/app-api/src/postgres/contractAndRates/findDraftRate.ts b/services/app-api/src/postgres/contractAndRates/findDraftRate.ts index 26437fcbe9..9386107e3d 100644 --- a/services/app-api/src/postgres/contractAndRates/findDraftRate.ts +++ b/services/app-api/src/postgres/contractAndRates/findDraftRate.ts @@ -1,5 +1,5 @@ -import { PrismaClient } from '@prisma/client' -import { RateRevisionWithContractsType } from '../../domain-models/contractAndRates' +import type { PrismaClient } from '@prisma/client' +import type { RateRevisionWithContractsType } from '../../domain-models/contractAndRates' import { contractFormDataToDomainModel, includeUpdateInfo, diff --git a/services/app-api/src/postgres/contractAndRates/findRateWithHistory.ts b/services/app-api/src/postgres/contractAndRates/findRateWithHistory.ts index b25413d988..535e95539b 100644 --- a/services/app-api/src/postgres/contractAndRates/findRateWithHistory.ts +++ b/services/app-api/src/postgres/contractAndRates/findRateWithHistory.ts @@ -1,8 +1,8 @@ -import { PrismaTransactionType } from '../prismaTypes' -import { RateType } from '../../domain-models/contractAndRates' +import type { PrismaTransactionType } from '../prismaTypes' +import type { RateType } from '../../domain-models/contractAndRates' +import { NotFoundError } from '../storeError' import { includeFullRate } from './prismaSubmittedRateHelpers' import { parseRateWithHistory } from './parseRateWithHistory' -import { NotFoundError } from '../storeError' async function findRateWithHistory( client: PrismaTransactionType, diff --git a/services/app-api/src/postgres/contractAndRates/index.ts b/services/app-api/src/postgres/contractAndRates/index.ts index 5d77d6bde4..345a0db98b 100644 --- a/services/app-api/src/postgres/contractAndRates/index.ts +++ b/services/app-api/src/postgres/contractAndRates/index.ts @@ -1,4 +1,5 @@ -import { insertDraftContract, InsertContractArgsType } from './insertContract' +import type { InsertContractArgsType } from './insertContract' +import { insertDraftContract } from './insertContract' import { findContractWithHistory } from './findContractWithHistory' export { insertDraftContract, findContractWithHistory } diff --git a/services/app-api/src/postgres/contractAndRates/insertContract.ts b/services/app-api/src/postgres/contractAndRates/insertContract.ts index 6be7e00809..95a4060ad7 100644 --- a/services/app-api/src/postgres/contractAndRates/insertContract.ts +++ b/services/app-api/src/postgres/contractAndRates/insertContract.ts @@ -1,10 +1,10 @@ -import { +import type { PrismaClient, PopulationCoverageType, SubmissionType, ContractType as PrismaContractType, } from '@prisma/client' -import { ContractType } from '../../domain-models/contractAndRates' +import type { ContractType } from '../../domain-models/contractAndRates' import { parseContractWithHistory } from './parseContractWithHistory' import { includeFullContract } from './prismaSubmittedContractHelpers' diff --git a/services/app-api/src/postgres/contractAndRates/insertRate.ts b/services/app-api/src/postgres/contractAndRates/insertRate.ts index 304e51cfdb..527d0978d1 100644 --- a/services/app-api/src/postgres/contractAndRates/insertRate.ts +++ b/services/app-api/src/postgres/contractAndRates/insertRate.ts @@ -1,4 +1,4 @@ -import { +import type { ActuaryCommunication, ActuaryContact, PrismaClient, @@ -6,11 +6,11 @@ import { RateDocument, RateSupportingDocument, } from '@prisma/client' -import { +import type { StateCodeType, RateType as DomainRateType, } from 'app-web/src/common-code/healthPlanFormDataType' -import { RateType } from '../../domain-models/contractAndRates' +import type { RateType } from '../../domain-models/contractAndRates' import { parseRateWithHistory } from './parseRateWithHistory' import { includeFullRate } from './prismaSubmittedRateHelpers' diff --git a/services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts b/services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts index e228609dec..ac76afc6b6 100644 --- a/services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts +++ b/services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts @@ -1,20 +1,22 @@ -import { +import type { ContractType, - contractSchema, ContractRevisionWithRatesType, ContractRevisionType, } from '../../domain-models/contractAndRates' +import { contractSchema } from '../../domain-models/contractAndRates' import { draftContractRevToDomainModel } from './prismaDraftContractHelpers' +import type { + RateRevisionTableWithFormData, + ContractRevisionTableWithFormData, + UpdateInfoTableWithUpdater, +} from './prismaSharedContractRateHelpers' import { contractFormDataToDomainModel, convertUpdateInfoToDomainModel, ratesRevisionsToDomainModel, - RateRevisionTableWithFormData, - UpdateInfoTableWithUpdater, getContractStatus, - ContractRevisionTableWithFormData, } from './prismaSharedContractRateHelpers' -import { ContractTableFullPayload } from './prismaSubmittedContractHelpers' +import type { ContractTableFullPayload } from './prismaSubmittedContractHelpers' // parseContractWithHistory returns a ContractType with a full set of // ContractRevisions in reverse chronological order. Each revision is a change to this diff --git a/services/app-api/src/postgres/contractAndRates/parseRateWithHistory.ts b/services/app-api/src/postgres/contractAndRates/parseRateWithHistory.ts index 7ecbba4e1a..9028dada63 100644 --- a/services/app-api/src/postgres/contractAndRates/parseRateWithHistory.ts +++ b/services/app-api/src/postgres/contractAndRates/parseRateWithHistory.ts @@ -1,18 +1,20 @@ -import { +import type { RateRevisionWithContractsType, RateType, } from '../../domain-models/contractAndRates' import { contractRevisionsToDomainModels } from './parseContractWithHistory' import { draftRateRevToDomainModel } from './prismaDraftRatesHelpers' -import { +import type { ContractRevisionTableWithFormData, + RateRevisionTableWithFormData, + UpdateInfoTableWithUpdater, +} from './prismaSharedContractRateHelpers' +import { convertUpdateInfoToDomainModel, getContractStatus, rateReivisionToDomainModel, - RateRevisionTableWithFormData, - UpdateInfoTableWithUpdater, } from './prismaSharedContractRateHelpers' -import { RateTableFullPayload } from './prismaSubmittedRateHelpers' +import type { RateTableFullPayload } from './prismaSubmittedRateHelpers' // this is for the internal building of individual revisions // we convert them into RateRevisons to return them diff --git a/services/app-api/src/postgres/contractAndRates/prismaDraftContractHelpers.ts b/services/app-api/src/postgres/contractAndRates/prismaDraftContractHelpers.ts index ac114543c6..0aa5c6b7b0 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaDraftContractHelpers.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaDraftContractHelpers.ts @@ -1,5 +1,5 @@ -import { Prisma } from '@prisma/client' -import { +import type { Prisma } from '@prisma/client' +import type { ContractRevisionWithRatesType, RateRevisionType, } from '../../domain-models/contractAndRates' @@ -8,7 +8,7 @@ import { includeUpdateInfo, rateReivisionToDomainModel, } from './prismaSharedContractRateHelpers' -import { ContractRevisionTableWithRates } from './prismaSubmittedContractHelpers' +import type { ContractRevisionTableWithRates } from './prismaSubmittedContractHelpers' const includeDraftRates = { revisions: { diff --git a/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts b/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts index 466f8be801..b262c46285 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts @@ -1,6 +1,6 @@ -import { Prisma, UpdateInfoTable } from '@prisma/client' -import { DocumentCategoryType } from 'app-web/src/common-code/healthPlanFormDataType' -import { +import type { Prisma, UpdateInfoTable } from '@prisma/client' +import type { DocumentCategoryType } from 'app-web/src/common-code/healthPlanFormDataType' +import type { ContractFormDataType, RateFormDataType, RateRevisionType, diff --git a/services/app-api/src/postgres/contractAndRates/prismaSubmittedContractHelpers.ts b/services/app-api/src/postgres/contractAndRates/prismaSubmittedContractHelpers.ts index 67f3ac3faf..fb7333994e 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaSubmittedContractHelpers.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaSubmittedContractHelpers.ts @@ -1,4 +1,4 @@ -import { Prisma } from '@prisma/client' +import type { Prisma } from '@prisma/client' import { includeDraftRates } from './prismaDraftContractHelpers' import { includeContractFormData, diff --git a/services/app-api/src/postgres/contractAndRates/prismaSubmittedRateHelpers.ts b/services/app-api/src/postgres/contractAndRates/prismaSubmittedRateHelpers.ts index 1536da705e..82dfcc76e8 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaSubmittedRateHelpers.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaSubmittedRateHelpers.ts @@ -1,4 +1,4 @@ -import { Prisma } from '@prisma/client' +import type { Prisma } from '@prisma/client' import { includeDraftContracts } from './prismaDraftRatesHelpers' import { includeContractFormData, diff --git a/services/app-api/src/postgres/contractAndRates/prismaToDomainModel.test.ts b/services/app-api/src/postgres/contractAndRates/prismaToDomainModel.test.ts index 467254f803..e3e4ce72ff 100644 --- a/services/app-api/src/postgres/contractAndRates/prismaToDomainModel.test.ts +++ b/services/app-api/src/postgres/contractAndRates/prismaToDomainModel.test.ts @@ -4,7 +4,7 @@ import { contractFormDataToDomainModel, getContractStatus, } from './prismaSharedContractRateHelpers' -import { ContractRevisionTableWithRates } from './prismaSubmittedContractHelpers' +import type { ContractRevisionTableWithRates } from './prismaSubmittedContractHelpers' describe('prismaToDomainModel', () => { describe('contractFormDataToDomainModel', () => { diff --git a/services/app-api/src/postgres/contractAndRates/submitContract.ts b/services/app-api/src/postgres/contractAndRates/submitContract.ts index f309798543..b2630c38b6 100644 --- a/services/app-api/src/postgres/contractAndRates/submitContract.ts +++ b/services/app-api/src/postgres/contractAndRates/submitContract.ts @@ -1,5 +1,5 @@ -import { PrismaClient } from '@prisma/client' -import { ContractType } from '../../domain-models/contractAndRates' +import type { PrismaClient } from '@prisma/client' +import type { ContractType } from '../../domain-models/contractAndRates' import { findContractWithHistory } from './findContractWithHistory' import { NotFoundError } from '../storeError' diff --git a/services/app-api/src/postgres/contractAndRates/submitRate.ts b/services/app-api/src/postgres/contractAndRates/submitRate.ts index 320169f41b..9673412253 100644 --- a/services/app-api/src/postgres/contractAndRates/submitRate.ts +++ b/services/app-api/src/postgres/contractAndRates/submitRate.ts @@ -1,5 +1,5 @@ -import { PrismaClient } from '@prisma/client' -import { RateType } from '../../domain-models/contractAndRates' +import type { PrismaClient } from '@prisma/client' +import type { RateType } from '../../domain-models/contractAndRates' import { findRateWithHistory } from './findRateWithHistory' // Update the given revision diff --git a/services/app-api/src/postgres/contractAndRates/unlockContract.ts b/services/app-api/src/postgres/contractAndRates/unlockContract.ts index cdf656b181..f62eac2d60 100644 --- a/services/app-api/src/postgres/contractAndRates/unlockContract.ts +++ b/services/app-api/src/postgres/contractAndRates/unlockContract.ts @@ -1,5 +1,5 @@ -import { PrismaClient } from '@prisma/client' -import { ContractType } from '../../domain-models/contractAndRates' +import type { PrismaClient } from '@prisma/client' +import type { ContractType } from '../../domain-models/contractAndRates' import { findContractWithHistory } from './findContractWithHistory' import { NotFoundError } from '../storeError' diff --git a/services/app-api/src/postgres/contractAndRates/unlockRate.ts b/services/app-api/src/postgres/contractAndRates/unlockRate.ts index 3efd86e646..cf9930c8f9 100644 --- a/services/app-api/src/postgres/contractAndRates/unlockRate.ts +++ b/services/app-api/src/postgres/contractAndRates/unlockRate.ts @@ -1,5 +1,5 @@ -import { PrismaClient } from '@prisma/client' -import { RateType } from '../../domain-models/contractAndRates' +import type { PrismaClient } from '@prisma/client' +import type { RateType } from '../../domain-models/contractAndRates' import { findRateWithHistory } from './findRateWithHistory' // Unlock the given rate diff --git a/services/app-api/src/postgres/contractAndRates/updateDraftContract.ts b/services/app-api/src/postgres/contractAndRates/updateDraftContract.ts index 5cd0539704..a9fb0dfc8e 100644 --- a/services/app-api/src/postgres/contractAndRates/updateDraftContract.ts +++ b/services/app-api/src/postgres/contractAndRates/updateDraftContract.ts @@ -1,10 +1,10 @@ -import { +import type { ContractType as PrismaContractType, PopulationCoverageType, PrismaClient, SubmissionType, } from '@prisma/client' -import { ContractType } from '../../domain-models/contractAndRates' +import type { ContractType } from '../../domain-models/contractAndRates' import { findContractWithHistory } from './findContractWithHistory' import { NotFoundError } from '../storeError' diff --git a/services/app-api/src/postgres/contractAndRates/updateDraftRate.ts b/services/app-api/src/postgres/contractAndRates/updateDraftRate.ts index 482135e651..4d60b0dc08 100644 --- a/services/app-api/src/postgres/contractAndRates/updateDraftRate.ts +++ b/services/app-api/src/postgres/contractAndRates/updateDraftRate.ts @@ -1,5 +1,5 @@ -import { PrismaClient } from '@prisma/client' -import { RateType } from '../../domain-models/contractAndRates' +import type { PrismaClient } from '@prisma/client' +import type { RateType } from '../../domain-models/contractAndRates' import { findRateWithHistory } from './findRateWithHistory' // Update the given draft diff --git a/services/app-api/src/postgres/healthPlanPackage/findAllHealthPlanPackagesByState.ts b/services/app-api/src/postgres/healthPlanPackage/findAllHealthPlanPackagesByState.ts index e534594d56..58e48c352f 100644 --- a/services/app-api/src/postgres/healthPlanPackage/findAllHealthPlanPackagesByState.ts +++ b/services/app-api/src/postgres/healthPlanPackage/findAllHealthPlanPackagesByState.ts @@ -1,14 +1,11 @@ -import { PrismaClient } from '@prisma/client' -import { HealthPlanPackageType } from '../../domain-models' -import { - convertPrismaErrorToStoreError, - isStoreError, - StoreError, -} from '../storeError' +import type { PrismaClient } from '@prisma/client' +import type { HealthPlanPackageType } from '../../domain-models' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError, isStoreError } from '../storeError' +import type { HealthPlanPackageWithRevisionsTable } from './healthPlanPackageHelpers' import { convertToHealthPlanPackageType, getCurrentRevision, - HealthPlanPackageWithRevisionsTable, } from './healthPlanPackageHelpers' export async function findAllPackagesWrapper( diff --git a/services/app-api/src/postgres/healthPlanPackage/findAllHealthPlanPackagesBySubmittedAt.ts b/services/app-api/src/postgres/healthPlanPackage/findAllHealthPlanPackagesBySubmittedAt.ts index bc3f46e76e..6366aad0b5 100644 --- a/services/app-api/src/postgres/healthPlanPackage/findAllHealthPlanPackagesBySubmittedAt.ts +++ b/services/app-api/src/postgres/healthPlanPackage/findAllHealthPlanPackagesBySubmittedAt.ts @@ -1,14 +1,12 @@ -import { PrismaClient } from '@prisma/client' -import { HealthPlanPackageType, packageStatus } from '../../domain-models' -import { - convertPrismaErrorToStoreError, - isStoreError, - StoreError, -} from '../storeError' +import type { PrismaClient } from '@prisma/client' +import type { HealthPlanPackageType } from '../../domain-models' +import { packageStatus } from '../../domain-models' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError, isStoreError } from '../storeError' +import type { HealthPlanPackageWithRevisionsTable } from './healthPlanPackageHelpers' import { convertToHealthPlanPackageType, getCurrentRevision, - HealthPlanPackageWithRevisionsTable, } from './healthPlanPackageHelpers' export async function findAllPackagesWrapper( diff --git a/services/app-api/src/postgres/healthPlanPackage/findAllRevisions.ts b/services/app-api/src/postgres/healthPlanPackage/findAllRevisions.ts index a737323d43..dfb3743e87 100644 --- a/services/app-api/src/postgres/healthPlanPackage/findAllRevisions.ts +++ b/services/app-api/src/postgres/healthPlanPackage/findAllRevisions.ts @@ -1,6 +1,9 @@ -import { PrismaClient } from '@prisma/client' -import { HealthPlanPackageTable, HealthPlanRevisionTable } from '@prisma/client' -import { StoreError } from '../storeError' +import type { PrismaClient } from '@prisma/client' +import type { + HealthPlanPackageTable, + HealthPlanRevisionTable, +} from '@prisma/client' +import type { StoreError } from '../storeError' export type PackagesAndRevisions = (HealthPlanPackageTable & { revisions: HealthPlanRevisionTable[] })[] diff --git a/services/app-api/src/postgres/healthPlanPackage/findHealthPlanPackage.ts b/services/app-api/src/postgres/healthPlanPackage/findHealthPlanPackage.ts index 11f85296a1..7e127409a1 100644 --- a/services/app-api/src/postgres/healthPlanPackage/findHealthPlanPackage.ts +++ b/services/app-api/src/postgres/healthPlanPackage/findHealthPlanPackage.ts @@ -1,14 +1,9 @@ -import { PrismaClient } from '@prisma/client' -import { HealthPlanPackageType } from '../../domain-models' -import { - convertPrismaErrorToStoreError, - isStoreError, - StoreError, -} from '../storeError' -import { - convertToHealthPlanPackageType, - HealthPlanPackageWithRevisionsTable, -} from './healthPlanPackageHelpers' +import type { PrismaClient } from '@prisma/client' +import type { HealthPlanPackageType } from '../../domain-models' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError, isStoreError } from '../storeError' +import type { HealthPlanPackageWithRevisionsTable } from './healthPlanPackageHelpers' +import { convertToHealthPlanPackageType } from './healthPlanPackageHelpers' export async function findUniqueSubmissionWrapper( client: PrismaClient, diff --git a/services/app-api/src/postgres/healthPlanPackage/healthPlanPackageHelpers.ts b/services/app-api/src/postgres/healthPlanPackage/healthPlanPackageHelpers.ts index 86b2797ba1..df64f455ec 100644 --- a/services/app-api/src/postgres/healthPlanPackage/healthPlanPackageHelpers.ts +++ b/services/app-api/src/postgres/healthPlanPackage/healthPlanPackageHelpers.ts @@ -1,10 +1,13 @@ -import { HealthPlanPackageTable, HealthPlanRevisionTable } from '@prisma/client' -import { +import type { + HealthPlanPackageTable, + HealthPlanRevisionTable, +} from '@prisma/client' +import type { HealthPlanPackageType, Question, UpdateInfoType, } from '../../domain-models' -import { StoreError } from '../storeError' +import type { StoreError } from '../storeError' export type HealthPlanPackageWithRevisionsTable = HealthPlanPackageTable & { revisions: HealthPlanRevisionTable[] diff --git a/services/app-api/src/postgres/healthPlanPackage/index.ts b/services/app-api/src/postgres/healthPlanPackage/index.ts index 3ef0242227..db159f71c8 100644 --- a/services/app-api/src/postgres/healthPlanPackage/index.ts +++ b/services/app-api/src/postgres/healthPlanPackage/index.ts @@ -1,10 +1,8 @@ export { findAllHealthPlanPackagesByState } from './findAllHealthPlanPackagesByState' export { findAllHealthPlanPackagesBySubmittedAt } from './findAllHealthPlanPackagesBySubmittedAt' export { findHealthPlanPackage } from './findHealthPlanPackage' -export { - insertHealthPlanPackage, - InsertHealthPlanPackageArgsType, -} from './insertHealthPlanPackage' +export type { InsertHealthPlanPackageArgsType } from './insertHealthPlanPackage' +export { insertHealthPlanPackage } from './insertHealthPlanPackage' export { insertHealthPlanRevision } from './insertHealthPlanRevision' export { updateHealthPlanRevision } from './updateHealthPlanRevision' export { findAllRevisions } from './findAllRevisions' diff --git a/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanPackage.test.ts b/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanPackage.test.ts index b959a118a4..dcaf141640 100644 --- a/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanPackage.test.ts +++ b/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanPackage.test.ts @@ -1,10 +1,8 @@ -import { HealthPlanPackageType } from '../../domain-models' +import type { HealthPlanPackageType } from '../../domain-models' import { toDomain } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto' import { sharedTestPrismaClient } from '../../testHelpers/storeHelpers' -import { - insertHealthPlanPackage, - InsertHealthPlanPackageArgsType, -} from './insertHealthPlanPackage' +import type { InsertHealthPlanPackageArgsType } from './insertHealthPlanPackage' +import { insertHealthPlanPackage } from './insertHealthPlanPackage' import { isStoreError } from '../storeError' describe('insertHealthPlanPackage', () => { diff --git a/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanPackage.ts b/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanPackage.ts index d754887c1c..480bd8f523 100644 --- a/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanPackage.ts +++ b/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanPackage.ts @@ -1,20 +1,17 @@ -import { PrismaClient } from '@prisma/client' +import type { PrismaClient } from '@prisma/client' import { Buffer } from 'buffer' import { v4 as uuidv4 } from 'uuid' -import { +import type { UnlockedHealthPlanFormDataType, SubmissionType, ContractType, } from '../../../../app-web/src/common-code/healthPlanFormDataType' -import { HealthPlanPackageType } from '../../domain-models' +import type { HealthPlanPackageType } from '../../domain-models' import { toProtoBuffer } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto' -import { - convertPrismaErrorToStoreError, - isStoreError, - StoreError, -} from '../storeError' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError, isStoreError } from '../storeError' import { convertToHealthPlanPackageType } from './healthPlanPackageHelpers' -import { PopulationCoveredType } from '../../gen/gqlServer' +import type { PopulationCoveredType } from '../../gen/gqlServer' export type InsertHealthPlanPackageArgsType = { stateCode: string diff --git a/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanRevision.ts b/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanRevision.ts index bc4adb1581..9fce0cff84 100644 --- a/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanRevision.ts +++ b/services/app-api/src/postgres/healthPlanPackage/insertHealthPlanRevision.ts @@ -1,9 +1,10 @@ -import { PrismaClient } from '@prisma/client' +import type { PrismaClient } from '@prisma/client' import { v4 as uuidv4 } from 'uuid' -import { UnlockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' -import { HealthPlanPackageType, UpdateInfoType } from '../../domain-models' +import type { UnlockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { HealthPlanPackageType, UpdateInfoType } from '../../domain-models' import { toProtoBuffer } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto' -import { convertPrismaErrorToStoreError, StoreError } from '../storeError' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' import { convertToHealthPlanPackageType } from './healthPlanPackageHelpers' export type InsertHealthPlanRevisionArgsType = { diff --git a/services/app-api/src/postgres/healthPlanPackage/updateHealthPlanRevision.ts b/services/app-api/src/postgres/healthPlanPackage/updateHealthPlanRevision.ts index 7fe7aea38a..b429407eb6 100644 --- a/services/app-api/src/postgres/healthPlanPackage/updateHealthPlanRevision.ts +++ b/services/app-api/src/postgres/healthPlanPackage/updateHealthPlanRevision.ts @@ -1,16 +1,11 @@ -import { HealthPlanRevisionTable, PrismaClient } from '@prisma/client' -import { HealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { HealthPlanRevisionTable, PrismaClient } from '@prisma/client' +import type { HealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { toProtoBuffer } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto' -import { UpdateInfoType, HealthPlanPackageType } from '../../domain-models' -import { - convertPrismaErrorToStoreError, - isStoreError, - StoreError, -} from '../storeError' -import { - convertToHealthPlanPackageType, - HealthPlanPackageWithRevisionsTable, -} from './healthPlanPackageHelpers' +import type { UpdateInfoType, HealthPlanPackageType } from '../../domain-models' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError, isStoreError } from '../storeError' +import type { HealthPlanPackageWithRevisionsTable } from './healthPlanPackageHelpers' +import { convertToHealthPlanPackageType } from './healthPlanPackageHelpers' export async function updateRevisionWrapper( client: PrismaClient, diff --git a/services/app-api/src/postgres/index.ts b/services/app-api/src/postgres/index.ts index 734bfd32f5..4e80434d55 100644 --- a/services/app-api/src/postgres/index.ts +++ b/services/app-api/src/postgres/index.ts @@ -1,7 +1,9 @@ export { findPrograms } from './state/findPrograms' -export { InsertHealthPlanPackageArgsType } from './healthPlanPackage' -export { InsertUserArgsType } from './user' -export { NewPostgresStore, Store } from './postgresStore' +export type { InsertHealthPlanPackageArgsType } from './healthPlanPackage' +export type { InsertUserArgsType } from './user' +export type { Store } from './postgresStore' +export { NewPostgresStore } from './postgresStore' export { NewPrismaClient } from './prismaClient' -export { isStoreError, StoreError, NotFoundError } from './storeError' +export type { StoreError } from './storeError' +export { isStoreError, NotFoundError } from './storeError' export { findStatePrograms } from './state/findStatePrograms' diff --git a/services/app-api/src/postgres/postgresStore.ts b/services/app-api/src/postgres/postgresStore.ts index ddb15e1ee5..be0224cd3b 100644 --- a/services/app-api/src/postgres/postgresStore.ts +++ b/services/app-api/src/postgres/postgresStore.ts @@ -1,10 +1,14 @@ -import { PrismaClient, HealthPlanRevisionTable, Division } from '@prisma/client' -import { +import type { + PrismaClient, + HealthPlanRevisionTable, + Division, +} from '@prisma/client' +import type { UnlockedHealthPlanFormDataType, HealthPlanFormDataType, StateCodeType, } from '../../../app-web/src/common-code/healthPlanFormDataType' -import { +import type { ProgramType, HealthPlanPackageType, UpdateInfoType, @@ -18,21 +22,21 @@ import { StateType, } from '../domain-models' import { findPrograms, findStatePrograms } from '../postgres' -import { StoreError } from './storeError' +import type { StoreError } from './storeError' +import type { InsertHealthPlanPackageArgsType } from './healthPlanPackage' import { findAllHealthPlanPackagesByState, findAllHealthPlanPackagesBySubmittedAt, findHealthPlanPackage, insertHealthPlanPackage, - InsertHealthPlanPackageArgsType, insertHealthPlanRevision, updateHealthPlanRevision, findAllRevisions, } from './healthPlanPackage' +import type { InsertUserArgsType } from './user' import { findUser, insertUser, - InsertUserArgsType, updateCmsUserProperties, findAllUsers, insertManyUsers, @@ -43,12 +47,12 @@ import { insertQuestionResponse, } from './questionResponse' import { findAllSupportedStates } from './state' -import { ContractType } from '../domain-models/contractAndRates' +import type { ContractType } from '../domain-models/contractAndRates' import { - InsertContractArgsType, insertDraftContract, findContractWithHistory, } from './contractAndRates' +import type { InsertContractArgsType } from './contractAndRates' type Store = { findPrograms: ( @@ -196,4 +200,5 @@ function NewPostgresStore(client: PrismaClient): Store { } } -export { NewPostgresStore, Store } +export type { Store } +export { NewPostgresStore } diff --git a/services/app-api/src/postgres/prismaTypes.ts b/services/app-api/src/postgres/prismaTypes.ts index 7d6049374c..e5bace715c 100644 --- a/services/app-api/src/postgres/prismaTypes.ts +++ b/services/app-api/src/postgres/prismaTypes.ts @@ -1,4 +1,4 @@ -import { PrismaClient } from '@prisma/client' +import type { PrismaClient } from '@prisma/client' // This is the type returned by client.$transaction type PrismaTransactionType = Omit< diff --git a/services/app-api/src/postgres/questionResponse/findAllQuestionsByHealthPlanPackage.ts b/services/app-api/src/postgres/questionResponse/findAllQuestionsByHealthPlanPackage.ts index 29ba48bbe7..bd65b04d1b 100644 --- a/services/app-api/src/postgres/questionResponse/findAllQuestionsByHealthPlanPackage.ts +++ b/services/app-api/src/postgres/questionResponse/findAllQuestionsByHealthPlanPackage.ts @@ -1,10 +1,11 @@ -import { PrismaClient } from '@prisma/client' -import { +import type { PrismaClient } from '@prisma/client' +import type { CMSUserType, Question, QuestionResponseType, } from '../../domain-models' -import { convertPrismaErrorToStoreError, StoreError } from '../storeError' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' export async function findAllQuestionsByHealthPlanPackage( client: PrismaClient, diff --git a/services/app-api/src/postgres/questionResponse/insertQuestion.ts b/services/app-api/src/postgres/questionResponse/insertQuestion.ts index 66fbca9e52..3399cd7e13 100644 --- a/services/app-api/src/postgres/questionResponse/insertQuestion.ts +++ b/services/app-api/src/postgres/questionResponse/insertQuestion.ts @@ -1,12 +1,13 @@ -import { PrismaClient } from '@prisma/client' -import { +import type { PrismaClient } from '@prisma/client' +import type { CMSUserType, QuestionResponseType, Question, CreateQuestionInput, DivisionType, } from '../../domain-models' -import { convertPrismaErrorToStoreError, StoreError } from '../storeError' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' import { v4 as uuidv4 } from 'uuid' export async function insertQuestion( diff --git a/services/app-api/src/postgres/questionResponse/insertQuestionResponse.ts b/services/app-api/src/postgres/questionResponse/insertQuestionResponse.ts index 51f3aec2bf..b27b5652ec 100644 --- a/services/app-api/src/postgres/questionResponse/insertQuestionResponse.ts +++ b/services/app-api/src/postgres/questionResponse/insertQuestionResponse.ts @@ -1,6 +1,7 @@ -import { PrismaClient } from '@prisma/client' -import { convertPrismaErrorToStoreError, StoreError } from '../storeError' -import { +import type { PrismaClient } from '@prisma/client' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' +import type { InsertQuestionResponseArgs, QuestionResponseType, StateUserType, diff --git a/services/app-api/src/postgres/state/findAllSupportedStates.ts b/services/app-api/src/postgres/state/findAllSupportedStates.ts index 2cc9f03887..078a89f9bd 100644 --- a/services/app-api/src/postgres/state/findAllSupportedStates.ts +++ b/services/app-api/src/postgres/state/findAllSupportedStates.ts @@ -1,7 +1,8 @@ -import { StateType } from '../../domain-models' +import type { StateType } from '../../domain-models' import statePrograms from '../../../../app-web/src/common-code/data/statePrograms.json' -import { convertPrismaErrorToStoreError, StoreError } from '../storeError' -import { PrismaClient } from '@prisma/client' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' +import type { PrismaClient } from '@prisma/client' // Returns postgres state info for the states that currently supported for pilot. // Supported states are state that have had their programs added to the statePrograms json file. diff --git a/services/app-api/src/postgres/state/findPrograms.ts b/services/app-api/src/postgres/state/findPrograms.ts index 6ea5442c53..45a5782521 100644 --- a/services/app-api/src/postgres/state/findPrograms.ts +++ b/services/app-api/src/postgres/state/findPrograms.ts @@ -1,4 +1,4 @@ -import { ProgramType } from '../../domain-models' +import type { ProgramType } from '../../domain-models' import statePrograms from '../../../../app-web/src/common-code/data/statePrograms.json' // Currently relies on state programs json; does not query postgres diff --git a/services/app-api/src/postgres/state/findStatePrograms.ts b/services/app-api/src/postgres/state/findStatePrograms.ts index 7dd2c77f37..e088e9aab1 100644 --- a/services/app-api/src/postgres/state/findStatePrograms.ts +++ b/services/app-api/src/postgres/state/findStatePrograms.ts @@ -1,5 +1,5 @@ import statePrograms from '../../../../app-web/src/common-code/data/statePrograms.json' -import { ProgramType } from '../../domain-models' +import type { ProgramType } from '../../domain-models' // Currently relies on state programs json; does not query postgres function findStatePrograms(stateCode: string): ProgramType[] | Error { diff --git a/services/app-api/src/postgres/storeError.test.ts b/services/app-api/src/postgres/storeError.test.ts index 48420dffc4..5908236dd3 100644 --- a/services/app-api/src/postgres/storeError.test.ts +++ b/services/app-api/src/postgres/storeError.test.ts @@ -1,7 +1,7 @@ /* eslint-disable jest/no-conditional-expect */ import { v4 as uuidv4 } from 'uuid' import { PrismaClient } from '@prisma/client' -import { UnlockedHealthPlanFormDataType } from '../../../app-web/src/common-code/healthPlanFormDataType' +import type { UnlockedHealthPlanFormDataType } from '../../../app-web/src/common-code/healthPlanFormDataType' import { toProtoBuffer } from '../../../app-web/src/common-code/proto/healthPlanFormDataProto' import { sharedTestPrismaClient } from '../testHelpers/storeHelpers' import { convertPrismaErrorToStoreError } from './storeError' diff --git a/services/app-api/src/postgres/storeError.ts b/services/app-api/src/postgres/storeError.ts index 25d2b61aaa..36aa9cbe93 100644 --- a/services/app-api/src/postgres/storeError.ts +++ b/services/app-api/src/postgres/storeError.ts @@ -98,9 +98,5 @@ class NotFoundError extends Error { } } -export { - NotFoundError, - StoreError, - isStoreError, - convertPrismaErrorToStoreError, -} +export type { StoreError } +export { NotFoundError, isStoreError, convertPrismaErrorToStoreError } diff --git a/services/app-api/src/postgres/user/findAllUsers.ts b/services/app-api/src/postgres/user/findAllUsers.ts index 48031c5430..dce96c34d6 100644 --- a/services/app-api/src/postgres/user/findAllUsers.ts +++ b/services/app-api/src/postgres/user/findAllUsers.ts @@ -1,6 +1,7 @@ -import { PrismaClient } from '@prisma/client' -import { UserType } from '../../domain-models' -import { convertPrismaErrorToStoreError, StoreError } from '../storeError' +import type { PrismaClient } from '@prisma/client' +import type { UserType } from '../../domain-models' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' import { parseDomainUsersFromPrismaUsers } from './prismaDomainUser' export async function findAllUsers( diff --git a/services/app-api/src/postgres/user/findUser.ts b/services/app-api/src/postgres/user/findUser.ts index 8752eb8e13..ad4c44b7b9 100644 --- a/services/app-api/src/postgres/user/findUser.ts +++ b/services/app-api/src/postgres/user/findUser.ts @@ -1,6 +1,7 @@ -import { PrismaClient } from '@prisma/client' -import { convertPrismaErrorToStoreError, StoreError } from '../storeError' -import { UserType } from '../../domain-models' +import type { PrismaClient } from '@prisma/client' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' +import type { UserType } from '../../domain-models' import { domainUserFromPrismaUser } from './prismaDomainUser' export async function findUser( diff --git a/services/app-api/src/postgres/user/index.ts b/services/app-api/src/postgres/user/index.ts index a00bbc01f6..4d0fdf1f95 100644 --- a/services/app-api/src/postgres/user/index.ts +++ b/services/app-api/src/postgres/user/index.ts @@ -1,5 +1,6 @@ export { findUser } from './findUser' -export { insertUser, InsertUserArgsType } from './insertUser' +export type { InsertUserArgsType } from './insertUser' +export { insertUser } from './insertUser' export { insertManyUsers } from './insertManyUsers' export { updateCmsUserProperties } from './updateCmsUserProperties' export { findAllUsers } from './findAllUsers' diff --git a/services/app-api/src/postgres/user/insertManyUsers.ts b/services/app-api/src/postgres/user/insertManyUsers.ts index 5268dc550f..592b7d57dd 100644 --- a/services/app-api/src/postgres/user/insertManyUsers.ts +++ b/services/app-api/src/postgres/user/insertManyUsers.ts @@ -1,7 +1,9 @@ -import { PrismaClient } from '@prisma/client' -import { StoreError, convertPrismaErrorToStoreError } from '../storeError' -import { UserType, toDomainUser } from '../../domain-models' -import { InsertUserArgsType } from './insertUser' +import type { PrismaClient } from '@prisma/client' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' +import type { UserType } from '../../domain-models' +import { toDomainUser } from '../../domain-models' +import type { InsertUserArgsType } from './insertUser' export async function insertManyUsers( client: PrismaClient, diff --git a/services/app-api/src/postgres/user/insertUser.ts b/services/app-api/src/postgres/user/insertUser.ts index 0325f787b8..b947b4bf74 100644 --- a/services/app-api/src/postgres/user/insertUser.ts +++ b/services/app-api/src/postgres/user/insertUser.ts @@ -1,6 +1,8 @@ -import { PrismaClient, Role } from '@prisma/client' -import { StoreError, convertPrismaErrorToStoreError } from '../storeError' -import { DivisionType, UserType, toDomainUser } from '../../domain-models' +import type { PrismaClient, Role } from '@prisma/client' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError } from '../storeError' +import type { DivisionType, UserType } from '../../domain-models' +import { toDomainUser } from '../../domain-models' export type InsertUserArgsType = { userID: string diff --git a/services/app-api/src/postgres/user/prismaDomainUser.ts b/services/app-api/src/postgres/user/prismaDomainUser.ts index 5ad6026b9b..353f7c1ea6 100644 --- a/services/app-api/src/postgres/user/prismaDomainUser.ts +++ b/services/app-api/src/postgres/user/prismaDomainUser.ts @@ -1,6 +1,7 @@ -import { User, State } from '@prisma/client' -import { UserType } from '../../domain-models' -import { isStoreError, StoreError } from '../storeError' +import type { User, State } from '@prisma/client' +import type { UserType } from '../../domain-models' +import type { StoreError } from '../storeError' +import { isStoreError } from '../storeError' // We are storing all the possible values for any of the user types in the same // table in prisma, so we need to parse those into valid UserTypes or error if something diff --git a/services/app-api/src/postgres/user/updateCmsUserProperties.ts b/services/app-api/src/postgres/user/updateCmsUserProperties.ts index 03bbb00365..e683b95efb 100644 --- a/services/app-api/src/postgres/user/updateCmsUserProperties.ts +++ b/services/app-api/src/postgres/user/updateCmsUserProperties.ts @@ -1,11 +1,9 @@ -import { - convertPrismaErrorToStoreError, - isStoreError, - StoreError, -} from '../storeError' -import { StateCodeType } from 'app-web/src/common-code/healthPlanFormDataType' -import { Division, PrismaClient, AuditAction } from '@prisma/client' -import { CMSUserType } from '../../domain-models' +import type { StoreError } from '../storeError' +import { convertPrismaErrorToStoreError, isStoreError } from '../storeError' +import type { StateCodeType } from 'app-web/src/common-code/healthPlanFormDataType' +import type { Division, PrismaClient } from '@prisma/client' +import { AuditAction } from '@prisma/client' +import type { CMSUserType } from '../../domain-models' import { domainUserFromPrismaUser } from './prismaDomainUser' export async function updateCmsUserProperties( diff --git a/services/app-api/src/resolvers/attributeHelper.ts b/services/app-api/src/resolvers/attributeHelper.ts index 54f9c2059c..1d49eeac5a 100644 --- a/services/app-api/src/resolvers/attributeHelper.ts +++ b/services/app-api/src/resolvers/attributeHelper.ts @@ -1,4 +1,4 @@ -import { Context } from '../handlers/apollo_gql' +import type { Context } from '../handlers/apollo_gql' import { SemanticAttributes } from '@opentelemetry/semantic-conventions' import { SpanStatusCode } from '@opentelemetry/api' diff --git a/services/app-api/src/resolvers/configureResolvers.ts b/services/app-api/src/resolvers/configureResolvers.ts index 91d0ee8f53..38eef5de0e 100644 --- a/services/app-api/src/resolvers/configureResolvers.ts +++ b/services/app-api/src/resolvers/configureResolvers.ts @@ -1,6 +1,6 @@ import { GraphQLDate, GraphQLDateTime } from 'graphql-scalars' import type { Emailer } from '../emailer' -import { Resolvers } from '../gen/gqlServer' +import type { Resolvers } from '../gen/gqlServer' import type { Store } from '../postgres' import { createHealthPlanPackageResolver, @@ -23,8 +23,8 @@ import { cmsUserResolver, indexUsersResolver, } from './user' -import { EmailParameterStore } from '../parameterStore' -import { LDService } from '../launchDarkly/launchDarkly' +import type { EmailParameterStore } from '../parameterStore' +import type { LDService } from '../launchDarkly/launchDarkly' import { fetchEmailSettingsResolver } from './email/fetchEmailSettings' export function configureResolvers( diff --git a/services/app-api/src/resolvers/email/fetchEmailSettings.ts b/services/app-api/src/resolvers/email/fetchEmailSettings.ts index 733e081926..4e27cc2a78 100644 --- a/services/app-api/src/resolvers/email/fetchEmailSettings.ts +++ b/services/app-api/src/resolvers/email/fetchEmailSettings.ts @@ -1,12 +1,14 @@ import { ForbiddenError } from 'apollo-server-lambda' -import { StateCodeType } from '../../../../app-web/src/common-code/healthPlanFormDataType' -import { isAdminUser, StateType } from '../../domain-models' +import type { StateCodeType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { StateType } from '../../domain-models' +import { isAdminUser } from '../../domain-models' import { isHelpdeskUser } from '../../domain-models/user' -import { Emailer } from '../../emailer' -import { QueryResolvers } from '../../gen/gqlServer' +import type { Emailer } from '../../emailer' +import type { QueryResolvers } from '../../gen/gqlServer' import { logError, logSuccess } from '../../logger' -import { EmailParameterStore } from '../../parameterStore' -import { isStoreError, Store } from '../../postgres' +import type { EmailParameterStore } from '../../parameterStore' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { setErrorAttributesOnActiveSpan, setResolverDetailsOnActiveSpan, diff --git a/services/app-api/src/resolvers/healthPlanPackage/createHealthPlanPackage.test.ts b/services/app-api/src/resolvers/healthPlanPackage/createHealthPlanPackage.test.ts index 964adbd395..95f4dc83e0 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/createHealthPlanPackage.test.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/createHealthPlanPackage.test.ts @@ -1,10 +1,10 @@ -import { CreateHealthPlanPackageInput } from '../../gen/gqlServer' +import type { CreateHealthPlanPackageInput } from '../../gen/gqlServer' import CREATE_HEALTH_PLAN_PACKAGE from '../../../../app-graphql/src/mutations/createHealthPlanPackage.graphql' import { constructTestPostgresServer } from '../../testHelpers/gqlHelpers' import { latestFormData } from '../../testHelpers/healthPlanPackageHelpers' import { testCMSUser } from '../../testHelpers/userHelpers' import { testLDService } from '../../testHelpers/launchDarklyHelpers' -import { +import type { FeatureFlagLDConstant, FlagValue, } from '../../../../app-web/src/common-code/featureFlags' diff --git a/services/app-api/src/resolvers/healthPlanPackage/createHealthPlanPackage.ts b/services/app-api/src/resolvers/healthPlanPackage/createHealthPlanPackage.ts index 37891d3b4c..2f730616a2 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/createHealthPlanPackage.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/createHealthPlanPackage.ts @@ -1,12 +1,9 @@ import { ForbiddenError, UserInputError } from 'apollo-server-lambda' import { isStateUser } from '../../domain-models' -import { MutationResolvers, State } from '../../gen/gqlServer' +import type { MutationResolvers, State } from '../../gen/gqlServer' import { logError, logSuccess } from '../../logger' -import { - InsertHealthPlanPackageArgsType, - isStoreError, - Store, -} from '../../postgres' +import type { InsertHealthPlanPackageArgsType, Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { pluralize } from '../../../../app-web/src/common-code/formatters' import { setResolverDetailsOnActiveSpan, @@ -14,7 +11,7 @@ import { setSuccessAttributesOnActiveSpan, } from '../attributeHelper' import { GraphQLError } from 'graphql/index' -import { LDService } from '../../launchDarkly/launchDarkly' +import type { LDService } from '../../launchDarkly/launchDarkly' import { convertContractToUnlockedHealthPlanPackage } from '../../domain-models' export function createHealthPlanPackageResolver( diff --git a/services/app-api/src/resolvers/healthPlanPackage/fetchHealthPlanPackage.ts b/services/app-api/src/resolvers/healthPlanPackage/fetchHealthPlanPackage.ts index daf0650697..9a760686ad 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/fetchHealthPlanPackage.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/fetchHealthPlanPackage.ts @@ -1,22 +1,23 @@ import { ForbiddenError } from 'apollo-server-lambda' +import type { HealthPlanPackageType } from '../../domain-models' import { isCMSUser, isStateUser, isAdminUser, - HealthPlanPackageType, packageStatus, convertContractToUnlockedHealthPlanPackage, } from '../../domain-models' import { isHelpdeskUser } from '../../domain-models/user' -import { QueryResolvers, State } from '../../gen/gqlServer' +import type { QueryResolvers, State } from '../../gen/gqlServer' import { logError, logSuccess } from '../../logger' -import { isStoreError, Store } from '../../postgres' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { setErrorAttributesOnActiveSpan, setResolverDetailsOnActiveSpan, setSuccessAttributesOnActiveSpan, } from '../attributeHelper' -import { LDService } from '../../launchDarkly/launchDarkly' +import type { LDService } from '../../launchDarkly/launchDarkly' import { GraphQLError } from 'graphql/index' import { NotFoundError } from '../../postgres' diff --git a/services/app-api/src/resolvers/healthPlanPackage/healthPlanPackageResolver.ts b/services/app-api/src/resolvers/healthPlanPackage/healthPlanPackageResolver.ts index f742fdfb7a..5cc3ae3c11 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/healthPlanPackageResolver.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/healthPlanPackageResolver.ts @@ -1,8 +1,9 @@ import { packageStatus, packageSubmittedAt } from '../../domain-models' import { protoToBase64 } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto' import statePrograms from '../../../../app-web/src/common-code/data/statePrograms.json' -import { Resolvers } from '../../gen/gqlServer' -import { isStoreError, Store } from '../../postgres' +import type { Resolvers } from '../../gen/gqlServer' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { convertToIndexQuestionsPayload } from '../../postgres/questionResponse' import { logError } from '../../logger' import { setErrorAttributesOnActiveSpan } from '../attributeHelper' diff --git a/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.test.ts b/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.test.ts index 194246bd96..e55dac4de3 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.test.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.test.ts @@ -9,7 +9,10 @@ import { submitTestHealthPlanPackage, } from '../../testHelpers/gqlHelpers' import { todaysDate } from '../../testHelpers/dateHelpers' -import { HealthPlanPackageEdge, HealthPlanPackage } from '../../gen/gqlServer' +import type { + HealthPlanPackageEdge, + HealthPlanPackage, +} from '../../gen/gqlServer' import { latestFormData } from '../../testHelpers/healthPlanPackageHelpers' import { testCMSUser, testStateUser } from '../../testHelpers/userHelpers' diff --git a/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.ts b/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.ts index 27390b273d..1b43f8f3a0 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.ts @@ -1,15 +1,12 @@ -import { Span } from '@opentelemetry/api' +import type { Span } from '@opentelemetry/api' import { ForbiddenError } from 'apollo-server-lambda' -import { - isStateUser, - HealthPlanPackageType, - isCMSUser, - isAdminUser, -} from '../../domain-models' +import type { HealthPlanPackageType } from '../../domain-models' +import { isStateUser, isCMSUser, isAdminUser } from '../../domain-models' import { isHelpdeskUser } from '../../domain-models/user' -import { QueryResolvers } from '../../gen/gqlServer' +import type { QueryResolvers } from '../../gen/gqlServer' import { logError, logSuccess } from '../../logger' -import { isStoreError, Store, StoreError } from '../../postgres' +import type { Store, StoreError } from '../../postgres' +import { isStoreError } from '../../postgres' import { setErrorAttributesOnActiveSpan, setResolverDetailsOnActiveSpan, diff --git a/services/app-api/src/resolvers/healthPlanPackage/submitHealthPlanPackage.ts b/services/app-api/src/resolvers/healthPlanPackage/submitHealthPlanPackage.ts index a4c040030f..f488570461 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/submitHealthPlanPackage.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/submitHealthPlanPackage.ts @@ -10,24 +10,24 @@ import { isValidAndCurrentLockedHealthPlanFormData, hasValidSupportingDocumentCategories, } from '../../../../app-web/src/common-code/healthPlanFormDataType/healthPlanFormData' +import type { UpdateInfoType, HealthPlanPackageType } from '../../domain-models' import { - UpdateInfoType, isStateUser, - HealthPlanPackageType, packageStatus, packageSubmitters, } from '../../domain-models' -import { Emailer } from '../../emailer' -import { MutationResolvers, State } from '../../gen/gqlServer' +import type { Emailer } from '../../emailer' +import type { MutationResolvers, State } from '../../gen/gqlServer' import { logError, logSuccess } from '../../logger' -import { isStoreError, Store } from '../../postgres' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { setResolverDetailsOnActiveSpan, setErrorAttributesOnActiveSpan, setSuccessAttributesOnActiveSpan, } from '../attributeHelper' import { toDomain } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto' -import { EmailParameterStore } from '../../parameterStore' +import type { EmailParameterStore } from '../../parameterStore' import { GraphQLError } from 'graphql' import type { diff --git a/services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.test.ts b/services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.test.ts index 51bcebdc46..ea2d25647f 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.test.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.test.ts @@ -1,6 +1,6 @@ -import { GraphQLError } from 'graphql' +import type { GraphQLError } from 'graphql' import UNLOCK_HEALTH_PLAN_PACKAGE from '../../../../app-graphql/src/mutations/unlockHealthPlanPackage.graphql' -import { HealthPlanPackage } from '../../gen/gqlServer' +import type { HealthPlanPackage } from '../../gen/gqlServer' import { todaysDate } from '../../testHelpers/dateHelpers' import { constructTestPostgresServer, diff --git a/services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.ts b/services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.ts index 1b0e0b3d49..767817f1d7 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.ts @@ -1,26 +1,26 @@ import { ForbiddenError, UserInputError } from 'apollo-server-lambda' -import { +import type { UnlockedHealthPlanFormDataType, LockedHealthPlanFormDataType, } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { toDomain } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto' +import type { UpdateInfoType, HealthPlanPackageType } from '../../domain-models' import { isCMSUser, - UpdateInfoType, - HealthPlanPackageType, packageStatus, packageSubmitters, } from '../../domain-models' -import { Emailer } from '../../emailer' -import { MutationResolvers } from '../../gen/gqlServer' +import type { Emailer } from '../../emailer' +import type { MutationResolvers } from '../../gen/gqlServer' import { logError, logSuccess } from '../../logger' -import { isStoreError, Store } from '../../postgres' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { setErrorAttributesOnActiveSpan, setResolverDetailsOnActiveSpan, setSuccessAttributesOnActiveSpan, } from '../attributeHelper' -import { EmailParameterStore } from '../../parameterStore' +import type { EmailParameterStore } from '../../parameterStore' import { GraphQLError } from 'graphql' // unlock is a state machine transforming a LockedFormData and turning it into UnlockedFormData diff --git a/services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.ts b/services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.ts index 407b319aed..3662ac37ab 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.ts @@ -1,20 +1,16 @@ import { ForbiddenError, UserInputError } from 'apollo-server-lambda' -import { - UnlockedHealthPlanFormDataType, - convertRateSupportingDocs, -} from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { UnlockedHealthPlanFormDataType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import { convertRateSupportingDocs } from '../../../../app-web/src/common-code/healthPlanFormDataType' import { base64ToDomain, toDomain, } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto' -import { - isStateUser, - HealthPlanPackageType, - packageStatus, -} from '../../domain-models' -import { MutationResolvers } from '../../gen/gqlServer' +import type { HealthPlanPackageType } from '../../domain-models' +import { isStateUser, packageStatus } from '../../domain-models' +import type { MutationResolvers } from '../../gen/gqlServer' import { logError, logSuccess } from '../../logger' -import { isStoreError, Store } from '../../postgres' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { setErrorAttributesOnActiveSpan, setResolverDetailsOnActiveSpan, @@ -193,7 +189,6 @@ export function updateHealthPlanFormDataResolver( const editableRevision = planPackage.revisions[0] - // This logic is no longer needed once SUPPORTING_DOCS_BY_RATE flag is on in production - it was used to remove rate supporting docs form contract only submisisons if ( unlockedFormData.submissionType === 'CONTRACT_ONLY' && diff --git a/services/app-api/src/resolvers/questionResponse/createQuestion.ts b/services/app-api/src/resolvers/questionResponse/createQuestion.ts index 5bec3db08e..32b6eebc6d 100644 --- a/services/app-api/src/resolvers/questionResponse/createQuestion.ts +++ b/services/app-api/src/resolvers/questionResponse/createQuestion.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from '../../gen/gqlServer' +import type { MutationResolvers } from '../../gen/gqlServer' import { isCMSUser, packageStatus } from '../../domain-models' import { logError, logSuccess } from '../../logger' import { @@ -6,7 +6,8 @@ import { setSuccessAttributesOnActiveSpan, } from '../attributeHelper' import { ForbiddenError, UserInputError } from 'apollo-server-lambda' -import { isStoreError, Store } from '../../postgres' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { GraphQLError } from 'graphql' import { isValidCmsDivison } from '../../domain-models' diff --git a/services/app-api/src/resolvers/questionResponse/createQuestionResponse.ts b/services/app-api/src/resolvers/questionResponse/createQuestionResponse.ts index 2d28b62fdd..8a3ffe7511 100644 --- a/services/app-api/src/resolvers/questionResponse/createQuestionResponse.ts +++ b/services/app-api/src/resolvers/questionResponse/createQuestionResponse.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from '../../gen/gqlServer' +import type { MutationResolvers } from '../../gen/gqlServer' import { isStateUser } from '../../domain-models' import { logError, logSuccess } from '../../logger' import { @@ -6,7 +6,8 @@ import { setSuccessAttributesOnActiveSpan, } from '../attributeHelper' import { ForbiddenError, UserInputError } from 'apollo-server-lambda' -import { isStoreError, Store } from '../../postgres' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' export function createQuestionResponseResolver( store: Store diff --git a/services/app-api/src/resolvers/questionResponse/indexQuestions.ts b/services/app-api/src/resolvers/questionResponse/indexQuestions.ts index 76dee2789f..8fbb2c1474 100644 --- a/services/app-api/src/resolvers/questionResponse/indexQuestions.ts +++ b/services/app-api/src/resolvers/questionResponse/indexQuestions.ts @@ -1,6 +1,7 @@ import { isStateUser } from '../../domain-models' -import { QueryResolvers } from '../../gen/gqlServer' -import { isStoreError, Store } from '../../postgres' +import type { QueryResolvers } from '../../gen/gqlServer' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { logError } from '../../logger' import { setErrorAttributesOnActiveSpan } from '../attributeHelper' import { ForbiddenError, UserInputError } from 'apollo-server-lambda' diff --git a/services/app-api/src/resolvers/user/fetchCurrentUser.test.ts b/services/app-api/src/resolvers/user/fetchCurrentUser.test.ts index 47530467d3..f93bc1ec7e 100644 --- a/services/app-api/src/resolvers/user/fetchCurrentUser.test.ts +++ b/services/app-api/src/resolvers/user/fetchCurrentUser.test.ts @@ -1,4 +1,4 @@ -import { Context } from '../../handlers/apollo_gql' +import type { Context } from '../../handlers/apollo_gql' import { constructTestPostgresServer } from '../../testHelpers/gqlHelpers' import FETCH_CURRENT_USER from '../../../../app-graphql/src/queries/fetchCurrentUser.graphql' diff --git a/services/app-api/src/resolvers/user/fetchCurrentUser.ts b/services/app-api/src/resolvers/user/fetchCurrentUser.ts index 7a89d4d419..c0500cddf2 100644 --- a/services/app-api/src/resolvers/user/fetchCurrentUser.ts +++ b/services/app-api/src/resolvers/user/fetchCurrentUser.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from '../../gen/gqlServer' +import type { QueryResolvers } from '../../gen/gqlServer' import { logSuccess } from '../../logger' import { setResolverDetailsOnActiveSpan, diff --git a/services/app-api/src/resolvers/user/indexUsers.test.ts b/services/app-api/src/resolvers/user/indexUsers.test.ts index e6ddf8d88b..04738814fb 100644 --- a/services/app-api/src/resolvers/user/indexUsers.test.ts +++ b/services/app-api/src/resolvers/user/indexUsers.test.ts @@ -1,13 +1,10 @@ -import { - InsertUserArgsType, - isStoreError, - NewPostgresStore, -} from '../../postgres' +import type { InsertUserArgsType } from '../../postgres' +import { isStoreError, NewPostgresStore } from '../../postgres' import INDEX_USERS from '../../../../app-graphql/src/queries/indexUsers.graphql' import { v4 as uuidv4 } from 'uuid' import { constructTestPostgresServer } from '../../testHelpers/gqlHelpers' import { sharedTestPrismaClient } from '../../testHelpers/storeHelpers' -import { UserEdge, User } from '../../gen/gqlServer' +import type { UserEdge, User } from '../../gen/gqlServer' import { assertAnError } from '../../testHelpers' import { testAdminUser, testCMSUser } from '../../testHelpers/userHelpers' diff --git a/services/app-api/src/resolvers/user/indexUsers.ts b/services/app-api/src/resolvers/user/indexUsers.ts index 4f0a21d8c6..8c03d175d0 100644 --- a/services/app-api/src/resolvers/user/indexUsers.ts +++ b/services/app-api/src/resolvers/user/indexUsers.ts @@ -1,9 +1,11 @@ import { ForbiddenError } from 'apollo-server-lambda' -import { isAdminUser, UserType } from '../../domain-models' +import type { UserType } from '../../domain-models' +import { isAdminUser } from '../../domain-models' import { isHelpdeskUser } from '../../domain-models/user' -import { QueryResolvers } from '../../gen/gqlServer' +import type { QueryResolvers } from '../../gen/gqlServer' import { logError } from '../../logger' -import { isStoreError, Store } from '../../postgres' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { setErrorAttributesOnActiveSpan, setResolverDetailsOnActiveSpan, diff --git a/services/app-api/src/resolvers/user/updateCMSUser.test.ts b/services/app-api/src/resolvers/user/updateCMSUser.test.ts index f6728ce0fb..4589357d0c 100644 --- a/services/app-api/src/resolvers/user/updateCMSUser.test.ts +++ b/services/app-api/src/resolvers/user/updateCMSUser.test.ts @@ -1,10 +1,7 @@ import { constructTestPostgresServer } from '../../testHelpers/gqlHelpers' import UPDATE_CMS_USER from '../../../../app-graphql/src/mutations/updateCMSUser.graphql' -import { - InsertUserArgsType, - isStoreError, - NewPostgresStore, -} from '../../postgres' +import type { InsertUserArgsType } from '../../postgres' +import { isStoreError, NewPostgresStore } from '../../postgres' import { v4 as uuidv4 } from 'uuid' import { sharedTestPrismaClient } from '../../testHelpers/storeHelpers' import { @@ -12,8 +9,9 @@ import { assertAnErrorCode, assertAnErrorExtensions, } from '../../testHelpers' -import { State } from '../../gen/gqlServer' -import { AuditAction, Division } from '@prisma/client' +import type { State } from '../../gen/gqlServer' +import type { Division } from '@prisma/client' +import { AuditAction } from '@prisma/client' import { testAdminUser, testCMSUser } from '../../testHelpers/userHelpers' describe('updateCMSUser', () => { diff --git a/services/app-api/src/resolvers/user/updateCMSUser.ts b/services/app-api/src/resolvers/user/updateCMSUser.ts index 23c59c977f..18697896b5 100644 --- a/services/app-api/src/resolvers/user/updateCMSUser.ts +++ b/services/app-api/src/resolvers/user/updateCMSUser.ts @@ -1,13 +1,12 @@ import { ForbiddenError, UserInputError } from 'apollo-server-lambda' import { GraphQLError } from 'graphql' import { isAdminUser, isValidCmsDivison } from '../../domain-models' -import { - isValidStateCode, - StateCodeType, -} from '../../../../app-web/src/common-code/healthPlanFormDataType' -import { MutationResolvers } from '../../gen/gqlServer' +import type { StateCodeType } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import { isValidStateCode } from '../../../../app-web/src/common-code/healthPlanFormDataType' +import type { MutationResolvers } from '../../gen/gqlServer' import { logError, logSuccess } from '../../logger' -import { isStoreError, Store } from '../../postgres' +import type { Store } from '../../postgres' +import { isStoreError } from '../../postgres' import { setErrorAttributesOnActiveSpan, setResolverDetailsOnActiveSpan, diff --git a/services/app-api/src/resolvers/user/userResolver.ts b/services/app-api/src/resolvers/user/userResolver.ts index ebd01d45dc..3ab7f310ad 100644 --- a/services/app-api/src/resolvers/user/userResolver.ts +++ b/services/app-api/src/resolvers/user/userResolver.ts @@ -1,4 +1,4 @@ -import { Resolvers } from '../../gen/gqlServer' +import type { Resolvers } from '../../gen/gqlServer' import statePrograms from '../../../../app-web/src/common-code/data/statePrograms.json' export const stateUserResolver: Resolvers['StateUser'] = { diff --git a/services/app-api/src/secrets/index.ts b/services/app-api/src/secrets/index.ts index 2cb02397e7..5533a5cb9d 100644 --- a/services/app-api/src/secrets/index.ts +++ b/services/app-api/src/secrets/index.ts @@ -1 +1,2 @@ -export { APISecrets, FetchSecrets, getConnectionURL } from './secrets' +export type { APISecrets } from './secrets' +export { FetchSecrets, getConnectionURL } from './secrets' diff --git a/services/app-api/src/secrets/secrets.ts b/services/app-api/src/secrets/secrets.ts index 82233df2b2..b0bd5ca406 100644 --- a/services/app-api/src/secrets/secrets.ts +++ b/services/app-api/src/secrets/secrets.ts @@ -2,7 +2,7 @@ import { SecretsManagerClient, GetSecretValueCommand, } from '@aws-sdk/client-secrets-manager' -import { GetSecretValueResponse } from 'aws-sdk/clients/secretsmanager' +import type { GetSecretValueResponse } from 'aws-sdk/clients/secretsmanager' interface APISecrets { pgConnectionURL: string @@ -70,4 +70,5 @@ function getConnectionURL(secrets: Secret): string { return postgresURL } -export { APISecrets, FetchSecrets, getConnectionURL } +export type { APISecrets } +export { FetchSecrets, getConnectionURL } diff --git a/services/app-api/src/testHelpers/awsSESHelpers.ts b/services/app-api/src/testHelpers/awsSESHelpers.ts index a3b56e56d2..42950836e0 100644 --- a/services/app-api/src/testHelpers/awsSESHelpers.ts +++ b/services/app-api/src/testHelpers/awsSESHelpers.ts @@ -1,5 +1,5 @@ -import { EmailData } from '../emailer' -import { SESServiceException } from '@aws-sdk/client-ses' +import type { EmailData } from '../emailer' +import type { SESServiceException } from '@aws-sdk/client-ses' async function testSendSESEmail( emailData: EmailData diff --git a/services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts b/services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts index 9df571eba7..1afc83af8b 100644 --- a/services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts +++ b/services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts @@ -1,9 +1,9 @@ -import { InsertContractArgsType } from '../../postgres/contractAndRates/insertContract' -import { State } from '@prisma/client' +import type { InsertContractArgsType } from '../../postgres/contractAndRates/insertContract' +import type { State } from '@prisma/client' import { must } from '../errorHelpers' -import { PrismaClient } from '@prisma/client' +import type { PrismaClient } from '@prisma/client' import { v4 as uuidv4 } from 'uuid' -import { +import type { ContractRevisionTableWithRates, ContractTableFullPayload, } from '../../postgres/contractAndRates/prismaSubmittedContractHelpers' diff --git a/services/app-api/src/testHelpers/emailerHelpers.ts b/services/app-api/src/testHelpers/emailerHelpers.ts index c6d152edb6..53da22a74c 100644 --- a/services/app-api/src/testHelpers/emailerHelpers.ts +++ b/services/app-api/src/testHelpers/emailerHelpers.ts @@ -1,7 +1,5 @@ +import type { EmailConfiguration, EmailData, Emailer } from '../emailer' import { - EmailConfiguration, - EmailData, - Emailer, newPackageCMSEmail, newPackageStateEmail, unlockPackageCMSEmail, @@ -9,12 +7,12 @@ import { resubmitPackageStateEmail, resubmitPackageCMSEmail, } from '../emailer' -import { +import type { LockedHealthPlanFormDataType, ProgramArgType, UnlockedHealthPlanFormDataType, } from '../../../app-web/src/common-code/healthPlanFormDataType' -import { StateUserType } from '../domain-models' +import type { StateUserType } from '../domain-models' import { SESServiceException } from '@aws-sdk/client-ses' import { testSendSESEmail } from './awsSESHelpers' diff --git a/services/app-api/src/testHelpers/errorHelpers.ts b/services/app-api/src/testHelpers/errorHelpers.ts index 505d93ac1a..e35a75b04f 100644 --- a/services/app-api/src/testHelpers/errorHelpers.ts +++ b/services/app-api/src/testHelpers/errorHelpers.ts @@ -1,5 +1,6 @@ // For use in TESTS only. Throws a returned error -import { isStoreError, StoreError } from '../postgres' +import type { StoreError } from '../postgres' +import { isStoreError } from '../postgres' function must(maybeErr: T | Error | StoreError): T { if (maybeErr instanceof Error) { diff --git a/services/app-api/src/testHelpers/gqlAssertions.ts b/services/app-api/src/testHelpers/gqlAssertions.ts index 5df1e3beaf..1fdeaabb34 100644 --- a/services/app-api/src/testHelpers/gqlAssertions.ts +++ b/services/app-api/src/testHelpers/gqlAssertions.ts @@ -1,5 +1,5 @@ -import { GraphQLResponse } from 'apollo-server-types' -import { GraphQLFormattedError } from 'graphql' +import type { GraphQLResponse } from 'apollo-server-types' +import type { GraphQLFormattedError } from 'graphql' // assertAnError returns an the only error in a graphQL errors response function assertAnError(res: GraphQLResponse): GraphQLFormattedError { diff --git a/services/app-api/src/testHelpers/gqlHelpers.ts b/services/app-api/src/testHelpers/gqlHelpers.ts index aaaefe5c61..6e02220792 100644 --- a/services/app-api/src/testHelpers/gqlHelpers.ts +++ b/services/app-api/src/testHelpers/gqlHelpers.ts @@ -8,37 +8,37 @@ import CREATE_QUESTION from 'app-graphql/src/mutations/createQuestion.graphql' import INDEX_QUESTIONS from 'app-graphql/src/queries/indexQuestions.graphql' import CREATE_QUESTION_RESPONSE from 'app-graphql/src/mutations/createQuestionResponse.graphql' import typeDefs from 'app-graphql/src/schema.graphql' -import { +import type { HealthPlanFormDataType, UnlockedHealthPlanFormDataType, StateCodeType, } from 'app-web/src/common-code/healthPlanFormDataType' -import { +import type { CreateQuestionInput, InsertQuestionResponseArgs, ProgramType, } from '../domain-models' -import { Emailer, newLocalEmailer } from '../emailer' -import { +import type { Emailer } from '../emailer' +import { newLocalEmailer } from '../emailer' +import type { CreateHealthPlanPackageInput, HealthPlanPackage, CreateQuestionResponsePayload, CreateQuestionPayload, IndexQuestionsPayload, } from '../gen/gqlServer' -import { Context } from '../handlers/apollo_gql' -import { NewPostgresStore, Store } from '../postgres' +import type { Context } from '../handlers/apollo_gql' +import type { Store } from '../postgres' +import { NewPostgresStore } from '../postgres' import { configureResolvers } from '../resolvers' import { latestFormData } from './healthPlanPackageHelpers' import { sharedTestPrismaClient } from './storeHelpers' import { domainToBase64 } from 'app-web/src/common-code/proto/healthPlanFormDataProto' -import { - newLocalEmailParameterStore, - EmailParameterStore, -} from '../parameterStore' +import type { EmailParameterStore } from '../parameterStore' +import { newLocalEmailParameterStore } from '../parameterStore' import statePrograms from 'app-web/src/common-code/data/statePrograms.json' import { testLDService } from './launchDarklyHelpers' -import { LDService } from '../launchDarkly/launchDarkly' +import type { LDService } from '../launchDarkly/launchDarkly' import { insertUserToLocalAurora } from '../authn' import { testStateUser } from './userHelpers' diff --git a/services/app-api/src/testHelpers/healthPlanPackageHelpers.ts b/services/app-api/src/testHelpers/healthPlanPackageHelpers.ts index f095dcd326..98a6476b38 100644 --- a/services/app-api/src/testHelpers/healthPlanPackageHelpers.ts +++ b/services/app-api/src/testHelpers/healthPlanPackageHelpers.ts @@ -1,6 +1,6 @@ -import { HealthPlanFormDataType } from '../../../app-web/src/common-code/healthPlanFormDataType' +import type { HealthPlanFormDataType } from '../../../app-web/src/common-code/healthPlanFormDataType' import { base64ToDomain } from '../../../app-web/src/common-code/proto/healthPlanFormDataProto' -import { HealthPlanPackage } from '../gen/gqlServer' +import type { HealthPlanPackage } from '../gen/gqlServer' // returns the latest form data for this package, will throw an error if unwrapping fails // hence, this function is meant for making clean tests, not for business logic. diff --git a/services/app-api/src/testHelpers/launchDarklyHelpers.ts b/services/app-api/src/testHelpers/launchDarklyHelpers.ts index 2d7b4d497f..8332be0d91 100644 --- a/services/app-api/src/testHelpers/launchDarklyHelpers.ts +++ b/services/app-api/src/testHelpers/launchDarklyHelpers.ts @@ -1,5 +1,5 @@ -import { LDService } from '../launchDarkly/launchDarkly' -import { +import type { LDService } from '../launchDarkly/launchDarkly' +import type { FeatureFlagLDConstant, FeatureFlagSettings, } from 'app-web/src/common-code/featureFlags' diff --git a/services/app-api/src/testHelpers/parameterStoreHelpers.ts b/services/app-api/src/testHelpers/parameterStoreHelpers.ts index abf01ce1ed..62c7b71694 100644 --- a/services/app-api/src/testHelpers/parameterStoreHelpers.ts +++ b/services/app-api/src/testHelpers/parameterStoreHelpers.ts @@ -1,4 +1,4 @@ -import { EmailParameterStore } from '../parameterStore' +import type { EmailParameterStore } from '../parameterStore' function mockEmailParameterStoreError(error?: string): EmailParameterStore { const message = error || 'No store found' diff --git a/services/app-api/src/testHelpers/storeHelpers.ts b/services/app-api/src/testHelpers/storeHelpers.ts index 9d2d890a7b..38dd6a67fa 100644 --- a/services/app-api/src/testHelpers/storeHelpers.ts +++ b/services/app-api/src/testHelpers/storeHelpers.ts @@ -1,5 +1,6 @@ -import { PrismaClient } from '@prisma/client' -import { NewPrismaClient, Store, StoreError } from '../postgres' +import type { PrismaClient } from '@prisma/client' +import type { Store, StoreError } from '../postgres' +import { NewPrismaClient } from '../postgres' async function configurePrismaClient(): Promise { const dbURL = process.env.DATABASE_URL diff --git a/services/app-api/src/testHelpers/userHelpers.ts b/services/app-api/src/testHelpers/userHelpers.ts index 7b2fd8d295..c523d749b4 100644 --- a/services/app-api/src/testHelpers/userHelpers.ts +++ b/services/app-api/src/testHelpers/userHelpers.ts @@ -1,5 +1,6 @@ -import { InsertUserArgsType, isStoreError, NewPostgresStore } from '../postgres' -import { +import type { InsertUserArgsType } from '../postgres' +import { isStoreError, NewPostgresStore } from '../postgres' +import type { AdminUserType, CMSUserType, StateUserType, diff --git a/yarn.lock b/yarn.lock index f3433cd5aa..57ad45a87b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21990,11 +21990,11 @@ graphql-request@^5.0.0: form-data "^3.0.0" graphql-scalars@^1.11.1: - version "1.20.4" - resolved "https://registry.yarnpkg.com/graphql-scalars/-/graphql-scalars-1.20.4.tgz#733177919fb0d4f490b4fdba34577038a0155fd3" - integrity sha512-/hDzWcphV/aV4MEx2pqVMMekBLi9VXYD/HrJSclpOCLkSB/dE3Rb5VVZBXsQhgBxqeCsE7K0PEO2/cWAUzQsrQ== + version "1.22.2" + resolved "https://registry.yarnpkg.com/graphql-scalars/-/graphql-scalars-1.22.2.tgz#6326e6fe2d0ad4228a9fea72a977e2bf26b86362" + integrity sha512-my9FB4GtghqXqi/lWSVAOPiTzTnnEzdOXCsAC2bb5V7EFNQjVjwy3cSSbUvgYOtDuDibd+ZsCDhz+4eykYOlhQ== dependencies: - tslib "~2.5.0" + tslib "^2.5.0" graphql-tag@^2.10.1, graphql-tag@^2.11.0, graphql-tag@^2.12.5, graphql-tag@^2.12.6: version "2.12.6"