@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.
- package/LICENSE +21 -0
- package/README.md +149 -2
- package/dist/app-session.d.ts +225 -0
- package/dist/app-session.js +286 -0
- package/dist/clinical-workflows.d.ts +279 -0
- package/dist/clinical-workflows.js +43 -0
- package/dist/diagnostics.d.ts +24 -0
- package/dist/diagnostics.js +57 -0
- package/dist/fhir-contract.d.ts +12540 -0
- package/dist/fhir-contract.js +95 -0
- package/dist/fhir.d.ts +94 -0
- package/dist/fhir.js +174 -0
- package/dist/files.d.ts +13 -0
- package/dist/files.js +40 -0
- package/dist/integration-contract.d.ts +2327 -0
- package/dist/integration-contract.js +124 -0
- package/dist/integration-request.d.ts +11 -0
- package/dist/integration-request.js +19 -0
- package/dist/organization.d.ts +324 -0
- package/dist/organization.js +43 -0
- package/dist/patient-contract.d.ts +2 -0
- package/dist/patient-contract.js +1 -0
- package/dist/public.d.ts +125 -0
- package/dist/public.js +34 -0
- package/dist/server.d.ts +1310 -0
- package/dist/server.js +85 -0
- package/dist/smart.d.ts +42 -0
- package/dist/smart.js +98 -0
- package/dist/tenant-apps.d.ts +355 -0
- package/dist/tenant-apps.js +50 -0
- package/dist/transport.d.ts +38 -0
- package/dist/transport.js +120 -0
- package/dist/webhook-management.d.ts +53 -0
- package/dist/webhook-management.js +83 -0
- package/dist/webhooks.d.ts +24 -0
- package/dist/webhooks.js +41 -0
- package/package.json +17 -4
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createPublicClient } from "./public.js";
|
|
2
|
+
import { EsusError } from "./transport.js";
|
|
3
|
+
export const integrationCapabilities = [
|
|
4
|
+
"account-email", "app-sessions", "clinical-workflows", "files", "organization", "public-status", "tenant-apps", "webhooks",
|
|
5
|
+
];
|
|
6
|
+
export async function diagnoseCapabilities({ url, capabilities, service, settings, signal }) {
|
|
7
|
+
const options = { signal };
|
|
8
|
+
return Promise.all(capabilities.map(async (capability) => {
|
|
9
|
+
const report = (status, detail) => ({ capability, status, detail });
|
|
10
|
+
try {
|
|
11
|
+
switch (capability) {
|
|
12
|
+
case "account-email": return settings.emailAppId
|
|
13
|
+
? report("configured", "Verify a code with a test inbox.")
|
|
14
|
+
: report("missing", "Set the account email app ID.");
|
|
15
|
+
case "app-sessions": return settings.sessionAppId
|
|
16
|
+
? report("configured", "Sign in with a test app user to verify the flow.")
|
|
17
|
+
: report("missing", "Set the app user app ID.");
|
|
18
|
+
case "public-status":
|
|
19
|
+
await createPublicClient({ url }).health.live(options);
|
|
20
|
+
return report("verified", "Public liveness answered.");
|
|
21
|
+
case "webhooks":
|
|
22
|
+
if (!settings.webhookAppId || !settings.webhookSecret)
|
|
23
|
+
return report("missing", "Set the webhook app UUID and signing secret.");
|
|
24
|
+
if (!service)
|
|
25
|
+
return report("configured", "Send a signed ping to check receiver delivery.");
|
|
26
|
+
await service.webhooks(settings.webhookAppId).list(options);
|
|
27
|
+
return report("verified", "Subscription read succeeded. Test receiver delivery with a signed ping.");
|
|
28
|
+
default:
|
|
29
|
+
if (!service)
|
|
30
|
+
return report("missing", "Set a server API key for this capability.");
|
|
31
|
+
switch (capability) {
|
|
32
|
+
case "clinical-workflows":
|
|
33
|
+
await Promise.all([service.queue.stats(undefined, options), service.pharmacy.lowStock(undefined, options)]);
|
|
34
|
+
return report("verified", "Queue and pharmacy reads succeeded.");
|
|
35
|
+
case "files": {
|
|
36
|
+
if (!settings.testFileId)
|
|
37
|
+
return report("configured", "Set a test file UUID to verify file read access.");
|
|
38
|
+
const { body } = await service.files.download(settings.testFileId, options);
|
|
39
|
+
await body.cancel();
|
|
40
|
+
return report("verified", "Test file read opened successfully.");
|
|
41
|
+
}
|
|
42
|
+
case "organization":
|
|
43
|
+
await service.organization.billing.quota(options);
|
|
44
|
+
return report("verified", "Quota read succeeded. Check additional scopes for audit, CORS and SMART registration.");
|
|
45
|
+
case "tenant-apps":
|
|
46
|
+
await service.tenantApps.list(options);
|
|
47
|
+
return report("verified", "Tenant app list succeeded.");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return error instanceof EsusError && (error.status === 401 || error.status === 403)
|
|
53
|
+
? report("denied", "Check the key and required permissions.")
|
|
54
|
+
: report("failed", "Check app settings and API availability, then retry.");
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}
|