Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fhir-router/graphql): fix #4567 configurable system setting for graphql max depth #4644

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
extend FhirRequest to enable per-project system configuration on grap…
…hql max depth
  • Loading branch information
dillonstreator committed Jun 10, 2024
commit 1a797b598a07c6c2124d2e067f08c78c5bc634ff
17 changes: 17 additions & 0 deletions packages/fhir-router/src/fhirrouter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('FHIR Router', () => {
},
params: {},
query: {},
config: {},
};
const [outcome, bundle] = (await router.handleRequest(request, repo)) as [OperationOutcome, Bundle];
expect(outcome).toMatchObject(allOk);
Expand All @@ -62,6 +63,7 @@ describe('FHIR Router', () => {
body: { resourceType: 'Patient' },
params: {},
query: {},
config: {},
};
const [outcome] = await router.handleRequest(request, repo);
expect(outcome).toMatchObject(badRequest('Not a bundle'));
Expand All @@ -78,6 +80,7 @@ describe('FHIR Router', () => {
},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -91,6 +94,7 @@ describe('FHIR Router', () => {
body: {},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -104,6 +108,7 @@ describe('FHIR Router', () => {
body: {},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -119,6 +124,7 @@ describe('FHIR Router', () => {
body: {},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -132,6 +138,7 @@ describe('FHIR Router', () => {
body: {},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -150,6 +157,7 @@ describe('FHIR Router', () => {
},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -167,6 +175,7 @@ describe('FHIR Router', () => {
},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -184,6 +193,7 @@ describe('FHIR Router', () => {
},
params: {},
query: {},
config: {},
headers: { 'if-match': 'W/"test"' },
},
repo
Expand All @@ -201,6 +211,7 @@ describe('FHIR Router', () => {
},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -218,6 +229,7 @@ describe('FHIR Router', () => {
query: {
_type: 'Patient,Observation',
},
config: {},
},
repo
);
Expand All @@ -240,6 +252,7 @@ describe('FHIR Router', () => {
query: {
identifier: 'http:https://example.com/mrn|' + mrn,
},
config: {},
},
repo
);
Expand All @@ -258,6 +271,7 @@ describe('FHIR Router', () => {
},
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -271,6 +285,7 @@ describe('FHIR Router', () => {
body: [{ op: 'add', path: '/active', value: true }],
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -285,6 +300,7 @@ describe('FHIR Router', () => {
body: null,
params: {},
query: {},
config: {},
},
repo
);
Expand All @@ -298,6 +314,7 @@ describe('FHIR Router', () => {
body: { foo: 'bar' },
params: {},
query: {},
config: {},
},
repo
);
Expand Down
4 changes: 3 additions & 1 deletion packages/fhir-router/src/fhirrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export type FhirRequest = {
params: Record<string, string>;
query: Record<string, string>;
headers?: IncomingHttpHeaders;
config: {
graphqlMaxDepth?: number;
};
};

export type FhirResponse = [OperationOutcome] | [OperationOutcome, Resource];
Expand All @@ -30,7 +33,6 @@ export type FhirRouteHandler = (req: FhirRequest, repo: FhirRepository, router:

export interface FhirOptions {
introspectionEnabled?: boolean;
graphqlMaxDepth?: number;
}

// Execute batch
Expand Down
Loading
Loading