@medplum/fhir-router 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/cjs/batch.d.ts +14 -0
- package/dist/cjs/fhirrouter.d.ts +17 -0
- package/dist/cjs/graphql.d.ts +10 -0
- package/dist/cjs/index.cjs +14125 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.min.cjs +2 -0
- package/dist/cjs/index.min.cjs.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/repo.d.ts +116 -0
- package/dist/cjs/urlrouter.d.ts +19 -0
- package/dist/esm/batch.d.ts +14 -0
- package/dist/esm/fhirrouter.d.ts +17 -0
- package/dist/esm/graphql.d.ts +10 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.min.mjs +2 -0
- package/dist/esm/index.min.mjs.map +1 -0
- package/dist/esm/index.mjs +14119 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/repo.d.ts +116 -0
- package/dist/esm/urlrouter.d.ts +19 -0
- package/dist/types/batch.d.ts +14 -0
- package/dist/types/fhirrouter.d.ts +17 -0
- package/dist/types/graphql.d.ts +10 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/repo.d.ts +116 -0
- package/dist/types/urlrouter.d.ts +19 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Medplum FHIR Router
|
|
2
|
+
|
|
3
|
+
Provides a FHIR URL router. Standard CRUD operations map to a standard `FhirRepository` interface. FHIR operations registered separately.
|
|
4
|
+
|
|
5
|
+
## About Medplum
|
|
6
|
+
|
|
7
|
+
Medplum is a healthcare platform that helps you quickly develop high-quality compliant applications. Medplum includes a FHIR server, React component library, and developer app.
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
|
|
11
|
+
Apache 2.0. Copyright © Medplum 2023
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Bundle } from '@medplum/fhirtypes';
|
|
2
|
+
import { FhirRouter } from './fhirrouter';
|
|
3
|
+
import { FhirRepository } from './repo';
|
|
4
|
+
/**
|
|
5
|
+
* Processes a FHIR batch request.
|
|
6
|
+
*
|
|
7
|
+
* See: https://www.hl7.org/fhir/http.html#transaction
|
|
8
|
+
*
|
|
9
|
+
* @param router The FHIR router.
|
|
10
|
+
* @param repo The FHIR repository.
|
|
11
|
+
* @param bundle The input bundle.
|
|
12
|
+
* @returns The bundle response.
|
|
13
|
+
*/
|
|
14
|
+
export declare function processBatch(router: FhirRouter, repo: FhirRepository, bundle: Bundle): Promise<Bundle>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OperationOutcome, Resource } from '@medplum/fhirtypes';
|
|
2
|
+
import { FhirRepository } from './repo';
|
|
3
|
+
import { HttpMethod, Router } from './urlrouter';
|
|
4
|
+
export type FhirRequest = {
|
|
5
|
+
method: HttpMethod;
|
|
6
|
+
pathname: string;
|
|
7
|
+
body: any;
|
|
8
|
+
params: Record<string, string>;
|
|
9
|
+
query: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
export type FhirResponse = [OperationOutcome] | [OperationOutcome, Resource];
|
|
12
|
+
export type FhirRouteHandler = (req: FhirRequest, repo: FhirRepository, router: FhirRouter) => Promise<FhirResponse>;
|
|
13
|
+
export declare class FhirRouter {
|
|
14
|
+
readonly router: Router<FhirRouteHandler>;
|
|
15
|
+
constructor();
|
|
16
|
+
handleRequest(req: FhirRequest, repo: FhirRepository): Promise<FhirResponse>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { FhirRequest, FhirResponse } from './fhirrouter';
|
|
3
|
+
import { FhirRepository } from './repo';
|
|
4
|
+
/**
|
|
5
|
+
* Handles FHIR GraphQL requests.
|
|
6
|
+
*
|
|
7
|
+
* See: https://www.hl7.org/fhir/graphql.html
|
|
8
|
+
*/
|
|
9
|
+
export declare function graphqlHandler(req: FhirRequest, repo: FhirRepository): Promise<FhirResponse>;
|
|
10
|
+
export declare function getRootSchema(): GraphQLSchema;
|