-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
291 lines (240 loc) · 9.07 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
import { Request as ExpressRequest, ParamsDictionary } from "express-serve-static-core"
export type JSONScalar = string | number | boolean | null | undefined;
export type JSONArray = JSONValue[];
export type JSONObject = { [ key: string ]: JSONValue };
export type JSONValue = JSONScalar | JSONArray | JSONObject;
declare namespace app {
/**
* Represents the result of parsing the Parameters resource passed to the
* $bulk-match operation
*/
interface MatchOperationParams {
resource: fhir4.ParametersParameter[]
onlySingleMatch: boolean
onlyCertainMatches: boolean
count: number
_outputFormat: string
}
interface MatchOperationOptions {
/**
* Would be good if the failed matches are the same in repeated requests
* - maybe sort the resource ids and take from the top when deciding
* which ones to fail?
*/
reflect?: {
/**
* Reflect annotated version of request back (test mode)
*/
enabled: boolean
/**
* Select % matches fail in server settings
*/
percentMatch?: number
/**
* Select % matches that have multiple results ({last name}_1,
* {last_name}_2) in server settings
*/
percentMulti?: number
}
/**
* Proxy match requests to a FHIR server supporting single patient
* match.
*/
matchServer?: string
}
interface MatchManifest {
/**
* FHIR instant
* Indicates the server's time when the query is run. The response
* SHOULD NOT include any resources modified after this instant, and
* SHALL include any matching resources modified up to and including
* this instant.
*
* Note: To properly meet these constraints, a FHIR server might need to
* wait for any pending transactions to resolve in its database before
* starting the export process.
*/
transactionTime: string
/**
* The full URL of the original Bulk Match kick-off request. This URL
* will not include the request parameters and may be removed in a
* future version of this IG.
*/
request: string
/**
* Indicates whether downloading the generated files requires the same
* authorization mechanism as the $bulk-match operation itself.
*
* Value SHALL be true if both the file server and the FHIR API server
* control access using OAuth 2.0 bearer tokens. Value MAY be false for
* file servers that use access-control schemes other than OAuth 2.0,
* such as downloads from Amazon S3 bucket URLs or verifiable file
* servers within an organization's firewall.
*/
requiresAccessToken: boolean
/**
* An array of file items with one entry for each generated file. If no
* resources are returned, the server SHOULD return an empty array.
*/
output: MatchManifestOutputEntry[]
/**
* Empty array. To align with the single patient match operation, error,
* warning, and information messages related to matches SHOULD be
* included in the match bundles in files in the output array.
*/
error: []
/**
* To support extensions, this implementation guide reserves the name
* extension and will never define a field with that name, allowing
* server implementations to use it to provide custom behavior and
* information. For example, a server may choose to provide a custom
* extension that contains a decryption key for encrypted ndjson files.
* The value of an extension element SHALL be a pre-coordinated JSON
* object.
*
* Note: In addition to extensions being supported on the root object
* level, extensions may also be included within the fields above (e.g.,
* in the 'output' object).
*/
extension?: JSONObject
}
interface MatchManifestOutputEntry {
/**
* Fixed value of "Bundle"
*/
type: "Bundle"
/**
* The absolute path to the file. The format of the file SHOULD reflect
* that requested in the _outputFormat parameter of the initial kick-off
* request.
*/
url: string
/**
* The number of resources in the file, represented as a JSON number.
*
* The number of FHIR searchset Bundle resources per file MAY vary
* between servers.
*/
count?: number
}
type OAuthErrorType =
/**
* The request is missing a required parameter, includes an unsupported
* parameter value (other than grant type), repeats a parameter,
* includes multiple credentials, utilizes more than one mechanism for
* authenticating the client, or is otherwise malformed.
*/
"invalid_request" |
/**
* Client authentication failed (e.g., unknown client, no client
* authentication included, or unsupported authentication method). The
* authorization server MAY return an HTTP 401 (Unauthorized) status
* code to indicate which HTTP authentication schemes are supported. If
* the client attempted to authenticate via the "Authorization" request
* header field, the authorization server MUST respond with an HTTP 401
* (Unauthorized) status code and include the "WWW-Authenticate"
* response header field matching the authentication scheme used by the
* client.
*/
"invalid_client" |
/**
* The provided authorization grant (e.g., authorization code, resource
* owner credentials) or refresh token is invalid, expired, revoked,
* does not match the redirection URI used in the authorization request,
* or was issued to another client.
*/
"invalid_grant" |
/**
* The authenticated client is not authorized to use this authorization
* grant type.
*/
"unauthorized_client" |
/**
* The authorization grant type is not supported by the authorization
* server.
*/
"unsupported_grant_type" |
/**
* The requested scope is invalid, unknown, malformed, or exceeds the
* scope granted by the resource owner.
*/
"invalid_scope";
interface AccessTokenResponse {
/** Fixed value "bearer" */
token_type: "bearer",
/** Granted scopes */
scope: string
/** Signed client JWT */
client_id: string
/** Number of seconds for the access token lifetime */
expires_in: number
/** The access token given to the client */
access_token: string
}
interface AccessToken {
/** Fixed value "bearer" */
token_type: "bearer"
/** Granted scopes */
scope: string
/** Signed client JWT */
client_id: string
/** Number of seconds for the access token lifetime */
expires_in: number
/** Access token issuedAt timestamp in seconds */
iat: number
/** Access token expiresAt timestamp in seconds */
exp: number
}
interface RegisteredClient {
/**
* A JWKS object with one or more JWK public keys, if the client was
* registered that way
*/
jwks?: { keys: JsonWebKey[] }
/**
* An URL to JWKS file, if the client was registered that way
*/
jwks_url?: string
/**
* Simulated error chosen at registration time
*/
err?: "expired_registration_token" |
"invalid_scope" |
"invalid_client" |
"invalid_access_token" |
"expired_access_token" |
"too_many_patient_params" |
"too_frequent_status_requests" |
"file_not_found" |
"unauthorized_client" |
"transient_status_error"
/**
* Percent of fake matches
*/
fakeMatches?: number
/**
* Percent of fake duplicates
*/
duplicates?: number,
/** Client issuedAt timestamp in seconds */
iat: number
/** Base URL of a FHIR server to use for $match */
matchServer?: string
proxyClientId?: string,
proxyJWK?: JSONObject | null
proxyScope?: string
}
interface InputPatient extends fhir4.Patient {
id: string
}
interface Request<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, any>
> extends ExpressRequest<P, ResBody, ReqBody, ReqQuery, Locals> {
registeredClient?: RegisteredClient
}
}
export = app;