Skip to content

Commit

Permalink
complete rewrite to support orchestration (#27)
Browse files Browse the repository at this point in the history
* moved abort controller

* did a little more than move an abort controller

* add codegen files to prettier ignore

* bundle and package

* fixed .env.example
  • Loading branch information
bejoinka authored Aug 2, 2024
1 parent c7803ef commit 17eed63
Show file tree
Hide file tree
Showing 50 changed files with 14,590 additions and 28,059 deletions.
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
INPUT_API_KEY="*****"
INPUT_CAREFLOW_ID=xjUdrKvscUmq
INPUT_API_KEY=*****
INPUT_AWELL_ENVIRONMENT=development
INPUT_CAREFLOW_ID=xjUdrKvscUmq
INPUT_E2E=false
INPUT_FILENAME=example-careflow-validation.yaml
INPUT_TIMEOUT_MS="30000"
INPUT_TIMEOUT_MS=30000
1 change: 1 addition & 0 deletions .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ignorePatterns:
- '**/dist/.*'
- '**/coverage/.*'
- '*.json'
- 'src/gql/*-types.ts'

parser: '@typescript-eslint/parser'

Expand Down
1 change: 1 addition & 0 deletions .jest/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { config } from 'dotenv'

Check warning on line 1 in .jest/setup.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

File ignored by default.
config()
process.env.INPUT_AWELL_ENVIRONMENT = 'development'
process.env.INPUT_E2E = 'false'
import '../src/environment'
const setup = async () => {
process.env.GITHUB_REPOSITORY = 'awell-health/example-source-control'
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
node_modules/
coverage/
src/gql/*-types.ts
7 changes: 4 additions & 3 deletions __mocks__/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {
CreatePathwayCaseMutation,
PathwayCasesQuery,
type getSdk
} from 'src/gql/types'
} from '../src/gql/design-types'

const mockedSDK = (signal?: AbortSignal) =>
const mockedSDK = (controller: AbortController) =>
({
CreatePathwayCase(): Promise<CreatePathwayCaseMutation> {
return Promise.resolve(createPathwayCaseMutation)
Expand Down Expand Up @@ -38,7 +38,8 @@ const mockedSDK = (signal?: AbortSignal) =>
}
}) as unknown as ReturnType<typeof getSdk>

export const mockedGetClient = (signal?: AbortSignal) => mockedSDK(signal)
export const mockedGetClient = (controller: AbortController) =>
mockedSDK(controller)

const createPathwayCaseMutation: CreatePathwayCaseMutation = {
createPathwayCase: {
Expand Down
21 changes: 0 additions & 21 deletions __tests__/cases.test.ts

This file was deleted.

3 changes: 1 addition & 2 deletions __tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import {
toActivityObjectType,
toActivityType
} from '../src/config'
import { ActivityObjectType } from '../src/gql/types'
import { ActivityObjectType } from '../src/gql/orchestration-types'

describe('config', () => {
const config = parseConfig('example-careflow-validation.yaml')
const case1 = config.cases[0]

it('should log a message', async () => {
expect(config.cases.length).toBe(1)
})
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 24 additions & 9 deletions codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,31 @@ import type { CodegenConfig } from '@graphql-codegen/cli'

const config: CodegenConfig = {
overwrite: true,
schema: {
'https://api.development.awellhealth.com/design/m2m/graphql': {
headers: {
apikey: process.env.INPUT_API_KEY ?? ''
}
}
},
documents: 'src/**/*.graphql',
generates: {
'src/gql/types.ts': {
'src/gql/design-types.ts': {
schema: {
'https://api.development.awellhealth.com/design/m2m/graphql': {
headers: {
apikey: process.env.INPUT_API_KEY ?? ''
}
}
},
documents: 'src/gql/design/*.graphql',
plugins: [
'typescript',
'typescript-operations',
'typescript-graphql-request'
]
},
'src/gql/orchestration-types.ts': {
schema: {
'https://api.development.awellhealth.com/orchestration/m2m/graphql': {
headers: {
apikey: process.env.INPUT_API_KEY ?? ''
}
}
},
documents: 'src/gql/orchestration/*.graphql',
plugins: [
'typescript',
'typescript-operations',
Expand Down
Loading

0 comments on commit 17eed63

Please sign in to comment.