@healthcloudai/hc-sdk 0.9.1 → 0.11.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/README.md +198 -13
- package/dist/index.cjs +111 -18
- package/dist/index.d.cts +107 -16
- package/dist/index.d.ts +107 -16
- package/dist/index.js +110 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -98,9 +98,10 @@ var HttpClient = class {
|
|
|
98
98
|
return headers;
|
|
99
99
|
}
|
|
100
100
|
buildUrl(service, path, options) {
|
|
101
|
-
var _a;
|
|
101
|
+
var _a, _b, _c;
|
|
102
102
|
const normalizedPath = this.resolvePath(path, (_a = options.pathParams) != null ? _a : {});
|
|
103
|
-
const
|
|
103
|
+
const base = (_c = (_b = this.state.baseUrlOverrides) == null ? void 0 : _b[service]) != null ? _c : resolveBaseUrl(this.state.environment, service);
|
|
104
|
+
const url = new URL(`${base}${normalizedPath}`);
|
|
104
105
|
if (options.query) {
|
|
105
106
|
for (const [key, value] of Object.entries(options.query)) {
|
|
106
107
|
this.appendQuery(url, key, value);
|
|
@@ -335,6 +336,12 @@ var AuthClient = class extends BaseServiceClient {
|
|
|
335
336
|
auth: false
|
|
336
337
|
});
|
|
337
338
|
}
|
|
339
|
+
async resendEmailVerification(request) {
|
|
340
|
+
return this.send("POST", "/auth/resend-verification-code", {
|
|
341
|
+
body: withTenantId(request, this.getTenantId()),
|
|
342
|
+
auth: false
|
|
343
|
+
});
|
|
344
|
+
}
|
|
338
345
|
};
|
|
339
346
|
|
|
340
347
|
// src/clients/DiagnosticsClient.ts
|
|
@@ -514,6 +521,7 @@ var FieldAgentClient = class extends BaseServiceClient {
|
|
|
514
521
|
};
|
|
515
522
|
|
|
516
523
|
// src/clients/MCPClient.ts
|
|
524
|
+
var nextRequestId = 1;
|
|
517
525
|
var MCPClient = class extends BaseServiceClient {
|
|
518
526
|
constructor(http) {
|
|
519
527
|
super(http, "mcp");
|
|
@@ -521,28 +529,75 @@ var MCPClient = class extends BaseServiceClient {
|
|
|
521
529
|
connect() {
|
|
522
530
|
return this.connectService();
|
|
523
531
|
}
|
|
524
|
-
|
|
532
|
+
/**
|
|
533
|
+
* Low-level JSON-RPC 2.0 transport: send any request to one audience.
|
|
534
|
+
* Named `rpc` (not `request`) because `BaseServiceClient.request` is
|
|
535
|
+
* already the generic per-path REST escape hatch with an incompatible
|
|
536
|
+
* signature; this also matches the Python SDK's `MCPClient.rpc(...)`.
|
|
537
|
+
* Prefer `initialize`/`listTools`/`callTool` for the three standard MCP
|
|
538
|
+
* methods — this exists so a newly deployed tool or method can be reached
|
|
539
|
+
* before a generated convenience method catches up.
|
|
540
|
+
*/
|
|
541
|
+
rpc(audience, request) {
|
|
525
542
|
return this.send("POST", `/${audience}`, { body: request });
|
|
526
543
|
}
|
|
527
|
-
/**
|
|
528
|
-
|
|
529
|
-
return this.
|
|
544
|
+
/** `initialize` — negotiates the MCP protocol version and capabilities. */
|
|
545
|
+
initialize(audience) {
|
|
546
|
+
return this.rpc(audience, {
|
|
547
|
+
jsonrpc: "2.0",
|
|
548
|
+
id: nextRequestId++,
|
|
549
|
+
method: "initialize",
|
|
550
|
+
params: {}
|
|
551
|
+
});
|
|
530
552
|
}
|
|
531
|
-
/**
|
|
532
|
-
|
|
533
|
-
|
|
553
|
+
/**
|
|
554
|
+
* `notifications/initialized` — the gateway replies with HTTP 204 (no
|
|
555
|
+
* body) per the JSON-RPC notification convention; `HttpClient` already
|
|
556
|
+
* surfaces a 204 as `undefined`, so this resolves with `void`.
|
|
557
|
+
*/
|
|
558
|
+
async notifyInitialized(audience) {
|
|
559
|
+
await this.send("POST", `/${audience}`, {
|
|
560
|
+
body: { jsonrpc: "2.0", method: "notifications/initialized", params: {} }
|
|
561
|
+
});
|
|
534
562
|
}
|
|
535
|
-
/**
|
|
536
|
-
|
|
537
|
-
return this.
|
|
563
|
+
/** `tools/list` — every tool the gateway serves for this audience. */
|
|
564
|
+
listTools(audience) {
|
|
565
|
+
return this.rpc(audience, {
|
|
566
|
+
jsonrpc: "2.0",
|
|
567
|
+
id: nextRequestId++,
|
|
568
|
+
method: "tools/list",
|
|
569
|
+
params: {}
|
|
570
|
+
});
|
|
538
571
|
}
|
|
539
|
-
/**
|
|
540
|
-
|
|
541
|
-
return this.
|
|
572
|
+
/** `tools/call` — invoke one tool by its exact MCP tool name. */
|
|
573
|
+
callTool(audience, name, args = {}, id = nextRequestId++) {
|
|
574
|
+
return this.rpc(audience, {
|
|
575
|
+
jsonrpc: "2.0",
|
|
576
|
+
id,
|
|
577
|
+
method: "tools/call",
|
|
578
|
+
params: { name, arguments: args }
|
|
579
|
+
});
|
|
542
580
|
}
|
|
543
|
-
/**
|
|
581
|
+
/**
|
|
582
|
+
* @deprecated Prefer `rpc("patient", ...)` or `callTool("patient", ...)`.
|
|
583
|
+
* Kept for backward compatibility; delegates to the generic transport.
|
|
584
|
+
*/
|
|
585
|
+
patient(request) {
|
|
586
|
+
return this.rpc("patient", request);
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* @deprecated Prefer `rpc("fieldagent", ...)` or `callTool("fieldagent", ...)`.
|
|
590
|
+
* Kept for backward compatibility; delegates to the generic transport.
|
|
591
|
+
*/
|
|
592
|
+
fieldAgent(request) {
|
|
593
|
+
return this.rpc("fieldagent", request);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* @deprecated Prefer `rpc("person", ...)` or `callTool("person", ...)`.
|
|
597
|
+
* Kept for backward compatibility; delegates to the generic transport.
|
|
598
|
+
*/
|
|
544
599
|
person(request) {
|
|
545
|
-
return this.
|
|
600
|
+
return this.rpc("person", request);
|
|
546
601
|
}
|
|
547
602
|
};
|
|
548
603
|
|
|
@@ -578,6 +633,36 @@ var PatientClient = class extends BaseServiceClient {
|
|
|
578
633
|
body: request
|
|
579
634
|
});
|
|
580
635
|
}
|
|
636
|
+
/**
|
|
637
|
+
* Get a patient's complete boolean flags dictionary, e.g. `{ imported_vitals: true }`.
|
|
638
|
+
* GET /patients/{id}/flags
|
|
639
|
+
*
|
|
640
|
+
* @param fhirPatientId - The FHIR Patient ID
|
|
641
|
+
* @returns The complete flags dictionary; `{}` if the patient has no flags set.
|
|
642
|
+
*/
|
|
643
|
+
getFlags(fhirPatientId) {
|
|
644
|
+
return this.send("GET", "/patients/{id}/flags", {
|
|
645
|
+
pathParams: { id: fhirPatientId }
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Partially update a patient's boolean flags dictionary.
|
|
650
|
+
* PATCH /patients/{id}/flags
|
|
651
|
+
*
|
|
652
|
+
* This is a merge, not a replace: only the flag names present in `request`
|
|
653
|
+
* are changed, every other existing flag is left unchanged. Setting the
|
|
654
|
+
* same value again is idempotent. Returns the complete flags dictionary
|
|
655
|
+
* after the merge.
|
|
656
|
+
*
|
|
657
|
+
* @param fhirPatientId - The FHIR Patient ID
|
|
658
|
+
* @param request - One or more `{ flagName: boolean }` entries to merge in
|
|
659
|
+
*/
|
|
660
|
+
updateFlags(fhirPatientId, request) {
|
|
661
|
+
return this.send("PATCH", "/patients/{id}/flags", {
|
|
662
|
+
pathParams: { id: fhirPatientId },
|
|
663
|
+
body: request
|
|
664
|
+
});
|
|
665
|
+
}
|
|
581
666
|
getProfile(fhirPatientId) {
|
|
582
667
|
return this.send("GET", "/patients/{id}", {
|
|
583
668
|
pathParams: { id: fhirPatientId }
|
|
@@ -4219,7 +4304,8 @@ var HCSDK = class {
|
|
|
4219
4304
|
this.state = {
|
|
4220
4305
|
environment: config.environment,
|
|
4221
4306
|
tenantId: config.tenantId,
|
|
4222
|
-
accessToken: config.accessToken
|
|
4307
|
+
accessToken: config.accessToken,
|
|
4308
|
+
baseUrlOverrides: config.baseUrlOverrides
|
|
4223
4309
|
};
|
|
4224
4310
|
this.http = new HttpClient(this.state);
|
|
4225
4311
|
this.auth = new AuthClient(
|
|
@@ -4254,6 +4340,11 @@ var HCSDK = class {
|
|
|
4254
4340
|
}
|
|
4255
4341
|
};
|
|
4256
4342
|
|
|
4343
|
+
// src/models/generated/mcp.ts
|
|
4344
|
+
function isJsonRpcError(response) {
|
|
4345
|
+
return "error" in response && response.error !== void 0;
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4257
4348
|
// src/models/generated/operations.ts
|
|
4258
4349
|
var HCSDK_OPERATION_SUMMARY = [
|
|
4259
4350
|
{ service: "patient", method: "GET", path: "/connect", sdkMethod: "patient.connect", summary: "Lambda warm-up / connectivity check" },
|
|
@@ -4381,6 +4472,7 @@ export {
|
|
|
4381
4472
|
ZocdocClient,
|
|
4382
4473
|
ZusClient,
|
|
4383
4474
|
assertEnvironment,
|
|
4475
|
+
isJsonRpcError,
|
|
4384
4476
|
isServiceName,
|
|
4385
4477
|
resolveBaseUrl,
|
|
4386
4478
|
withTenantId
|
package/package.json
CHANGED