@esushealth/sdk 0.0.0-stage → 1.0.0

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.
@@ -0,0 +1,1310 @@
1
+ export { diagnoseCapabilities, integrationCapabilities, type CapabilityCheck, type IntegrationCapability } from "./diagnostics.js";
2
+ import { type FhirResourceType, type SmartFhirOperation } from "./fhir-contract.js";
3
+ import { fhirOperation, readFhir, writeFhir } from "./fhir.js";
4
+ import { type RequestOptions, type Transport, type TransportOptions } from "./transport.js";
5
+ export { createAppSessionClient, type AppInvitation, type AppPasskey, type AppSession, type AppSessionDevice, type AppUser, type MfaChallenge } from "./app-session.js";
6
+ export { EsusError, type OperationOutcome, type RequestOptions } from "./transport.js";
7
+ export { createSmartAuthorization, exchangeSmartCode, type SmartTransaction } from "./smart.js";
8
+ export { verifyWebhook, type WebhookEvent } from "./webhooks.js";
9
+ export { createPublicClient } from "./public.js";
10
+ export type { WebhookDelivery, WebhookSubscription } from "./webhook-management.js";
11
+ export type { UploadedFile } from "./files.js";
12
+ export type { TenantApp, TenantAppRole, TenantAppUser } from "./tenant-apps.js";
13
+ export type { OrganizationAuditEvent, OrganizationEmailLogEntry, RegisteredSmartApp } from "./organization.js";
14
+ export { patientPortalResources, tenantWebhookEvents, type PatientPortalResource, type TenantWebhookEvent } from "./integration-contract.js";
15
+ export { supportsFhirLifecycle } from "./fhir.js";
16
+ export { fhirResources, type FhirCreateInputs, type FhirResourceFields, type FhirResourceType, type FhirUpdateInputs, type ResourceSearchFields } from "./fhir-contract.js";
17
+ export { fhirOperations, smartFhirOperations, type FhirOperation, type FhirOperationInputs, type FhirOperationResults, type SmartFhirOperation } from "./fhir-contract.js";
18
+ export type { PatientInput } from "./patient-contract.js";
19
+ export type { FhirResource, FhirSearchFilters, JsonPatchOperation, Patient, PatientFilters, PatientUpdateInput, } from "./fhir.js";
20
+ declare const resourceActions: readonly ["read", "create", "update", "delete"];
21
+ export type FhirAction = (typeof resourceActions)[number];
22
+ export type PatientAction = FhirAction;
23
+ export type ConnectionOptions = RequestOptions & Readonly<{
24
+ resources?: readonly FhirResourceType[];
25
+ }>;
26
+ type ServiceOptions = TransportOptions & Readonly<{
27
+ apiKey: string;
28
+ appId?: string;
29
+ }>;
30
+ type SmartOptions = TransportOptions & Readonly<{
31
+ accessToken: string;
32
+ clientId: string;
33
+ }>;
34
+ declare function organizationConnection(request: Transport, organizationId: string, smartClientId: string | null): {
35
+ validateConnection: (options?: ConnectionOptions) => Promise<{
36
+ organizationId: string;
37
+ smartClientId: string | null;
38
+ patientActions: ("create" | "delete" | "read" | "update")[];
39
+ } | {
40
+ resourceActions: Partial<Record<"AllergyIntolerance" | "Condition" | "Consent" | "DiagnosticReport" | "DocumentReference" | "Encounter" | "Immunization" | "MedicationRequest" | "Observation" | "Account" | "ActivityDefinition" | "AdverseEvent" | "Appointment" | "AppointmentResponse" | "CarePlan" | "CareTeam" | "Claim" | "ClaimResponse" | "ClinicalImpression" | "CodeSystem" | "Communication" | "Composition" | "Coverage" | "DetectedIssue" | "Device" | "EpisodeOfCare" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "Group" | "HealthcareService" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "Invoice" | "List" | "Location" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationStatement" | "NutritionOrder" | "Organization" | "Patient" | "PlanDefinition" | "Practitioner" | "PractitionerRole" | "Procedure" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RelatedPerson" | "RiskAssessment" | "Schedule" | "ServiceRequest" | "Slot" | "Specimen" | "Task" | "ValueSet" | "VisionPrescription", ("create" | "delete" | "read" | "update")[]>>;
41
+ organizationId: string;
42
+ smartClientId: string | null;
43
+ patientActions: ("create" | "delete" | "read" | "update")[];
44
+ }>;
45
+ clinical: (path: string, { responseMode, acceptStatus, ...init }?: RequestInit & {
46
+ responseMode?: "json" | "empty" | "stream" | "binary";
47
+ acceptStatus?: number;
48
+ }) => Promise<{
49
+ body: unknown;
50
+ response: Response;
51
+ }>;
52
+ };
53
+ export declare function createServiceClient(options: ServiceOptions): {
54
+ queue: {
55
+ checkIn: (body: import("./integration-contract.js").IntegrationInputs["POST /queue/check-in"], options?: RequestOptions) => Promise<{
56
+ readonly id: string;
57
+ readonly organizationId: string;
58
+ readonly patientId: string;
59
+ readonly appointmentId: string | null;
60
+ readonly locationId: string | null;
61
+ readonly practitionerId: string | null;
62
+ readonly status: string;
63
+ readonly priority: number;
64
+ readonly queueNumber: number | null;
65
+ readonly checkedInAt: string;
66
+ readonly calledAt: string | null;
67
+ readonly startedAt: string | null;
68
+ readonly completedAt: string | null;
69
+ readonly note: string | null;
70
+ readonly createdAt: string;
71
+ readonly updatedAt: string;
72
+ }>;
73
+ waiting: (query?: import("./integration-contract.js").IntegrationQueries["GET /queue/waiting"], options?: RequestOptions) => Promise<readonly {
74
+ readonly id: string;
75
+ readonly organizationId: string;
76
+ readonly patientId: string;
77
+ readonly appointmentId: string | null;
78
+ readonly locationId: string | null;
79
+ readonly practitionerId: string | null;
80
+ readonly status: string;
81
+ readonly priority: number;
82
+ readonly queueNumber: number | null;
83
+ readonly checkedInAt: string;
84
+ readonly calledAt: string | null;
85
+ readonly startedAt: string | null;
86
+ readonly completedAt: string | null;
87
+ readonly note: string | null;
88
+ readonly createdAt: string;
89
+ readonly updatedAt: string;
90
+ }[]>;
91
+ callNext: (body?: import("./integration-contract.js").IntegrationInputs["POST /queue/call-next"], options?: RequestOptions) => Promise<{
92
+ readonly id: string;
93
+ readonly organizationId: string;
94
+ readonly patientId: string;
95
+ readonly appointmentId: string | null;
96
+ readonly locationId: string | null;
97
+ readonly practitionerId: string | null;
98
+ readonly status: string;
99
+ readonly priority: number;
100
+ readonly queueNumber: number | null;
101
+ readonly checkedInAt: string;
102
+ readonly calledAt: string | null;
103
+ readonly startedAt: string | null;
104
+ readonly completedAt: string | null;
105
+ readonly note: string | null;
106
+ readonly createdAt: string;
107
+ readonly updatedAt: string;
108
+ }>;
109
+ start: (id: string, options?: RequestOptions) => Promise<{
110
+ readonly id: string;
111
+ readonly organizationId: string;
112
+ readonly patientId: string;
113
+ readonly appointmentId: string | null;
114
+ readonly locationId: string | null;
115
+ readonly practitionerId: string | null;
116
+ readonly status: string;
117
+ readonly priority: number;
118
+ readonly queueNumber: number | null;
119
+ readonly checkedInAt: string;
120
+ readonly calledAt: string | null;
121
+ readonly startedAt: string | null;
122
+ readonly completedAt: string | null;
123
+ readonly note: string | null;
124
+ readonly createdAt: string;
125
+ readonly updatedAt: string;
126
+ }>;
127
+ complete: (id: string, options?: RequestOptions) => Promise<{
128
+ readonly id: string;
129
+ readonly organizationId: string;
130
+ readonly patientId: string;
131
+ readonly appointmentId: string | null;
132
+ readonly locationId: string | null;
133
+ readonly practitionerId: string | null;
134
+ readonly status: string;
135
+ readonly priority: number;
136
+ readonly queueNumber: number | null;
137
+ readonly checkedInAt: string;
138
+ readonly calledAt: string | null;
139
+ readonly startedAt: string | null;
140
+ readonly completedAt: string | null;
141
+ readonly note: string | null;
142
+ readonly createdAt: string;
143
+ readonly updatedAt: string;
144
+ }>;
145
+ noShow: (id: string, options?: RequestOptions) => Promise<{
146
+ readonly id: string;
147
+ readonly organizationId: string;
148
+ readonly patientId: string;
149
+ readonly appointmentId: string | null;
150
+ readonly locationId: string | null;
151
+ readonly practitionerId: string | null;
152
+ readonly status: string;
153
+ readonly priority: number;
154
+ readonly queueNumber: number | null;
155
+ readonly checkedInAt: string;
156
+ readonly calledAt: string | null;
157
+ readonly startedAt: string | null;
158
+ readonly completedAt: string | null;
159
+ readonly note: string | null;
160
+ readonly createdAt: string;
161
+ readonly updatedAt: string;
162
+ }>;
163
+ board: (query?: import("./integration-contract.js").IntegrationQueries["GET /queue/board"], options?: RequestOptions) => Promise<{
164
+ readonly waiting: ReadonlyArray<{
165
+ readonly "id": string;
166
+ readonly "organizationId": string;
167
+ readonly "patientId": string;
168
+ readonly "appointmentId": string | null;
169
+ readonly "locationId": string | null;
170
+ readonly "practitionerId": string | null;
171
+ readonly "status": string;
172
+ readonly "priority": number;
173
+ readonly "queueNumber": number | null;
174
+ readonly "checkedInAt": string;
175
+ readonly "calledAt": string | null;
176
+ readonly "startedAt": string | null;
177
+ readonly "completedAt": string | null;
178
+ readonly "note": string | null;
179
+ readonly "createdAt": string;
180
+ readonly "updatedAt": string;
181
+ }>;
182
+ readonly called: ReadonlyArray<{
183
+ readonly "id": string;
184
+ readonly "organizationId": string;
185
+ readonly "patientId": string;
186
+ readonly "appointmentId": string | null;
187
+ readonly "locationId": string | null;
188
+ readonly "practitionerId": string | null;
189
+ readonly "status": string;
190
+ readonly "priority": number;
191
+ readonly "queueNumber": number | null;
192
+ readonly "checkedInAt": string;
193
+ readonly "calledAt": string | null;
194
+ readonly "startedAt": string | null;
195
+ readonly "completedAt": string | null;
196
+ readonly "note": string | null;
197
+ readonly "createdAt": string;
198
+ readonly "updatedAt": string;
199
+ }>;
200
+ readonly inProgress: ReadonlyArray<{
201
+ readonly "id": string;
202
+ readonly "organizationId": string;
203
+ readonly "patientId": string;
204
+ readonly "appointmentId": string | null;
205
+ readonly "locationId": string | null;
206
+ readonly "practitionerId": string | null;
207
+ readonly "status": string;
208
+ readonly "priority": number;
209
+ readonly "queueNumber": number | null;
210
+ readonly "checkedInAt": string;
211
+ readonly "calledAt": string | null;
212
+ readonly "startedAt": string | null;
213
+ readonly "completedAt": string | null;
214
+ readonly "note": string | null;
215
+ readonly "createdAt": string;
216
+ readonly "updatedAt": string;
217
+ }>;
218
+ readonly completed: ReadonlyArray<{
219
+ readonly "id": string;
220
+ readonly "organizationId": string;
221
+ readonly "patientId": string;
222
+ readonly "appointmentId": string | null;
223
+ readonly "locationId": string | null;
224
+ readonly "practitionerId": string | null;
225
+ readonly "status": string;
226
+ readonly "priority": number;
227
+ readonly "queueNumber": number | null;
228
+ readonly "checkedInAt": string;
229
+ readonly "calledAt": string | null;
230
+ readonly "startedAt": string | null;
231
+ readonly "completedAt": string | null;
232
+ readonly "note": string | null;
233
+ readonly "createdAt": string;
234
+ readonly "updatedAt": string;
235
+ }>;
236
+ }>;
237
+ stats: (query?: import("./integration-contract.js").IntegrationQueries["GET /queue/stats"], options?: RequestOptions) => Promise<readonly {
238
+ readonly status: string;
239
+ readonly count: number;
240
+ readonly avgWaitMinutes: number | null;
241
+ }[]>;
242
+ };
243
+ pharmacy: {
244
+ stock: (query?: import("./integration-contract.js").IntegrationQueries["GET /pharmacy/stock"], options?: RequestOptions) => Promise<readonly {
245
+ readonly id: string;
246
+ readonly organizationId: string;
247
+ readonly medicationId: string;
248
+ readonly locationId: string;
249
+ readonly quantity: string | number;
250
+ readonly minQuantity: number | null;
251
+ readonly maxQuantity: number | null;
252
+ readonly lotNumber: string | null;
253
+ readonly expirationDate: string | null;
254
+ readonly lastRestockedAt: string | null;
255
+ readonly createdAt: string;
256
+ readonly updatedAt: string;
257
+ }[]>;
258
+ restock: (body: import("./integration-contract.js").IntegrationInputs["POST /pharmacy/restock"], options?: RequestOptions) => Promise<{
259
+ readonly id: string;
260
+ readonly organizationId: string;
261
+ readonly medicationId: string;
262
+ readonly locationId: string;
263
+ readonly quantity: string | number;
264
+ readonly minQuantity: number | null;
265
+ readonly maxQuantity: number | null;
266
+ readonly lotNumber: string | null;
267
+ readonly expirationDate: string | null;
268
+ readonly lastRestockedAt: string | null;
269
+ readonly createdAt: string;
270
+ readonly updatedAt: string;
271
+ }>;
272
+ dispense: (body: import("./integration-contract.js").IntegrationInputs["POST /pharmacy/dispense"], options?: RequestOptions) => Promise<{
273
+ readonly id: string;
274
+ readonly organizationId: string;
275
+ readonly medicationId: string;
276
+ readonly locationId: string;
277
+ readonly quantity: string | number;
278
+ readonly minQuantity: number | null;
279
+ readonly maxQuantity: number | null;
280
+ readonly lotNumber: string | null;
281
+ readonly expirationDate: string | null;
282
+ readonly lastRestockedAt: string | null;
283
+ readonly createdAt: string;
284
+ readonly updatedAt: string;
285
+ }>;
286
+ adjust: (body: import("./integration-contract.js").IntegrationInputs["POST /pharmacy/adjust"], options?: RequestOptions) => Promise<{
287
+ readonly id: string;
288
+ readonly organizationId: string;
289
+ readonly medicationId: string;
290
+ readonly locationId: string;
291
+ readonly quantity: string | number;
292
+ readonly minQuantity: number | null;
293
+ readonly maxQuantity: number | null;
294
+ readonly lotNumber: string | null;
295
+ readonly expirationDate: string | null;
296
+ readonly lastRestockedAt: string | null;
297
+ readonly createdAt: string;
298
+ readonly updatedAt: string;
299
+ }>;
300
+ lowStock: (query?: import("./integration-contract.js").IntegrationQueries["GET /pharmacy/low-stock"], options?: RequestOptions) => Promise<readonly {
301
+ readonly id: string;
302
+ readonly organizationId: string;
303
+ readonly medicationId: string;
304
+ readonly locationId: string;
305
+ readonly quantity: string | number;
306
+ readonly minQuantity: number | null;
307
+ readonly maxQuantity: number | null;
308
+ readonly lotNumber: string | null;
309
+ readonly expirationDate: string | null;
310
+ readonly lastRestockedAt: string | null;
311
+ readonly createdAt: string;
312
+ readonly updatedAt: string;
313
+ }[]>;
314
+ expiring: (query?: import("./integration-contract.js").IntegrationQueries["GET /pharmacy/expiring"], options?: RequestOptions) => Promise<readonly {
315
+ readonly id: string;
316
+ readonly organizationId: string;
317
+ readonly medicationId: string;
318
+ readonly locationId: string;
319
+ readonly quantity: string | number;
320
+ readonly minQuantity: number | null;
321
+ readonly maxQuantity: number | null;
322
+ readonly lotNumber: string | null;
323
+ readonly expirationDate: string | null;
324
+ readonly lastRestockedAt: string | null;
325
+ readonly createdAt: string;
326
+ readonly updatedAt: string;
327
+ }[]>;
328
+ };
329
+ validateConnection: (options?: ConnectionOptions) => Promise<{
330
+ organizationId: string;
331
+ smartClientId: string | null;
332
+ patientActions: ("create" | "delete" | "read" | "update")[];
333
+ } | {
334
+ resourceActions: Partial<Record<"AllergyIntolerance" | "Condition" | "Consent" | "DiagnosticReport" | "DocumentReference" | "Encounter" | "Immunization" | "MedicationRequest" | "Observation" | "Account" | "ActivityDefinition" | "AdverseEvent" | "Appointment" | "AppointmentResponse" | "CarePlan" | "CareTeam" | "Claim" | "ClaimResponse" | "ClinicalImpression" | "CodeSystem" | "Communication" | "Composition" | "Coverage" | "DetectedIssue" | "Device" | "EpisodeOfCare" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "Group" | "HealthcareService" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "Invoice" | "List" | "Location" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationStatement" | "NutritionOrder" | "Organization" | "Patient" | "PlanDefinition" | "Practitioner" | "PractitionerRole" | "Procedure" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RelatedPerson" | "RiskAssessment" | "Schedule" | "ServiceRequest" | "Slot" | "Specimen" | "Task" | "ValueSet" | "VisionPrescription", ("create" | "delete" | "read" | "update")[]>>;
335
+ organizationId: string;
336
+ smartClientId: string | null;
337
+ patientActions: ("create" | "delete" | "read" | "update")[];
338
+ }>;
339
+ fhir: {
340
+ operation: <O extends "GET /fhir/Patient/:id/$everything" | "DELETE /bulk-export/:id" | "DELETE /fhir/Practitioner/roles/:roleId" | "GET /bulk-export/:id" | "GET /bulk-export/:id/download/:type" | "GET /fhir/$export" | "GET /fhir/CodeSystem/$lookup" | "GET /fhir/Encounter/:id/$everything" | "GET /fhir/Location/:id/$hierarchy" | "GET /fhir/metadata" | "GET /fhir/Patient/$export" | "GET /fhir/Practitioner/:id/roles" | "GET /fhir/ValueSet/:id/$expand" | "POST /fhir/" | "POST /fhir/$validate" | "POST /fhir/Appointment/$book" | "POST /fhir/Encounter/:id/$discharge" | "POST /fhir/Encounter/:id/$transfer" | "POST /fhir/Encounter/$admit" | "POST /fhir/Practitioner/:id/roles">(operation: O, input: import("./fhir-contract.js").FhirOperationInputs[NoInfer<O>], options?: Readonly<{
341
+ signal?: AbortSignal;
342
+ }>) => Promise<import("./fhir-contract.js").FhirOperationResults[O]>;
343
+ create<R extends "AllergyIntolerance" | "Condition" | "Consent" | "DiagnosticReport" | "DocumentReference" | "Encounter" | "Immunization" | "MedicationRequest" | "Observation" | "Account" | "ActivityDefinition" | "AdverseEvent" | "Appointment" | "AppointmentResponse" | "CarePlan" | "CareTeam" | "Claim" | "ClaimResponse" | "ClinicalImpression" | "CodeSystem" | "Communication" | "Composition" | "Coverage" | "DetectedIssue" | "Device" | "EpisodeOfCare" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "Group" | "HealthcareService" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "Invoice" | "List" | "Location" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationStatement" | "NutritionOrder" | "Patient" | "PlanDefinition" | "Practitioner" | "PractitionerRole" | "Procedure" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RelatedPerson" | "RiskAssessment" | "Schedule" | "ServiceRequest" | "Slot" | "Specimen" | "Task" | "ValueSet" | "VisionPrescription">(resource: R, input: import("./fhir-contract.js").FhirCreateInputs[NoInfer<R>], options?: RequestOptions): Promise<import("./fhir.js").FhirResource<R>>;
344
+ update<R extends FhirResourceType>(resource: R, id: string, input: import("./fhir-contract.js").FhirUpdateInputs[NoInfer<R>], etag: string, options?: RequestOptions): Promise<import("./fhir.js").FhirResource<R>>;
345
+ patch<R extends FhirResourceType>(resource: R, id: string, input: import("./fhir-contract.js").FhirUpdateInputs[NoInfer<R>], etag: string, options?: RequestOptions): Promise<import("./fhir.js").FhirResource<R>>;
346
+ patchJson<R extends FhirResourceType>(resource: R, id: string, input: readonly import("./fhir.js").JsonPatchOperation[], etag: string, options?: RequestOptions): Promise<import("./fhir.js").FhirResource<R>>;
347
+ delete(resource: "AllergyIntolerance" | "Condition" | "Consent" | "DiagnosticReport" | "DocumentReference" | "Encounter" | "Immunization" | "MedicationRequest" | "Observation" | "Account" | "ActivityDefinition" | "AdverseEvent" | "Appointment" | "AppointmentResponse" | "CarePlan" | "CareTeam" | "Claim" | "ClaimResponse" | "ClinicalImpression" | "CodeSystem" | "Communication" | "Composition" | "Coverage" | "DetectedIssue" | "Device" | "EpisodeOfCare" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "Group" | "HealthcareService" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "Invoice" | "List" | "Location" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationStatement" | "NutritionOrder" | "Patient" | "PlanDefinition" | "Practitioner" | "PractitionerRole" | "Procedure" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RelatedPerson" | "RiskAssessment" | "Schedule" | "ServiceRequest" | "Slot" | "Specimen" | "Task" | "ValueSet" | "VisionPrescription", id: string, options?: RequestOptions): Promise<void>;
348
+ search: <R extends FhirResourceType>(resource: R, filters?: import("./fhir.js").FhirSearchFilters<NoInfer<R>>, options?: RequestOptions) => Promise<{
349
+ resources: import("./fhir.js").FhirResource<R>[];
350
+ total: number | undefined;
351
+ }>;
352
+ list(resource: "Patient", filters?: import("./fhir.js").PatientFilters, options?: RequestOptions): Promise<{
353
+ patients: import("./fhir.js").Patient[];
354
+ total: number | undefined;
355
+ }>;
356
+ read: <R extends FhirResourceType>(resource: R, id: string, options?: RequestOptions) => Promise<Readonly<{
357
+ etag: string | null;
358
+ }> & (R extends "Patient" ? {
359
+ patient: import("./fhir.js").Patient;
360
+ } : {
361
+ resource: import("./fhir.js").FhirResource<R>;
362
+ })>;
363
+ history<R extends FhirResourceType>(resource: R, id: string, page?: Readonly<{
364
+ _count?: number;
365
+ _offset?: number;
366
+ }>, options?: RequestOptions): Promise<{
367
+ entries: {
368
+ resource: import("./fhir.js").FhirResource<R>;
369
+ }[];
370
+ total: number | undefined;
371
+ }>;
372
+ readVersion<R extends FhirResourceType>(resource: R, id: string, version: string, options?: RequestOptions): Promise<{
373
+ resource: import("./fhir.js").FhirResource<R>;
374
+ etag: string | null;
375
+ }>;
376
+ };
377
+ webhooks: (appId: string) => {
378
+ list(options?: RequestOptions): Promise<import("./webhook-management.js").WebhookSubscription[]>;
379
+ get(webhookId: string, options?: RequestOptions): Promise<import("./webhook-management.js").WebhookSubscription>;
380
+ create(input: {
381
+ readonly url: string;
382
+ readonly events: ReadonlyArray<"user.created" | "user.email_verified" | "user.password_changed" | "user.password_reset" | "user.email_changed" | "user.deleted" | "user.mfa_enabled" | "user.mfa_disabled" | "user.webauthn_registered" | "user.webauthn_removed" | "user.locked" | "user.refresh_reuse" | "user.role_assigned" | "user.role_removed" | "user.deactivated" | "user.reactivated" | "user.patient_linked" | "user.patient_unlinked" | "consent.revoked" | "patient.created" | "patient.updated" | "patient.deleted" | "encounter.created" | "encounter.updated" | "encounter.deleted" | "observation.created" | "observation.updated" | "observation.deleted" | "condition.created" | "condition.updated" | "condition.deleted" | "allergy_intolerance.created" | "allergy_intolerance.updated" | "allergy_intolerance.deleted" | "procedure.created" | "procedure.updated" | "procedure.deleted" | "immunization.created" | "immunization.updated" | "immunization.deleted" | "medication_request.created" | "medication_request.updated" | "medication_request.deleted" | "diagnostic_report.created" | "diagnostic_report.updated" | "diagnostic_report.deleted" | "service_request.created" | "service_request.updated" | "service_request.deleted" | "document_reference.created" | "document_reference.updated" | "document_reference.deleted" | "appointment.created" | "appointment.updated" | "appointment.deleted">;
383
+ readonly description?: string;
384
+ readonly secret?: string;
385
+ }, options?: RequestOptions): Promise<{
386
+ readonly id: string;
387
+ readonly appId: string;
388
+ readonly url: string;
389
+ readonly events: ReadonlyArray<string>;
390
+ readonly description: string | null;
391
+ readonly active: boolean;
392
+ readonly secret?: string;
393
+ readonly createdAt: string;
394
+ readonly updatedAt: string;
395
+ }>;
396
+ update(webhookId: string, input: {
397
+ readonly url?: string;
398
+ readonly events?: ReadonlyArray<"user.created" | "user.email_verified" | "user.password_changed" | "user.password_reset" | "user.email_changed" | "user.deleted" | "user.mfa_enabled" | "user.mfa_disabled" | "user.webauthn_registered" | "user.webauthn_removed" | "user.locked" | "user.refresh_reuse" | "user.role_assigned" | "user.role_removed" | "user.deactivated" | "user.reactivated" | "user.patient_linked" | "user.patient_unlinked" | "consent.revoked" | "patient.created" | "patient.updated" | "patient.deleted" | "encounter.created" | "encounter.updated" | "encounter.deleted" | "observation.created" | "observation.updated" | "observation.deleted" | "condition.created" | "condition.updated" | "condition.deleted" | "allergy_intolerance.created" | "allergy_intolerance.updated" | "allergy_intolerance.deleted" | "procedure.created" | "procedure.updated" | "procedure.deleted" | "immunization.created" | "immunization.updated" | "immunization.deleted" | "medication_request.created" | "medication_request.updated" | "medication_request.deleted" | "diagnostic_report.created" | "diagnostic_report.updated" | "diagnostic_report.deleted" | "service_request.created" | "service_request.updated" | "service_request.deleted" | "document_reference.created" | "document_reference.updated" | "document_reference.deleted" | "appointment.created" | "appointment.updated" | "appointment.deleted">;
399
+ readonly description?: string | null;
400
+ readonly active?: boolean;
401
+ readonly rotateSecret?: boolean;
402
+ }, options?: RequestOptions): Promise<{
403
+ readonly id: string;
404
+ readonly appId: string;
405
+ readonly url: string;
406
+ readonly events: ReadonlyArray<string>;
407
+ readonly description: string | null;
408
+ readonly active: boolean;
409
+ readonly secret?: string;
410
+ readonly createdAt: string;
411
+ readonly updatedAt: string;
412
+ }>;
413
+ delete(webhookId: string, options?: RequestOptions): Promise<void>;
414
+ ping(webhookId: string, options?: RequestOptions): Promise<{
415
+ deliveryId: string;
416
+ }>;
417
+ deliveries(webhookId: string, options?: RequestOptions & {
418
+ limit?: number;
419
+ }): Promise<{
420
+ readonly id: string;
421
+ readonly webhookId: string;
422
+ readonly eventId: string;
423
+ readonly eventType: string;
424
+ readonly status: "pending" | "delivered" | "failed" | "dead";
425
+ readonly attempts: number;
426
+ readonly lastStatusCode: number | null;
427
+ readonly lastError: string | null;
428
+ readonly lastAttemptAt: string | null;
429
+ readonly deliveredAt: string | null;
430
+ readonly createdAt: string;
431
+ }[]>;
432
+ };
433
+ files: {
434
+ upload(file: File, { signal }?: RequestOptions): Promise<import("./files.js").UploadedFile>;
435
+ download(id: string, { signal }?: RequestOptions): Promise<{
436
+ body: ReadableStream<any>;
437
+ headers: Headers;
438
+ }>;
439
+ delete(id: string, { signal }?: RequestOptions): Promise<void>;
440
+ };
441
+ tenantApps: {
442
+ list: (options?: RequestOptions) => Promise<{
443
+ readonly apps: ReadonlyArray<{
444
+ readonly "id": string;
445
+ readonly "organizationId": string;
446
+ readonly "publicId": string;
447
+ readonly "name": string;
448
+ readonly "active": boolean;
449
+ readonly "settings": {
450
+ readonly "appId": string;
451
+ readonly "appDisplayName": string;
452
+ readonly "logoUri"?: string | null;
453
+ readonly "primaryColor"?: string | null;
454
+ readonly "supportEmail"?: string | null;
455
+ readonly "footerText"?: string | null;
456
+ readonly "fromEmail"?: string | null;
457
+ readonly "fromName"?: string | null;
458
+ readonly "replyTo"?: string | null;
459
+ readonly "siteUrl": string;
460
+ readonly "redirectAllowList": ReadonlyArray<string>;
461
+ readonly "emailActionPaths"?: {
462
+ readonly [key: string]: unknown;
463
+ } | null;
464
+ readonly "googleEnabled": boolean;
465
+ readonly "googleClientId"?: string | null;
466
+ readonly "googleConfigured": boolean;
467
+ readonly "googleRedirectUri"?: string | null;
468
+ readonly "webauthnEnabled": boolean;
469
+ readonly "emailCopy"?: {
470
+ readonly [key: string]: unknown;
471
+ } | null;
472
+ readonly "smtpHost"?: string | null;
473
+ readonly "smtpPort"?: string | number | null;
474
+ readonly "smtpSecure": boolean;
475
+ readonly "smtpUser"?: string | null;
476
+ readonly "smtpConfigured": boolean;
477
+ readonly "turnstileSiteKey"?: string | null;
478
+ readonly "turnstileConfigured": boolean;
479
+ };
480
+ readonly "createdAt": string;
481
+ readonly "updatedAt": string;
482
+ }>;
483
+ }>;
484
+ create: (body: {
485
+ readonly name: string;
486
+ readonly settings: {
487
+ readonly "appDisplayName": string;
488
+ readonly "logoUri"?: string;
489
+ readonly "primaryColor"?: string;
490
+ readonly "supportEmail"?: string;
491
+ readonly "footerText"?: string;
492
+ readonly "fromEmail"?: string;
493
+ readonly "fromName"?: string;
494
+ readonly "replyTo"?: string;
495
+ readonly "siteUrl": string;
496
+ readonly "redirectAllowList": ReadonlyArray<string>;
497
+ readonly "emailActionPaths"?: {
498
+ readonly "invite"?: string;
499
+ readonly "verifyEmail"?: string;
500
+ readonly "resetPassword"?: string;
501
+ };
502
+ readonly "googleEnabled": boolean;
503
+ readonly "googleClientId"?: string;
504
+ readonly "googleClientSecret"?: string;
505
+ readonly "googleRedirectUri"?: string;
506
+ readonly "webauthnEnabled"?: boolean;
507
+ readonly "emailCopy"?: {
508
+ readonly "inviteSubject"?: string;
509
+ readonly "inviteHeading"?: string;
510
+ readonly "inviteCta"?: string;
511
+ readonly "verifySubject"?: string;
512
+ readonly "resetSubject"?: string;
513
+ };
514
+ readonly "smtpHost"?: string;
515
+ readonly "smtpPort"?: string | number;
516
+ readonly "smtpSecure"?: boolean;
517
+ readonly "smtpUser"?: string;
518
+ readonly "smtpPassword"?: string;
519
+ readonly "turnstileSiteKey"?: string;
520
+ readonly "turnstileSecret"?: string;
521
+ };
522
+ }, options?: RequestOptions) => Promise<{
523
+ readonly id: string;
524
+ readonly organizationId: string;
525
+ readonly publicId: string;
526
+ readonly name: string;
527
+ readonly active: boolean;
528
+ readonly settings: {
529
+ readonly "appId": string;
530
+ readonly "appDisplayName": string;
531
+ readonly "logoUri"?: string | null;
532
+ readonly "primaryColor"?: string | null;
533
+ readonly "supportEmail"?: string | null;
534
+ readonly "footerText"?: string | null;
535
+ readonly "fromEmail"?: string | null;
536
+ readonly "fromName"?: string | null;
537
+ readonly "replyTo"?: string | null;
538
+ readonly "siteUrl": string;
539
+ readonly "redirectAllowList": ReadonlyArray<string>;
540
+ readonly "emailActionPaths"?: {
541
+ readonly [key: string]: unknown;
542
+ } | null;
543
+ readonly "googleEnabled": boolean;
544
+ readonly "googleClientId"?: string | null;
545
+ readonly "googleConfigured": boolean;
546
+ readonly "googleRedirectUri"?: string | null;
547
+ readonly "webauthnEnabled": boolean;
548
+ readonly "emailCopy"?: {
549
+ readonly [key: string]: unknown;
550
+ } | null;
551
+ readonly "smtpHost"?: string | null;
552
+ readonly "smtpPort"?: string | number | null;
553
+ readonly "smtpSecure": boolean;
554
+ readonly "smtpUser"?: string | null;
555
+ readonly "smtpConfigured": boolean;
556
+ readonly "turnstileSiteKey"?: string | null;
557
+ readonly "turnstileConfigured": boolean;
558
+ };
559
+ readonly createdAt: string;
560
+ readonly updatedAt: string;
561
+ }>;
562
+ linkUser: (userId: string, body: {
563
+ readonly patientId: string | null;
564
+ readonly practitionerId?: string | null;
565
+ }, options?: RequestOptions) => Promise<{
566
+ readonly id: string;
567
+ readonly email: string;
568
+ readonly patientId: string | null;
569
+ readonly practitionerId: string | null;
570
+ }>;
571
+ forApp: (id: string) => {
572
+ get: (options?: RequestOptions) => Promise<{
573
+ readonly id: string;
574
+ readonly organizationId: string;
575
+ readonly publicId: string;
576
+ readonly name: string;
577
+ readonly active: boolean;
578
+ readonly settings: {
579
+ readonly "appId": string;
580
+ readonly "appDisplayName": string;
581
+ readonly "logoUri"?: string | null;
582
+ readonly "primaryColor"?: string | null;
583
+ readonly "supportEmail"?: string | null;
584
+ readonly "footerText"?: string | null;
585
+ readonly "fromEmail"?: string | null;
586
+ readonly "fromName"?: string | null;
587
+ readonly "replyTo"?: string | null;
588
+ readonly "siteUrl": string;
589
+ readonly "redirectAllowList": ReadonlyArray<string>;
590
+ readonly "emailActionPaths"?: {
591
+ readonly [key: string]: unknown;
592
+ } | null;
593
+ readonly "googleEnabled": boolean;
594
+ readonly "googleClientId"?: string | null;
595
+ readonly "googleConfigured": boolean;
596
+ readonly "googleRedirectUri"?: string | null;
597
+ readonly "webauthnEnabled": boolean;
598
+ readonly "emailCopy"?: {
599
+ readonly [key: string]: unknown;
600
+ } | null;
601
+ readonly "smtpHost"?: string | null;
602
+ readonly "smtpPort"?: string | number | null;
603
+ readonly "smtpSecure": boolean;
604
+ readonly "smtpUser"?: string | null;
605
+ readonly "smtpConfigured": boolean;
606
+ readonly "turnstileSiteKey"?: string | null;
607
+ readonly "turnstileConfigured": boolean;
608
+ };
609
+ readonly createdAt: string;
610
+ readonly updatedAt: string;
611
+ }>;
612
+ update: (body: {
613
+ readonly name?: string;
614
+ readonly active?: boolean;
615
+ readonly settings?: {
616
+ readonly "appDisplayName"?: string;
617
+ readonly "logoUri"?: string | null;
618
+ readonly "primaryColor"?: string | null;
619
+ readonly "supportEmail"?: string | null;
620
+ readonly "footerText"?: string | null;
621
+ readonly "fromEmail"?: string | null;
622
+ readonly "fromName"?: string | null;
623
+ readonly "replyTo"?: string | null;
624
+ readonly "siteUrl"?: string;
625
+ readonly "redirectAllowList"?: ReadonlyArray<string>;
626
+ readonly "emailActionPaths"?: {
627
+ readonly "invite"?: string;
628
+ readonly "verifyEmail"?: string;
629
+ readonly "resetPassword"?: string;
630
+ } | null;
631
+ readonly "googleEnabled"?: boolean;
632
+ readonly "googleClientId"?: string | null;
633
+ readonly "googleClientSecret"?: string | null;
634
+ readonly "googleRedirectUri"?: string | null;
635
+ readonly "webauthnEnabled"?: boolean;
636
+ readonly "emailCopy"?: {
637
+ readonly "inviteSubject"?: string;
638
+ readonly "inviteHeading"?: string;
639
+ readonly "inviteCta"?: string;
640
+ readonly "verifySubject"?: string;
641
+ readonly "resetSubject"?: string;
642
+ } | null;
643
+ readonly "smtpHost"?: string | null;
644
+ readonly "smtpPort"?: string | number | null;
645
+ readonly "smtpSecure"?: boolean;
646
+ readonly "smtpUser"?: string | null;
647
+ readonly "smtpPassword"?: string | null;
648
+ readonly "turnstileSiteKey"?: string | null;
649
+ readonly "turnstileSecret"?: string | null;
650
+ };
651
+ }, options?: RequestOptions) => Promise<{
652
+ readonly id: string;
653
+ readonly organizationId: string;
654
+ readonly publicId: string;
655
+ readonly name: string;
656
+ readonly active: boolean;
657
+ readonly settings: {
658
+ readonly "appId": string;
659
+ readonly "appDisplayName": string;
660
+ readonly "logoUri"?: string | null;
661
+ readonly "primaryColor"?: string | null;
662
+ readonly "supportEmail"?: string | null;
663
+ readonly "footerText"?: string | null;
664
+ readonly "fromEmail"?: string | null;
665
+ readonly "fromName"?: string | null;
666
+ readonly "replyTo"?: string | null;
667
+ readonly "siteUrl": string;
668
+ readonly "redirectAllowList": ReadonlyArray<string>;
669
+ readonly "emailActionPaths"?: {
670
+ readonly [key: string]: unknown;
671
+ } | null;
672
+ readonly "googleEnabled": boolean;
673
+ readonly "googleClientId"?: string | null;
674
+ readonly "googleConfigured": boolean;
675
+ readonly "googleRedirectUri"?: string | null;
676
+ readonly "webauthnEnabled": boolean;
677
+ readonly "emailCopy"?: {
678
+ readonly [key: string]: unknown;
679
+ } | null;
680
+ readonly "smtpHost"?: string | null;
681
+ readonly "smtpPort"?: string | number | null;
682
+ readonly "smtpSecure": boolean;
683
+ readonly "smtpUser"?: string | null;
684
+ readonly "smtpConfigured": boolean;
685
+ readonly "turnstileSiteKey"?: string | null;
686
+ readonly "turnstileConfigured": boolean;
687
+ };
688
+ readonly createdAt: string;
689
+ readonly updatedAt: string;
690
+ }>;
691
+ delete: (options?: RequestOptions) => Promise<undefined>;
692
+ stats: (options?: RequestOptions) => Promise<{
693
+ readonly userCount: number;
694
+ readonly activeSessionsLast24h: number;
695
+ readonly signupsLast7d: number;
696
+ readonly lastActivityAt: string | null;
697
+ }>;
698
+ sendTestEmail: (body: {
699
+ readonly to: string;
700
+ readonly smtpHost?: string;
701
+ readonly smtpPort?: string | number;
702
+ readonly smtpSecure?: boolean;
703
+ readonly smtpUser?: string;
704
+ readonly smtpPassword?: string;
705
+ }, options?: RequestOptions) => Promise<{
706
+ readonly delivered: true;
707
+ }>;
708
+ backfillPatientConsents: (options?: RequestOptions) => Promise<{
709
+ readonly created: number;
710
+ readonly skipped: number;
711
+ readonly total: number;
712
+ }>;
713
+ users: {
714
+ list: (query?: import("./integration-contract.js").IntegrationQueries["GET /tenant-apps/:id/users"], options?: RequestOptions) => Promise<{
715
+ readonly users: ReadonlyArray<{
716
+ readonly "id": string;
717
+ readonly "appId": string;
718
+ readonly "email": string;
719
+ readonly "firstName": string | null;
720
+ readonly "lastName": string | null;
721
+ readonly "isActive": boolean;
722
+ readonly "emailVerified": boolean;
723
+ readonly "mfaEnabled": boolean;
724
+ readonly "lastLoginAt": string | null;
725
+ readonly "patientId": string | null;
726
+ readonly "practitionerId": string | null;
727
+ readonly "createdAt": string;
728
+ readonly "lockedUntil": string | null;
729
+ readonly "failedLoginAttempts": string | number;
730
+ readonly "roles": ReadonlyArray<{
731
+ readonly "id": string;
732
+ readonly "name": string;
733
+ readonly "isStaff": boolean;
734
+ }>;
735
+ }>;
736
+ readonly nextCursor: string | null;
737
+ }>;
738
+ get: (userId: string, options?: RequestOptions) => Promise<{
739
+ readonly id: string;
740
+ readonly appId: string;
741
+ readonly email: string;
742
+ readonly firstName: string | null;
743
+ readonly lastName: string | null;
744
+ readonly isActive: boolean;
745
+ readonly emailVerified: boolean;
746
+ readonly mfaEnabled: boolean;
747
+ readonly lastLoginAt: string | null;
748
+ readonly patientId: string | null;
749
+ readonly practitionerId: string | null;
750
+ readonly createdAt: string;
751
+ readonly lockedUntil: string | null;
752
+ readonly failedLoginAttempts: string | number;
753
+ readonly roles: ReadonlyArray<{
754
+ readonly "id": string;
755
+ readonly "name": string;
756
+ readonly "isStaff": boolean;
757
+ }>;
758
+ }>;
759
+ update: (userId: string, body: {
760
+ readonly patientId?: string | null;
761
+ readonly practitionerId?: string | null;
762
+ readonly isActive?: boolean;
763
+ readonly clearLockout?: boolean;
764
+ }, options?: RequestOptions) => Promise<undefined>;
765
+ delete: (userId: string, options?: RequestOptions) => Promise<undefined>;
766
+ markEmailVerified: (userId: string, options?: RequestOptions) => Promise<undefined>;
767
+ sendPasswordReset: (userId: string, options?: RequestOptions) => Promise<undefined>;
768
+ roles: (userId: string, options?: RequestOptions) => Promise<{
769
+ readonly items: ReadonlyArray<{
770
+ readonly "id": string;
771
+ readonly "name": string;
772
+ readonly "isStaff": boolean;
773
+ readonly "permissions": ReadonlyArray<{
774
+ readonly "resource": string;
775
+ readonly "action": string;
776
+ }>;
777
+ }>;
778
+ readonly total: number;
779
+ }>;
780
+ assignRole: (userId: string, roleId: string, options?: RequestOptions) => Promise<undefined>;
781
+ removeRole: (userId: string, roleId: string, options?: RequestOptions) => Promise<undefined>;
782
+ };
783
+ roles: {
784
+ list: (options?: RequestOptions) => Promise<{
785
+ readonly items: ReadonlyArray<{
786
+ readonly "id": string;
787
+ readonly "name": string;
788
+ readonly "isStaff": boolean;
789
+ readonly "permissions": ReadonlyArray<{
790
+ readonly "resource": string;
791
+ readonly "action": string;
792
+ }>;
793
+ readonly "organizationId": string;
794
+ readonly "displayName": string | null;
795
+ readonly "description": string | null;
796
+ readonly "isSystem": boolean;
797
+ readonly "createdAt": string;
798
+ readonly "updatedAt": string;
799
+ readonly "userCount": number;
800
+ }>;
801
+ readonly total: number;
802
+ }>;
803
+ create: (body: {
804
+ readonly name: string;
805
+ readonly displayName?: string;
806
+ readonly description?: string;
807
+ readonly permissions?: ReadonlyArray<{
808
+ readonly "resource": string;
809
+ readonly "action": string;
810
+ }>;
811
+ readonly isStaff?: boolean;
812
+ }, options?: RequestOptions) => Promise<{
813
+ readonly id: string;
814
+ readonly name: string;
815
+ readonly isStaff: boolean;
816
+ readonly permissions: ReadonlyArray<{
817
+ readonly "resource": string;
818
+ readonly "action": string;
819
+ }>;
820
+ readonly organizationId: string;
821
+ readonly displayName: string | null;
822
+ readonly description: string | null;
823
+ readonly isSystem: boolean;
824
+ readonly createdAt: string;
825
+ readonly updatedAt: string;
826
+ }>;
827
+ update: (roleId: string, body: {
828
+ readonly name?: string;
829
+ readonly displayName?: string;
830
+ readonly description?: string;
831
+ readonly permissions?: ReadonlyArray<{
832
+ readonly "resource": string;
833
+ readonly "action": string;
834
+ }>;
835
+ readonly isStaff?: boolean;
836
+ }, options?: RequestOptions) => Promise<{
837
+ readonly id: string;
838
+ readonly name: string;
839
+ readonly isStaff: boolean;
840
+ readonly permissions: ReadonlyArray<{
841
+ readonly "resource": string;
842
+ readonly "action": string;
843
+ }>;
844
+ readonly organizationId: string;
845
+ readonly displayName: string | null;
846
+ readonly description: string | null;
847
+ readonly isSystem: boolean;
848
+ readonly createdAt: string;
849
+ readonly updatedAt: string;
850
+ }>;
851
+ delete: (roleId: string, options?: RequestOptions) => Promise<undefined>;
852
+ users: (roleId: string, options?: RequestOptions) => Promise<{
853
+ readonly items: ReadonlyArray<{
854
+ readonly "id": string;
855
+ readonly "email": string;
856
+ }>;
857
+ readonly total: number;
858
+ }>;
859
+ };
860
+ invitations: {
861
+ list: (options?: RequestOptions) => Promise<{
862
+ readonly items: ReadonlyArray<{
863
+ readonly "id": string;
864
+ readonly "email": string;
865
+ readonly "hasLinkedPatient": boolean;
866
+ readonly "hasLinkedPractitioner": boolean;
867
+ readonly "hasLinkedRole": boolean;
868
+ readonly "expiresAt": string;
869
+ readonly "createdAt": string;
870
+ }>;
871
+ readonly total: number;
872
+ }>;
873
+ invite: (body: {
874
+ readonly email: string;
875
+ readonly patientId?: string | null;
876
+ readonly practitionerId?: string | null;
877
+ readonly roleId?: string | null;
878
+ }, options?: RequestOptions) => Promise<{
879
+ readonly invitationId: string;
880
+ }>;
881
+ inviteMany: (body: {
882
+ readonly invitations: ReadonlyArray<{
883
+ readonly "email": string;
884
+ readonly "roleId"?: string | null;
885
+ readonly "patientId"?: string | null;
886
+ }>;
887
+ }, options?: RequestOptions) => Promise<{
888
+ readonly created: ReadonlyArray<{
889
+ readonly "email": string;
890
+ readonly "invitationId": string;
891
+ }>;
892
+ readonly failed: ReadonlyArray<{
893
+ readonly "email": string;
894
+ readonly "error": string;
895
+ }>;
896
+ }>;
897
+ inviteStaff: (body: {
898
+ readonly email: string;
899
+ readonly name?: {
900
+ readonly "given"?: ReadonlyArray<string>;
901
+ readonly "family"?: string;
902
+ };
903
+ readonly specialty?: string;
904
+ readonly roleId?: string | null;
905
+ }, options?: RequestOptions) => Promise<{
906
+ readonly invitationId: string;
907
+ readonly practitionerId: string;
908
+ }>;
909
+ resend: (invId: string, options?: RequestOptions) => Promise<{
910
+ readonly message: string;
911
+ }>;
912
+ revoke: (invId: string, options?: RequestOptions) => Promise<undefined>;
913
+ };
914
+ };
915
+ };
916
+ organization: {
917
+ audit: {
918
+ searchEvents: (query?: {
919
+ readonly type?: "auth" | "rest" | "system";
920
+ readonly action?: "C" | "R" | "U" | "D" | "E";
921
+ readonly resourceType?: string;
922
+ readonly resourceId?: string;
923
+ readonly userId?: string;
924
+ readonly after?: string;
925
+ readonly before?: string;
926
+ readonly cursor?: string;
927
+ readonly limit?: string;
928
+ }, options?: RequestOptions) => Promise<{
929
+ readonly events: ReadonlyArray<{
930
+ readonly "id": string;
931
+ readonly "type": string;
932
+ readonly "subtype": string | null;
933
+ readonly "action": "C" | "R" | "U" | "D" | "E";
934
+ readonly "outcome": "success" | "failure";
935
+ readonly "outcomeDesc": string | null;
936
+ readonly "agent": {
937
+ readonly "userId"?: string;
938
+ readonly "email"?: string;
939
+ readonly "ip"?: string;
940
+ readonly "userAgent"?: string;
941
+ };
942
+ readonly "entity": {
943
+ readonly "resourceType"?: string;
944
+ readonly "resourceId"?: string;
945
+ readonly "query"?: string;
946
+ } | null;
947
+ readonly "recordedAt": string;
948
+ }>;
949
+ readonly nextCursor: string | null;
950
+ }>;
951
+ searchLogs: (query?: {
952
+ readonly _count?: string;
953
+ readonly _offset?: string;
954
+ readonly date?: string | ReadonlyArray<string>;
955
+ readonly agent?: string;
956
+ readonly entity?: string;
957
+ readonly type?: string;
958
+ readonly outcome?: string;
959
+ }, options?: RequestOptions) => Promise<{
960
+ readonly rows: ReadonlyArray<{
961
+ readonly "id": string;
962
+ readonly "organizationId"?: string | null;
963
+ readonly "type": string;
964
+ readonly "subtype"?: string | null;
965
+ readonly "action": "C" | "R" | "U" | "D" | "E";
966
+ readonly "outcome": "success" | "failure";
967
+ readonly "outcomeDesc"?: string | null;
968
+ readonly "agent": {
969
+ readonly "userId"?: string;
970
+ readonly "email"?: string;
971
+ readonly "ip"?: string;
972
+ readonly "userAgent"?: string;
973
+ };
974
+ readonly "source"?: {
975
+ readonly "site"?: string;
976
+ readonly "observer"?: string;
977
+ readonly "integrity"?: string;
978
+ } | null;
979
+ readonly "entity"?: {
980
+ readonly "resourceType"?: string;
981
+ readonly "resourceId"?: string;
982
+ readonly "query"?: string;
983
+ readonly "patients"?: ReadonlyArray<string>;
984
+ } | null;
985
+ readonly "recorded": string;
986
+ }>;
987
+ readonly total: number;
988
+ }>;
989
+ forPatient: (patientId: string, query?: {
990
+ readonly _count?: string;
991
+ readonly _offset?: string;
992
+ readonly date?: string | ReadonlyArray<string>;
993
+ readonly agent?: string;
994
+ readonly entity?: string;
995
+ readonly type?: string;
996
+ readonly outcome?: string;
997
+ }, options?: RequestOptions) => Promise<{
998
+ readonly rows: ReadonlyArray<{
999
+ readonly "id": string;
1000
+ readonly "organizationId"?: string | null;
1001
+ readonly "type": string;
1002
+ readonly "subtype"?: string | null;
1003
+ readonly "action": "C" | "R" | "U" | "D" | "E";
1004
+ readonly "outcome": "success" | "failure";
1005
+ readonly "outcomeDesc"?: string | null;
1006
+ readonly "agent": {
1007
+ readonly "userId"?: string;
1008
+ readonly "email"?: string;
1009
+ readonly "ip"?: string;
1010
+ readonly "userAgent"?: string;
1011
+ };
1012
+ readonly "source"?: {
1013
+ readonly "site"?: string;
1014
+ readonly "observer"?: string;
1015
+ readonly "integrity"?: string;
1016
+ } | null;
1017
+ readonly "entity"?: {
1018
+ readonly "resourceType"?: string;
1019
+ readonly "resourceId"?: string;
1020
+ readonly "query"?: string;
1021
+ readonly "patients"?: ReadonlyArray<string>;
1022
+ } | null;
1023
+ readonly "recorded": string;
1024
+ }>;
1025
+ readonly total: number;
1026
+ }>;
1027
+ forUser: (userId: string, query?: {
1028
+ readonly _count?: string;
1029
+ readonly _offset?: string;
1030
+ readonly date?: string | ReadonlyArray<string>;
1031
+ readonly agent?: string;
1032
+ readonly entity?: string;
1033
+ readonly type?: string;
1034
+ readonly outcome?: string;
1035
+ }, options?: RequestOptions) => Promise<{
1036
+ readonly rows: ReadonlyArray<{
1037
+ readonly "id": string;
1038
+ readonly "organizationId"?: string | null;
1039
+ readonly "type": string;
1040
+ readonly "subtype"?: string | null;
1041
+ readonly "action": "C" | "R" | "U" | "D" | "E";
1042
+ readonly "outcome": "success" | "failure";
1043
+ readonly "outcomeDesc"?: string | null;
1044
+ readonly "agent": {
1045
+ readonly "userId"?: string;
1046
+ readonly "email"?: string;
1047
+ readonly "ip"?: string;
1048
+ readonly "userAgent"?: string;
1049
+ };
1050
+ readonly "source"?: {
1051
+ readonly "site"?: string;
1052
+ readonly "observer"?: string;
1053
+ readonly "integrity"?: string;
1054
+ } | null;
1055
+ readonly "entity"?: {
1056
+ readonly "resourceType"?: string;
1057
+ readonly "resourceId"?: string;
1058
+ readonly "query"?: string;
1059
+ readonly "patients"?: ReadonlyArray<string>;
1060
+ } | null;
1061
+ readonly "recorded": string;
1062
+ }>;
1063
+ readonly total: number;
1064
+ }>;
1065
+ emailLog: (query?: {
1066
+ readonly to?: string;
1067
+ readonly appId?: string;
1068
+ readonly status?: "queued" | "accepted" | "delivered" | "failed" | "suppressed";
1069
+ readonly template?: string;
1070
+ readonly after?: string;
1071
+ readonly before?: string;
1072
+ readonly cursor?: string;
1073
+ readonly limit?: string;
1074
+ }, options?: RequestOptions) => Promise<{
1075
+ readonly entries: ReadonlyArray<{
1076
+ readonly "id": string;
1077
+ readonly "appId": string | null;
1078
+ readonly "toAddress": string;
1079
+ readonly "subject": string;
1080
+ readonly "template": string;
1081
+ readonly "status": string;
1082
+ readonly "attempts": number;
1083
+ readonly "lastError": string | null;
1084
+ readonly "queuedAt": string;
1085
+ readonly "deliveredAt": string | null;
1086
+ readonly "failedAt": string | null;
1087
+ }>;
1088
+ readonly nextCursor: string | null;
1089
+ }>;
1090
+ };
1091
+ billing: {
1092
+ plan: (options?: RequestOptions) => Promise<{
1093
+ readonly organizationId: string;
1094
+ readonly tier: {
1095
+ readonly "id": string;
1096
+ readonly "name": string;
1097
+ readonly "displayName": string;
1098
+ readonly "description": string | null;
1099
+ readonly "isActive": boolean;
1100
+ readonly "maxPatients": number;
1101
+ readonly "maxPractitioners": number;
1102
+ readonly "maxUsers": number;
1103
+ readonly "maxApiKeys": number;
1104
+ readonly "maxRequestsPerMonth": number;
1105
+ readonly "rateLimitPerMinute": number;
1106
+ readonly "writeLimitPerMinute": number;
1107
+ readonly "features": {
1108
+ readonly [key: string]: boolean;
1109
+ };
1110
+ readonly "commercial": {
1111
+ readonly "published": boolean;
1112
+ readonly "currency": "USD";
1113
+ readonly "monthlyPriceCents": string | number | null;
1114
+ readonly "annualPriceCents": string | number | null;
1115
+ readonly "launchEndsAt": string | null;
1116
+ readonly "support": "community" | "email" | "dedicated";
1117
+ readonly "sla": "none" | "standard" | "custom";
1118
+ } | null;
1119
+ readonly "createdAt": string;
1120
+ readonly "updatedAt": string;
1121
+ };
1122
+ readonly effectiveLimits: {
1123
+ readonly "tierName": string;
1124
+ readonly "tierDisplayName": string;
1125
+ readonly "maxPatients": number;
1126
+ readonly "maxPractitioners": number;
1127
+ readonly "maxUsers": number;
1128
+ readonly "maxApiKeys": number;
1129
+ readonly "maxRequestsPerMonth": number;
1130
+ readonly "rateLimitPerMinute": number;
1131
+ readonly "writeLimitPerMinute": number;
1132
+ readonly "features": {
1133
+ readonly [key: string]: boolean;
1134
+ };
1135
+ };
1136
+ readonly assignedAt: string;
1137
+ readonly assignedBy: string | null;
1138
+ readonly notes: string | null;
1139
+ readonly hasOverrides: boolean;
1140
+ }>;
1141
+ usage: (options?: RequestOptions) => Promise<{
1142
+ readonly organizationId: string;
1143
+ readonly tierName: string;
1144
+ readonly patients: {
1145
+ readonly "current": number;
1146
+ readonly "limit": number;
1147
+ readonly "remaining": number;
1148
+ readonly "percentUsed": number;
1149
+ };
1150
+ readonly practitioners: {
1151
+ readonly "current": number;
1152
+ readonly "limit": number;
1153
+ readonly "remaining": number;
1154
+ readonly "percentUsed": number;
1155
+ };
1156
+ readonly users: {
1157
+ readonly "current": number;
1158
+ readonly "limit": number;
1159
+ readonly "remaining": number;
1160
+ readonly "percentUsed": number;
1161
+ };
1162
+ readonly apiKeys: {
1163
+ readonly "current": number;
1164
+ readonly "limit": number;
1165
+ readonly "remaining": number;
1166
+ readonly "percentUsed": number;
1167
+ };
1168
+ readonly requestsThisMonth: {
1169
+ readonly "current": number;
1170
+ readonly "limit": number;
1171
+ readonly "remaining": number;
1172
+ readonly "percentUsed": number;
1173
+ };
1174
+ }>;
1175
+ usageHistory: (query?: {
1176
+ readonly months?: string;
1177
+ }, options?: RequestOptions) => Promise<{
1178
+ readonly entries: ReadonlyArray<{
1179
+ readonly "id": string;
1180
+ readonly "organizationId": string;
1181
+ readonly "period": string;
1182
+ readonly "requestCount": number;
1183
+ readonly "resourceCount": number;
1184
+ readonly "storageBytes": number;
1185
+ readonly "lastUpdated": string;
1186
+ }>;
1187
+ readonly total: number;
1188
+ }>;
1189
+ quota: (options?: RequestOptions) => Promise<{
1190
+ readonly patients: {
1191
+ readonly "current": number;
1192
+ readonly "limit": number;
1193
+ };
1194
+ readonly practitioners: {
1195
+ readonly "current": number;
1196
+ readonly "limit": number;
1197
+ };
1198
+ readonly apiKeys: {
1199
+ readonly "current": number;
1200
+ readonly "limit": number;
1201
+ };
1202
+ }>;
1203
+ };
1204
+ cors: {
1205
+ list: (options?: RequestOptions) => Promise<{
1206
+ readonly origins: ReadonlyArray<string>;
1207
+ }>;
1208
+ replace: (body: {
1209
+ readonly origins: ReadonlyArray<string>;
1210
+ }, options?: RequestOptions) => Promise<{
1211
+ readonly origins: ReadonlyArray<string>;
1212
+ }>;
1213
+ };
1214
+ smartApps: {
1215
+ list: (query?: {
1216
+ readonly active?: string;
1217
+ readonly name?: string;
1218
+ }, options?: RequestOptions) => Promise<{
1219
+ readonly items: ReadonlyArray<{
1220
+ readonly "id": string;
1221
+ readonly "clientId": string;
1222
+ readonly "name": string;
1223
+ readonly "description"?: string;
1224
+ readonly "redirectUris": ReadonlyArray<string>;
1225
+ readonly "scopes": ReadonlyArray<string>;
1226
+ readonly "launchUri"?: string;
1227
+ readonly "logoUri"?: string;
1228
+ readonly "isConfidential": boolean;
1229
+ readonly "active": boolean;
1230
+ readonly "createdAt": string;
1231
+ readonly "updatedAt": string;
1232
+ }>;
1233
+ readonly total: number;
1234
+ }>;
1235
+ get: (id: string, options?: RequestOptions) => Promise<{
1236
+ readonly id: string;
1237
+ readonly clientId: string;
1238
+ readonly name: string;
1239
+ readonly description?: string;
1240
+ readonly redirectUris: ReadonlyArray<string>;
1241
+ readonly scopes: ReadonlyArray<string>;
1242
+ readonly launchUri?: string;
1243
+ readonly logoUri?: string;
1244
+ readonly isConfidential: boolean;
1245
+ readonly active: boolean;
1246
+ readonly createdAt: string;
1247
+ readonly updatedAt: string;
1248
+ }>;
1249
+ create: (body: {
1250
+ readonly name: string;
1251
+ readonly redirectUris: ReadonlyArray<string>;
1252
+ readonly scopes: ReadonlyArray<string>;
1253
+ readonly description?: string;
1254
+ readonly launchUri?: string;
1255
+ readonly logoUri?: string;
1256
+ readonly isConfidential?: boolean;
1257
+ }, options?: RequestOptions) => Promise<{
1258
+ readonly id: string;
1259
+ readonly clientId: string;
1260
+ readonly name: string;
1261
+ readonly description?: string;
1262
+ readonly redirectUris: ReadonlyArray<string>;
1263
+ readonly scopes: ReadonlyArray<string>;
1264
+ readonly launchUri?: string;
1265
+ readonly logoUri?: string;
1266
+ readonly isConfidential: boolean;
1267
+ readonly active: boolean;
1268
+ readonly createdAt: string;
1269
+ readonly updatedAt: string;
1270
+ readonly clientSecret: string;
1271
+ }>;
1272
+ update: (id: string, body: {
1273
+ readonly name?: string;
1274
+ readonly redirectUris?: ReadonlyArray<string>;
1275
+ readonly scopes?: ReadonlyArray<string>;
1276
+ readonly description?: string;
1277
+ readonly launchUri?: string;
1278
+ readonly logoUri?: string;
1279
+ readonly active?: boolean;
1280
+ readonly isConfidential?: boolean;
1281
+ }, options?: RequestOptions) => Promise<{
1282
+ readonly id: string;
1283
+ readonly clientId: string;
1284
+ readonly name: string;
1285
+ readonly description?: string;
1286
+ readonly redirectUris: ReadonlyArray<string>;
1287
+ readonly scopes: ReadonlyArray<string>;
1288
+ readonly launchUri?: string;
1289
+ readonly logoUri?: string;
1290
+ readonly isConfidential: boolean;
1291
+ readonly active: boolean;
1292
+ readonly createdAt: string;
1293
+ readonly updatedAt: string;
1294
+ }>;
1295
+ delete: (id: string, options?: RequestOptions) => Promise<undefined>;
1296
+ };
1297
+ };
1298
+ };
1299
+ type SmartConnection = Pick<ReturnType<typeof organizationConnection>, "validateConnection">;
1300
+ type ReadFhir = ReturnType<typeof readFhir> & {
1301
+ operation: ReturnType<typeof fhirOperation<SmartFhirOperation>>;
1302
+ };
1303
+ export declare function createSmartClient(options: SmartOptions & Readonly<{
1304
+ enableWrites: true;
1305
+ }>): SmartConnection & {
1306
+ fhir: ReadFhir & ReturnType<typeof writeFhir>;
1307
+ };
1308
+ export declare function createSmartClient(options: SmartOptions): SmartConnection & {
1309
+ fhir: ReadFhir;
1310
+ };