@clinia/context-engine-js 0.6.0-rc.2 → 0.7.0-rc.3
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/CHANGELOG.md +10 -0
- package/dist/generated/context-engine.d.ts +108 -38
- package/dist/generated/types.d.ts +2 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/resources/patients.d.ts +32 -3
- package/dist/resources/sessions.d.ts +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @clinia/context-engine-js
|
|
2
2
|
|
|
3
|
+
## 0.7.0-rc.3
|
|
4
|
+
|
|
5
|
+
## 0.6.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- b704c4a: Expose each area of the API as a resource property on `ContextEngineClient` — `client.patients`, `client.ingest`, `client.graph`, `client.sessions`, `client.vfs`, `client.info` — alongside the existing low-level `http` client. The resource classes are exported too, for constructing one on its own.
|
|
10
|
+
|
|
11
|
+
Add `ingest.ingestCdaR2Multipart()`, which submits several CDA documents in one request as `multipart/form-data`. `ingest.ingestCdaR2()` continues to submit a single document as `application/cda+xml`. A route offering more than one request media type now gets one method per media type rather than only its first.
|
|
12
|
+
|
|
3
13
|
## 0.6.0-rc.2
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -32,7 +32,7 @@ export interface paths {
|
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
34
|
* List patients
|
|
35
|
-
* @description Returns
|
|
35
|
+
* @description Returns a page of the patients currently registered, ordered by registry key. An empty page is returned if none have been registered yet. Graph counts are read per patient from the graph endpoints.
|
|
36
36
|
*/
|
|
37
37
|
get: operations["list-patients"];
|
|
38
38
|
put?: never;
|
|
@@ -58,6 +58,8 @@ export interface paths {
|
|
|
58
58
|
/**
|
|
59
59
|
* Upsert patient
|
|
60
60
|
* @description Creates the patient entry if it does not yet exist, or returns the existing record unchanged. Fully idempotent — safe to call before or after the first ingest.
|
|
61
|
+
*
|
|
62
|
+
* New ids are limited to `[A-Za-z0-9][A-Za-z0-9.~:-]{0,127}`, but you can keep referring to previous ids as they were defined.
|
|
61
63
|
*/
|
|
62
64
|
put: operations["upsert-patient"];
|
|
63
65
|
post?: never;
|
|
@@ -80,6 +82,7 @@ export interface paths {
|
|
|
80
82
|
};
|
|
81
83
|
/**
|
|
82
84
|
* Get resolution report
|
|
85
|
+
* @deprecated
|
|
83
86
|
* @description Returns the fact-resolution report for a patient: a paginated list of persisted facts of every fact type with their provenance traces, source contributions, field-level conflict resolutions, and merge confidence scores. Summary counts always cover the full graph, not just the returned page.
|
|
84
87
|
*/
|
|
85
88
|
get: operations["get-resolution"];
|
|
@@ -100,6 +103,7 @@ export interface paths {
|
|
|
100
103
|
};
|
|
101
104
|
/**
|
|
102
105
|
* Get reconciliation summary
|
|
106
|
+
* @deprecated
|
|
103
107
|
* @description Returns the post-pipeline reconciliation summary including entity merge stats and inferred relationships. Defaults to Markdown; pass `?format=json` for structured data.
|
|
104
108
|
*/
|
|
105
109
|
get: operations["get-reconciliation"];
|
|
@@ -248,6 +252,8 @@ export interface paths {
|
|
|
248
252
|
/**
|
|
249
253
|
* Upsert a session
|
|
250
254
|
* @description Idempotently opens a session under a caller-provided id: creates it if new, or returns the existing session unchanged. Sessions track interaction context across multiple MCP tool calls within a single agent run.
|
|
255
|
+
*
|
|
256
|
+
* New ids are limited to `[A-Za-z0-9][A-Za-z0-9.~:-]{0,127}`, but you can keep referring to previous ids as they were defined.
|
|
251
257
|
*/
|
|
252
258
|
put: operations["upsert-session"];
|
|
253
259
|
post?: never;
|
|
@@ -268,7 +274,7 @@ export interface paths {
|
|
|
268
274
|
put?: never;
|
|
269
275
|
/**
|
|
270
276
|
* Append session messages
|
|
271
|
-
* @description Appends user/assistant messages to an open session
|
|
277
|
+
* @description Appends user/assistant messages to an open session, in order. The session stays open. Tool-call turns are recorded separately by the MCP layer and are not accepted here.
|
|
272
278
|
*/
|
|
273
279
|
post: operations["append-messages"];
|
|
274
280
|
delete?: never;
|
|
@@ -311,8 +317,8 @@ export interface paths {
|
|
|
311
317
|
get?: never;
|
|
312
318
|
put?: never;
|
|
313
319
|
/**
|
|
314
|
-
* Ingest a session
|
|
315
|
-
* @description Replays a complete
|
|
320
|
+
* Ingest a complete session
|
|
321
|
+
* @description Replays a complete set of messages as one session: creates the session, appends every message in order, then generates memories from it synchronously, so the response returns only after the patient's memories reflect the conversation. Messages can still be appended to the session. Intended for batch/replay use, not interactive sessions.
|
|
316
322
|
*/
|
|
317
323
|
post: operations["ingest-session"];
|
|
318
324
|
delete?: never;
|
|
@@ -679,29 +685,30 @@ export interface components {
|
|
|
679
685
|
buildDate: string;
|
|
680
686
|
};
|
|
681
687
|
};
|
|
682
|
-
/** @description
|
|
688
|
+
/** @description A page of registered patients. */
|
|
683
689
|
PatientList: {
|
|
684
|
-
/** @description
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
/** @description
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
690
|
+
/** @description The requested page of items. */
|
|
691
|
+
data: {
|
|
692
|
+
/** @description Caller-assigned identifier used in all REST API routes. */
|
|
693
|
+
registryKey: string;
|
|
694
|
+
/** @description Demographic data extracted from the ingested record. Null if no patient resource was found during ingestion. */
|
|
695
|
+
patient: {
|
|
696
|
+
/** @description Internal patient ID extracted from the ingested record (e.g., FHIR Patient.id). Used in VFS paths. */
|
|
697
|
+
id: string;
|
|
698
|
+
/** @description Patient display name extracted from the ingested record. */
|
|
699
|
+
name: string;
|
|
700
|
+
} | null;
|
|
701
|
+
}[];
|
|
702
|
+
/** @description Pagination metadata for the returned page. */
|
|
703
|
+
meta: {
|
|
704
|
+
/** @description Total number of items across all pages. */
|
|
705
|
+
total: number;
|
|
706
|
+
/** @description Zero-indexed page returned in `data`. */
|
|
707
|
+
page: number;
|
|
708
|
+
/** @description Page size used for this response. */
|
|
709
|
+
perPage: number;
|
|
710
|
+
};
|
|
711
|
+
};
|
|
705
712
|
/** @description Demographic metadata and pipeline stats for a single patient. */
|
|
706
713
|
PatientDetail: {
|
|
707
714
|
/** @description Internal patient ID extracted from the ingested record. Used in VFS paths. */
|
|
@@ -838,7 +845,7 @@ export interface components {
|
|
|
838
845
|
patientName: string;
|
|
839
846
|
/** @description Aggregate counts from the reconciliation pass. */
|
|
840
847
|
stats: {
|
|
841
|
-
/** @description Number of
|
|
848
|
+
/** @description Number of extracted entities before resolution. */
|
|
842
849
|
inputEntities: number;
|
|
843
850
|
/** @description Number of entities after resolution (input minus merged duplicates). */
|
|
844
851
|
resolvedEntities: number;
|
|
@@ -924,7 +931,7 @@ export interface components {
|
|
|
924
931
|
/** @description What the submission held. Absent when it was not recorded. */
|
|
925
932
|
IngestionIntake: {
|
|
926
933
|
/**
|
|
927
|
-
* @description The sub-unit of this item: resources in a bundle, sections in a document, messages in a
|
|
934
|
+
* @description The sub-unit of this item: resources in a bundle, sections in a document, messages in a session.
|
|
928
935
|
* @enum {string}
|
|
929
936
|
*/
|
|
930
937
|
unit: "resource" | "section" | "message";
|
|
@@ -984,7 +991,7 @@ export interface components {
|
|
|
984
991
|
perPage: number;
|
|
985
992
|
};
|
|
986
993
|
};
|
|
987
|
-
/** @description
|
|
994
|
+
/** @description One conversation about a patient — a chat, in most calling applications — opened or confirmed by the upsert-session endpoint. */
|
|
988
995
|
Session: {
|
|
989
996
|
/** @description Unique identifier for this session. */
|
|
990
997
|
sessionId: string;
|
|
@@ -1020,7 +1027,7 @@ export interface components {
|
|
|
1020
1027
|
perPage: number;
|
|
1021
1028
|
};
|
|
1022
1029
|
};
|
|
1023
|
-
/** @description A memory extracted from a
|
|
1030
|
+
/** @description A memory extracted from a session's messages. */
|
|
1024
1031
|
SessionMemory: {
|
|
1025
1032
|
/** @description Stable unique identifier for this memory. */
|
|
1026
1033
|
id: string;
|
|
@@ -1031,14 +1038,14 @@ export interface components {
|
|
|
1031
1038
|
type: "symptom" | "adherence" | "concern" | "preference";
|
|
1032
1039
|
/** @description The statement as expressed by or on behalf of the patient. */
|
|
1033
1040
|
content: string;
|
|
1034
|
-
/** @description Id of the
|
|
1041
|
+
/** @description Id of the session that produced this memory. */
|
|
1035
1042
|
sessionId: string;
|
|
1036
1043
|
/** @description ISO 8601 timestamp when this memory was recorded. */
|
|
1037
1044
|
createdAt: string;
|
|
1038
1045
|
};
|
|
1039
|
-
/** @description A complete
|
|
1046
|
+
/** @description A complete set of messages to ingest as a single closed session. */
|
|
1040
1047
|
IngestSessionBody: {
|
|
1041
|
-
/** @description
|
|
1048
|
+
/** @description Every message to replay, in chronological order. */
|
|
1042
1049
|
messages: {
|
|
1043
1050
|
/**
|
|
1044
1051
|
* @description Author of the message.
|
|
@@ -1592,6 +1599,7 @@ export interface components {
|
|
|
1592
1599
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1593
1600
|
extractedFactId: string;
|
|
1594
1601
|
}[];
|
|
1602
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1595
1603
|
} | {
|
|
1596
1604
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1597
1605
|
display: string;
|
|
@@ -1626,6 +1634,7 @@ export interface components {
|
|
|
1626
1634
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1627
1635
|
extractedFactId: string;
|
|
1628
1636
|
}[];
|
|
1637
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1629
1638
|
} | {
|
|
1630
1639
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1631
1640
|
display: string;
|
|
@@ -1665,6 +1674,7 @@ export interface components {
|
|
|
1665
1674
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1666
1675
|
extractedFactId: string;
|
|
1667
1676
|
}[];
|
|
1677
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1668
1678
|
} | {
|
|
1669
1679
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1670
1680
|
display: string;
|
|
@@ -1702,6 +1712,7 @@ export interface components {
|
|
|
1702
1712
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1703
1713
|
extractedFactId: string;
|
|
1704
1714
|
}[];
|
|
1715
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1705
1716
|
} | {
|
|
1706
1717
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1707
1718
|
display: string;
|
|
@@ -1731,6 +1742,7 @@ export interface components {
|
|
|
1731
1742
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1732
1743
|
extractedFactId: string;
|
|
1733
1744
|
}[];
|
|
1745
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1734
1746
|
} | {
|
|
1735
1747
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1736
1748
|
display: string;
|
|
@@ -1763,6 +1775,7 @@ export interface components {
|
|
|
1763
1775
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1764
1776
|
extractedFactId: string;
|
|
1765
1777
|
}[];
|
|
1778
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1766
1779
|
} | {
|
|
1767
1780
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1768
1781
|
display: string;
|
|
@@ -1793,6 +1806,7 @@ export interface components {
|
|
|
1793
1806
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1794
1807
|
extractedFactId: string;
|
|
1795
1808
|
}[];
|
|
1809
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1796
1810
|
} | {
|
|
1797
1811
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1798
1812
|
display: string;
|
|
@@ -1824,6 +1838,7 @@ export interface components {
|
|
|
1824
1838
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1825
1839
|
extractedFactId: string;
|
|
1826
1840
|
}[];
|
|
1841
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1827
1842
|
} | {
|
|
1828
1843
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1829
1844
|
display: string;
|
|
@@ -1858,6 +1873,7 @@ export interface components {
|
|
|
1858
1873
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1859
1874
|
extractedFactId: string;
|
|
1860
1875
|
}[];
|
|
1876
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1861
1877
|
} | {
|
|
1862
1878
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
1863
1879
|
display: string;
|
|
@@ -1890,6 +1906,7 @@ export interface components {
|
|
|
1890
1906
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
1891
1907
|
extractedFactId: string;
|
|
1892
1908
|
}[];
|
|
1909
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
1893
1910
|
};
|
|
1894
1911
|
} | {
|
|
1895
1912
|
/** @enum {string} */
|
|
@@ -2018,7 +2035,7 @@ export interface components {
|
|
|
2018
2035
|
type: "symptom" | "adherence" | "concern" | "preference";
|
|
2019
2036
|
/** @description The statement as expressed by or on behalf of the patient. */
|
|
2020
2037
|
content: string;
|
|
2021
|
-
/** @description Provenance: the id of the
|
|
2038
|
+
/** @description Provenance: the id of the session that produced this memory. */
|
|
2022
2039
|
sessionId: string;
|
|
2023
2040
|
};
|
|
2024
2041
|
} | {
|
|
@@ -2242,6 +2259,26 @@ export interface components {
|
|
|
2242
2259
|
};
|
|
2243
2260
|
};
|
|
2244
2261
|
};
|
|
2262
|
+
/** @description One verdict per field decided across the members, keyed by the field it settled. A field every member agreed on still carries a verdict, with an empty `conflict`. */
|
|
2263
|
+
FactConflicts: {
|
|
2264
|
+
[key: string]: {
|
|
2265
|
+
picked: components["schemas"]["ScoredFactMember"];
|
|
2266
|
+
/** @description Members that carried the same value as the picked one. */
|
|
2267
|
+
agreed: components["schemas"]["ScoredFactMember"][];
|
|
2268
|
+
/** @description Members that carried a different value. */
|
|
2269
|
+
conflict: (components["schemas"]["ScoredFactMember"] & {
|
|
2270
|
+
/** @description The value this member lost the field with — null when it carried nothing. Untyped: its type is the field's own. */
|
|
2271
|
+
value?: unknown;
|
|
2272
|
+
})[];
|
|
2273
|
+
};
|
|
2274
|
+
};
|
|
2275
|
+
/** @description One member of a fact's cluster, as a field's verdict names it. */
|
|
2276
|
+
ScoredFactMember: {
|
|
2277
|
+
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
2278
|
+
extractedFactId: string;
|
|
2279
|
+
/** @description Score this member was ranked with when the field was decided. */
|
|
2280
|
+
score: number;
|
|
2281
|
+
};
|
|
2245
2282
|
/** @description A page of nodes of one type from the patient context graph. */
|
|
2246
2283
|
NodeList: {
|
|
2247
2284
|
/** @description The requested page of items. */
|
|
@@ -3047,6 +3084,7 @@ export interface components {
|
|
|
3047
3084
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3048
3085
|
extractedFactId: string;
|
|
3049
3086
|
}[];
|
|
3087
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3050
3088
|
} | {
|
|
3051
3089
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3052
3090
|
display: string;
|
|
@@ -3081,6 +3119,7 @@ export interface components {
|
|
|
3081
3119
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3082
3120
|
extractedFactId: string;
|
|
3083
3121
|
}[];
|
|
3122
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3084
3123
|
} | {
|
|
3085
3124
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3086
3125
|
display: string;
|
|
@@ -3120,6 +3159,7 @@ export interface components {
|
|
|
3120
3159
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3121
3160
|
extractedFactId: string;
|
|
3122
3161
|
}[];
|
|
3162
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3123
3163
|
} | {
|
|
3124
3164
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3125
3165
|
display: string;
|
|
@@ -3157,6 +3197,7 @@ export interface components {
|
|
|
3157
3197
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3158
3198
|
extractedFactId: string;
|
|
3159
3199
|
}[];
|
|
3200
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3160
3201
|
} | {
|
|
3161
3202
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3162
3203
|
display: string;
|
|
@@ -3186,6 +3227,7 @@ export interface components {
|
|
|
3186
3227
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3187
3228
|
extractedFactId: string;
|
|
3188
3229
|
}[];
|
|
3230
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3189
3231
|
} | {
|
|
3190
3232
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3191
3233
|
display: string;
|
|
@@ -3218,6 +3260,7 @@ export interface components {
|
|
|
3218
3260
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3219
3261
|
extractedFactId: string;
|
|
3220
3262
|
}[];
|
|
3263
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3221
3264
|
} | {
|
|
3222
3265
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3223
3266
|
display: string;
|
|
@@ -3248,6 +3291,7 @@ export interface components {
|
|
|
3248
3291
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3249
3292
|
extractedFactId: string;
|
|
3250
3293
|
}[];
|
|
3294
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3251
3295
|
} | {
|
|
3252
3296
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3253
3297
|
display: string;
|
|
@@ -3279,6 +3323,7 @@ export interface components {
|
|
|
3279
3323
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3280
3324
|
extractedFactId: string;
|
|
3281
3325
|
}[];
|
|
3326
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3282
3327
|
} | {
|
|
3283
3328
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3284
3329
|
display: string;
|
|
@@ -3313,6 +3358,7 @@ export interface components {
|
|
|
3313
3358
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3314
3359
|
extractedFactId: string;
|
|
3315
3360
|
}[];
|
|
3361
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3316
3362
|
} | {
|
|
3317
3363
|
/** @description Human-readable label — condition name, drug name, vaccine name, etc. */
|
|
3318
3364
|
display: string;
|
|
@@ -3345,6 +3391,7 @@ export interface components {
|
|
|
3345
3391
|
/** @description Id of the `extracted_fact` node this member traces to (`ef_...`). */
|
|
3346
3392
|
extractedFactId: string;
|
|
3347
3393
|
}[];
|
|
3394
|
+
fieldVerdicts: components["schemas"]["FactConflicts"];
|
|
3348
3395
|
};
|
|
3349
3396
|
}[];
|
|
3350
3397
|
/** @description Pagination metadata for the returned page. */
|
|
@@ -3529,7 +3576,7 @@ export interface components {
|
|
|
3529
3576
|
type: "symptom" | "adherence" | "concern" | "preference";
|
|
3530
3577
|
/** @description The statement as expressed by or on behalf of the patient. */
|
|
3531
3578
|
content: string;
|
|
3532
|
-
/** @description Provenance: the id of the
|
|
3579
|
+
/** @description Provenance: the id of the session that produced this memory. */
|
|
3533
3580
|
sessionId: string;
|
|
3534
3581
|
};
|
|
3535
3582
|
}[];
|
|
@@ -4099,14 +4146,19 @@ export interface operations {
|
|
|
4099
4146
|
};
|
|
4100
4147
|
"list-patients": {
|
|
4101
4148
|
parameters: {
|
|
4102
|
-
query?:
|
|
4149
|
+
query?: {
|
|
4150
|
+
/** @description Zero-indexed page of patients to return. Defaults to 0. */
|
|
4151
|
+
page?: number | null;
|
|
4152
|
+
/** @description Number of patients per page. Defaults to 100; maximum is 1000. */
|
|
4153
|
+
perPage?: number;
|
|
4154
|
+
};
|
|
4103
4155
|
header?: never;
|
|
4104
4156
|
path?: never;
|
|
4105
4157
|
cookie?: never;
|
|
4106
4158
|
};
|
|
4107
4159
|
requestBody?: never;
|
|
4108
4160
|
responses: {
|
|
4109
|
-
/** @description
|
|
4161
|
+
/** @description A page of registered patients */
|
|
4110
4162
|
200: {
|
|
4111
4163
|
headers: {
|
|
4112
4164
|
[name: string]: unknown;
|
|
@@ -4170,6 +4222,15 @@ export interface operations {
|
|
|
4170
4222
|
"application/json": components["schemas"]["Patient"];
|
|
4171
4223
|
};
|
|
4172
4224
|
};
|
|
4225
|
+
/** @description Patient id is not usable for a new patient. */
|
|
4226
|
+
400: {
|
|
4227
|
+
headers: {
|
|
4228
|
+
[name: string]: unknown;
|
|
4229
|
+
};
|
|
4230
|
+
content: {
|
|
4231
|
+
"application/json": components["schemas"]["ApiError"];
|
|
4232
|
+
};
|
|
4233
|
+
};
|
|
4173
4234
|
};
|
|
4174
4235
|
};
|
|
4175
4236
|
"delete-patient": {
|
|
@@ -4609,6 +4670,15 @@ export interface operations {
|
|
|
4609
4670
|
"application/json": components["schemas"]["Session"];
|
|
4610
4671
|
};
|
|
4611
4672
|
};
|
|
4673
|
+
/** @description Session id is not usable for a new session. */
|
|
4674
|
+
400: {
|
|
4675
|
+
headers: {
|
|
4676
|
+
[name: string]: unknown;
|
|
4677
|
+
};
|
|
4678
|
+
content: {
|
|
4679
|
+
"application/json": components["schemas"]["ApiError"];
|
|
4680
|
+
};
|
|
4681
|
+
};
|
|
4612
4682
|
/** @description Patient not found or no data ingested */
|
|
4613
4683
|
404: {
|
|
4614
4684
|
headers: {
|
|
@@ -5520,7 +5590,7 @@ export interface operations {
|
|
|
5520
5590
|
*/
|
|
5521
5591
|
eq: "symptom" | "adherence" | "concern" | "preference";
|
|
5522
5592
|
};
|
|
5523
|
-
/** @description Restrict to memories extracted from this
|
|
5593
|
+
/** @description Restrict to memories extracted from this session. */
|
|
5524
5594
|
sessionId?: {
|
|
5525
5595
|
/** @description Matches exactly this value. */
|
|
5526
5596
|
eq: string;
|
|
@@ -23,6 +23,8 @@ export type IngestSessionBody = components["schemas"]["IngestSessionBody"];
|
|
|
23
23
|
export type BrowseResult = components["schemas"]["BrowseResult"];
|
|
24
24
|
export type ReadResponse = components["schemas"]["ReadResponse"];
|
|
25
25
|
export type Node = components["schemas"]["Node"];
|
|
26
|
+
export type FactConflicts = components["schemas"]["FactConflicts"];
|
|
27
|
+
export type ScoredFactMember = components["schemas"]["ScoredFactMember"];
|
|
26
28
|
export type NodeList = components["schemas"]["NodeList"];
|
|
27
29
|
export type Edge = components["schemas"]["Edge"];
|
|
28
30
|
export type NodeRef = components["schemas"]["NodeRef"];
|
package/dist/index.js
CHANGED
|
@@ -163,12 +163,15 @@ var PatientsResource = class {
|
|
|
163
163
|
constructor(http) {
|
|
164
164
|
this.#http = http;
|
|
165
165
|
}
|
|
166
|
-
listPatients() {
|
|
167
|
-
return this.#http.GET("/v1/patients", void 0);
|
|
166
|
+
listPatients(params) {
|
|
167
|
+
return this.#http.GET("/v1/patients", params ? { params } : void 0);
|
|
168
168
|
}
|
|
169
169
|
getPatient(patientId) {
|
|
170
170
|
return this.#http.GET("/v1/patients/{patientId}", { params: { path: { patientId } } });
|
|
171
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* @deprecated This endpoint will be removed in a future release.
|
|
174
|
+
*/
|
|
172
175
|
getResolution(patientId, params) {
|
|
173
176
|
return this.#http.GET("/v1/patients/{patientId}/resolution", {
|
|
174
177
|
params: {
|
|
@@ -177,6 +180,9 @@ var PatientsResource = class {
|
|
|
177
180
|
}
|
|
178
181
|
});
|
|
179
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* @deprecated This endpoint will be removed in a future release.
|
|
185
|
+
*/
|
|
180
186
|
getReconciliation(patientId, params) {
|
|
181
187
|
return this.#http.GET("/v1/patients/{patientId}/reconciliation", {
|
|
182
188
|
params: {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/auth.ts","../src/http-client.ts","../src/resources/info.ts","../src/resources/patients.ts","../src/form-data.ts","../src/resources/ingest.ts","../src/resources/sessions.ts","../src/resources/vfs.ts","../src/resources/graph.ts","../src/resources/index.ts","../src/context-engine-client.ts"],"sourcesContent":["import * as oauth from \"oauth4webapi\";\n\n/**\n * OAuth2 client-credentials helpers for authenticating against a secured\n * Context Engine workspace.\n *\n * The server validates a bearer JWT in the `Authorization` header against a\n * JWKS. This module provides the client half: a token provider that exchanges\n * a `client_id`/`client_secret` for an access token, caches it, and refreshes\n * it before expiry. The token exchange itself is delegated to `oauth4webapi`\n * (standards-compliant request building + response validation); this module\n * only adds caching, concurrent-request de-duplication, and a small config\n * surface. Pass the raw config as {@link HttpClientOptions.auth}, or — for full\n * control — pass the returned provider as the {@link HttpClientOptions.auth}\n * token function.\n */\n\n/**\n * Resolves to a currently-valid bearer access token. Called per request; a\n * well-behaved provider caches internally and only hits the network when the\n * cached token is missing or about to expire.\n */\nexport type TokenProvider = () => Promise<string>;\n\n/**\n * Clinia's authorization server, applied when a config names neither a\n * `tokenUrl` nor an `issuer` — so `{ clientId, clientSecret }` is a complete\n * config for a Clinia workspace, which is the overwhelmingly common case.\n *\n * `RESOURCE` is only defaulted alongside `TOKEN_URL`: it is an RFC 8707\n * indicator naming Clinia's protected resource, and sending it to somebody\n * else's authorization server would be wrong.\n */\nconst CLINIA_OAUTH_TOKEN_URL = \"https://console.clinia.cloud/api/auth/oauth2/token\";\nconst CLINIA_OAUTH_RESOURCE = \"https://console.clinia.cloud\";\n\n/** Fields common to both ways of locating the authorization server. */\ntype ClientCredentialsBase = {\n clientId: string;\n clientSecret: string;\n /**\n * Optional `resource` indicator (RFC 8707) naming the protected resource the\n * token is for. This is what the Clinia authorization server expects (e.g.\n * `https://console.clinia.cloud`).\n */\n resource?: string;\n /** Optional `audience` parameter (used by some IdPs, e.g. Auth0). */\n audience?: string;\n /** Optional space-delimited `scope`. */\n scope?: string;\n /**\n * How the client credentials are presented to the token endpoint. `post`\n * (the default) sends them in the request body — what the Clinia\n * authorization server expects; `basic` sends them in the `Authorization`\n * header (RFC 6749 §2.3.1) for IdPs that require it.\n */\n authMethod?: \"basic\" | \"post\";\n /**\n * Custom fetch implementation. Defaults to `globalThis.fetch`. Useful for\n * injecting a mock in tests.\n */\n fetch?: typeof globalThis.fetch;\n /**\n * Refresh the token this many milliseconds before it actually expires, to\n * avoid handing out a token that expires mid-flight. Defaults to 60_000.\n */\n expiryMarginMs?: number;\n};\n\n/**\n * Client-credentials configuration.\n *\n * For a Clinia workspace, `{ clientId, clientSecret }` is enough — the token\n * endpoint and `resource` indicator default to Clinia's authorization server.\n * Naming an {@link issuer} instead locates a different authorization server by\n * OIDC/OAuth2 discovery; naming a {@link tokenUrl} points at one explicitly.\n */\nexport type ClientCredentialsConfig =\n | (ClientCredentialsBase & {\n /**\n * Issuer identifier of the authorization server. Its metadata (token\n * endpoint, etc.) is resolved via discovery on first use.\n */\n issuer: string;\n /** Discovery transformation: `oidc` (default) or `oauth2` (RFC 8414). */\n discoveryAlgorithm?: \"oidc\" | \"oauth2\";\n tokenUrl?: never;\n })\n | (ClientCredentialsBase & {\n /**\n * Explicit OAuth2 token endpoint; discovery is skipped. Omit it — along\n * with `issuer` — to use Clinia's.\n */\n tokenUrl?: string;\n /** Issuer identifier for response validation; defaults to the token URL's origin. */\n issuer?: string;\n discoveryAlgorithm?: never;\n });\n\nconst DEFAULT_EXPIRY_MARGIN_MS = 60_000;\n/** Fallback lifetime when the token endpoint omits `expires_in`. */\nconst DEFAULT_TTL_MS = 5 * 60_000;\n\n/** Turns an `oauth4webapi` failure into a concise, stable error message. */\nfunction describeOAuthError(err: unknown): string {\n if (err instanceof oauth.ResponseBodyError) {\n return `${err.status} ${err.error}${err.error_description ? ` — ${err.error_description}` : \"\"}`;\n }\n if (err instanceof oauth.WWWAuthenticateChallengeError) {\n return `${err.status} ${err.message}`;\n }\n return err instanceof Error ? err.message : String(err);\n}\n\n/**\n * Builds a {@link TokenProvider} backed by the OAuth2 client-credentials grant.\n *\n * The provider caches the access token and reuses it until it is within\n * `expiryMarginMs` of expiry. Concurrent calls while a fetch is in flight share\n * the same request rather than each hitting the token endpoint. When configured\n * with an {@link ClientCredentialsConfig.issuer}, the authorization server\n * metadata is discovered once and memoized.\n */\nexport function createClientCredentialsTokenProvider(\n config: ClientCredentialsConfig,\n): TokenProvider {\n const expiryMarginMs = config.expiryMarginMs ?? DEFAULT_EXPIRY_MARGIN_MS;\n\n // Defaulted only when the token endpoint is also defaulted. `resource` names\n // Clinia's protected resource, so attaching it to a request aimed at somebody\n // else's authorization server would be both wrong and a small disclosure.\n const usesCliniaAuthServer = !config.tokenUrl && !config.issuer;\n const resource = config.resource ?? (usesCliniaAuthServer ? CLINIA_OAUTH_RESOURCE : undefined);\n\n const client: oauth.Client = { client_id: config.clientId };\n const clientAuth =\n config.authMethod === \"basic\"\n ? oauth.ClientSecretBasic(config.clientSecret)\n : oauth.ClientSecretPost(config.clientSecret);\n\n // Shared HTTP options (custom fetch + insecure opt-in) applied to every\n // oauth4webapi call. The `as never` bridges the customFetch signature, which\n // is generic over method/body per call site but is the same fn at runtime.\n // oauth4webapi rejects non-TLS endpoints by default; we relax that per call\n // when — and only when — the target URL is itself `http://` (local dev),\n // rather than exposing a separate flag.\n const fetchImpl = config.fetch;\n const isInsecure = (url: string | undefined): boolean =>\n !!url && new URL(url).protocol === \"http:\";\n function withHttpOptions<T extends object>(opts: T, insecure: boolean): T {\n const o = opts as T & {\n [oauth.customFetch]?: unknown;\n [oauth.allowInsecureRequests]?: boolean;\n };\n if (fetchImpl) {\n o[oauth.customFetch] = ((url: string, options: RequestInit) =>\n fetchImpl(url, options)) as never;\n }\n if (insecure) o[oauth.allowInsecureRequests] = true;\n return o;\n }\n\n // Authorization server metadata, resolved once. For an explicit tokenUrl it's\n // synchronous; for an issuer it requires a discovery request, so it's async\n // and memoized (with retry on failure — a rejected attempt isn't cached).\n let resolvedAs: oauth.AuthorizationServer | null = null;\n let asInFlight: Promise<oauth.AuthorizationServer> | null = null;\n\n async function resolveAuthServer(): Promise<oauth.AuthorizationServer> {\n // Discovery only when an issuer is named and no explicit endpoint overrides\n // it. There is no \"neither given\" case left to handle — that is the Clinia\n // default, which is why this no longer throws.\n if (!config.issuer || config.tokenUrl) {\n const tokenUrl = config.tokenUrl ?? CLINIA_OAUTH_TOKEN_URL;\n return {\n issuer: config.issuer ?? new URL(tokenUrl).origin,\n token_endpoint: tokenUrl,\n };\n }\n const issuerUrl = new URL(config.issuer);\n const response = await oauth.discoveryRequest(\n issuerUrl,\n withHttpOptions<oauth.DiscoveryRequestOptions>(\n { algorithm: config.discoveryAlgorithm ?? \"oidc\" },\n isInsecure(config.issuer),\n ),\n );\n return oauth.processDiscoveryResponse(issuerUrl, response);\n }\n\n function getAuthServer(): Promise<oauth.AuthorizationServer> {\n if (resolvedAs) return Promise.resolve(resolvedAs);\n if (!asInFlight) {\n asInFlight = resolveAuthServer()\n .then((as) => (resolvedAs = as))\n .finally(() => {\n asInFlight = null;\n });\n }\n return asInFlight;\n }\n\n let cachedToken: string | null = null;\n /** Absolute epoch ms at which the cached token should be considered stale. */\n let expiresAt = 0;\n /** In-flight fetch, shared across concurrent callers to dedupe requests. */\n let inFlight: Promise<string> | null = null;\n\n async function fetchToken(): Promise<string> {\n const params = new URLSearchParams();\n if (resource) params.set(\"resource\", resource);\n if (config.audience) params.set(\"audience\", config.audience);\n if (config.scope) params.set(\"scope\", config.scope);\n\n let result: oauth.TokenEndpointResponse;\n try {\n const as = await getAuthServer();\n const response = await oauth.clientCredentialsGrantRequest(\n as,\n client,\n clientAuth,\n params,\n withHttpOptions<oauth.ClientCredentialsGrantRequestOptions>(\n {},\n isInsecure(as.token_endpoint),\n ),\n );\n result = await oauth.processClientCredentialsResponse(as, client, response);\n } catch (err) {\n throw new Error(`client_credentials token request failed: ${describeOAuthError(err)}`, {\n cause: err,\n });\n }\n\n const ttlMs = result.expires_in ? result.expires_in * 1000 : DEFAULT_TTL_MS;\n cachedToken = result.access_token;\n expiresAt = Date.now() + Math.max(0, ttlMs - expiryMarginMs);\n return cachedToken;\n }\n\n return async function getAccessToken(): Promise<string> {\n if (cachedToken && Date.now() < expiresAt) return cachedToken;\n if (inFlight) return inFlight;\n\n inFlight = fetchToken().finally(() => {\n inFlight = null;\n });\n return inFlight;\n };\n}\n","import createFetchClient, { type Client, type Middleware } from \"openapi-fetch\";\n\nimport { createClientCredentialsTokenProvider, type ClientCredentialsConfig } from \"./auth\";\nimport type { paths } from \"./generated/context-engine\";\n\nexport type HttpClientOptions = {\n baseUrl: string;\n /**\n * Custom fetch implementation. Defaults to `globalThis.fetch`.\n * Works in Node 20+ and all modern browsers out of the box.\n * Useful for injecting a mock or a custom fetch in tests.\n */\n fetch?: typeof globalThis.fetch;\n /**\n * How to authenticate against a secured Context Engine server. Accepts either\n * shape:\n *\n * - A {@link ClientCredentialsConfig} — the common case. Pass just your OAuth2\n * client credentials and the client sets up token acquisition, caching, and\n * refresh for you.\n * - A token function `() => string | Promise<string>` — the escape hatch for\n * full control (a token from elsewhere, a different grant, or a custom\n * refresh strategy). Called per request, so a provider can cache and refresh\n * internally (e.g. {@link createClientCredentialsTokenProvider}); a falsy\n * return value leaves the header unset.\n *\n * Either way the resolved token is attached as `Authorization: Bearer <token>`\n * on every request. Omit for an unsecured server.\n */\n auth?: ClientCredentialsConfig | (() => string | Promise<string>);\n};\n\nexport class HttpClient {\n readonly #client: Client<paths>;\n\n constructor(options: HttpClientOptions) {\n this.#client = createFetchClient<paths>({\n baseUrl: options.baseUrl,\n fetch: options.fetch,\n });\n\n // A token function is used as-is; a config object builds a client-credentials\n // provider. The custom `fetch` is threaded into the token exchange too so\n // tests/proxies apply to both hops.\n const getAccessToken =\n typeof options.auth === \"function\"\n ? options.auth\n : options.auth\n ? createClientCredentialsTokenProvider({ fetch: options.fetch, ...options.auth })\n : undefined;\n\n if (getAccessToken) {\n const authMiddleware: Middleware = {\n async onRequest({ request }) {\n const token = await getAccessToken();\n if (token) request.headers.set(\"Authorization\", `Bearer ${token}`);\n return request;\n },\n };\n this.#client.use(authMiddleware);\n }\n }\n\n get GET(): Client<paths>[\"GET\"] {\n return this.#client.GET;\n }\n\n get POST(): Client<paths>[\"POST\"] {\n return this.#client.POST;\n }\n\n get PUT(): Client<paths>[\"PUT\"] {\n return this.#client.PUT;\n }\n\n get PATCH(): Client<paths>[\"PATCH\"] {\n return this.#client.PATCH;\n }\n\n get DELETE(): Client<paths>[\"DELETE\"] {\n return this.#client.DELETE;\n }\n\n use(...middleware: Middleware[]): this {\n this.#client.use(...middleware);\n return this;\n }\n\n eject(...middleware: Middleware[]): this {\n this.#client.eject(...middleware);\n return this;\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\n\nexport class InfoResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n getServiceInfo() {\n return this.#http.GET(\"/\", undefined);\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\n\nexport class PatientsResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n listPatients() {\n return this.#http.GET(\"/v1/patients\", undefined);\n }\n\n getPatient(patientId: string) {\n return this.#http.GET(\"/v1/patients/{patientId}\", { params: { path: { patientId } } });\n }\n\n getResolution(patientId: string, params?: { query?: { page?: number; perPage?: number } }) {\n return this.#http.GET(\"/v1/patients/{patientId}/resolution\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n getReconciliation(patientId: string, params?: { query?: { format?: \"json\" | \"markdown\" } }) {\n return this.#http.GET(\"/v1/patients/{patientId}/reconciliation\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n deletePatient(patientId: string) {\n return this.#http.DELETE(\"/v1/patients/{patientId}\", { params: { path: { patientId } } });\n }\n\n upsertPatient(patientId: string) {\n return this.#http.PUT(\"/v1/patients/{patientId}\", { params: { path: { patientId } } });\n }\n}\n","/**\n * A `multipart/form-data` request body, built from the object form of the schema.\n *\n * An array-valued field becomes one part per item under the same field name — how a schema\n * declaring an array of items is sent — and every other field becomes a single part. A field\n * left `undefined` or `null` is omitted rather than sent as the string `\"undefined\"` or `\"null\"`.\n *\n * Values are appended as given, so a string is sent as text and a `Blob` or `File` keeps the\n * filename and content type it was created with.\n *\n * No `Content-Type` is set anywhere: the header carries the multipart boundary, which only\n * the runtime sending the request can know.\n */\nexport function toFormData(body: unknown): FormData {\n const form = new FormData();\n if (body === null || typeof body !== \"object\") return form;\n\n for (const [field, value] of Object.entries(body)) {\n if (value === undefined || value === null) continue;\n for (const part of Array.isArray(value) ? value : [value]) {\n form.append(field, part as string | Blob);\n }\n }\n return form;\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\nimport { toFormData } from \"../form-data\";\nimport type { operations } from \"../generated/context-engine\";\nimport type { IngestFhirBody } from \"../generated/types\";\n\nexport class IngestResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n listIngestions(\n patientId: string,\n params?: {\n query?: {\n page?: number;\n perPage?: number;\n sort?: \"receivedAt\";\n order?: \"asc\" | \"desc\";\n status?: (\"pending\" | \"processing\" | \"succeeded\" | \"partial\" | \"failed\")[];\n };\n },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/ingestions\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n getIngestion(patientId: string, ingestionId: string) {\n return this.#http.GET(\"/v1/patients/{patientId}/ingestions/{ingestionId}\", {\n params: { path: { patientId, ingestionId } },\n });\n }\n\n ingestFhirR4(patientId: string, body: IngestFhirBody) {\n return this.#http.POST(\"/v1/patients/{patientId}/ingestions/fhir/r4\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n ingestFhirR5(patientId: string, body: IngestFhirBody) {\n return this.#http.POST(\"/v1/patients/{patientId}/ingestions/fhir/r5\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n ingestCdaR2(\n patientId: string,\n body: NonNullable<operations[\"ingest-cda-r2\"][\"requestBody\"]>[\"content\"][\"application/cda+xml\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/ingestions/cda/r2\", {\n params: { path: { patientId } },\n body,\n bodySerializer: (b: unknown) => (typeof b === \"string\" ? b : JSON.stringify(b)),\n headers: { \"Content-Type\": \"application/cda+xml\" },\n });\n }\n\n ingestCdaR2Multipart(\n patientId: string,\n body: NonNullable<operations[\"ingest-cda-r2\"][\"requestBody\"]>[\"content\"][\"multipart/form-data\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/ingestions/cda/r2\", {\n params: { path: { patientId } },\n body,\n bodySerializer: (b: unknown) => toFormData(b),\n });\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\nimport type { AppendMessagesBody, IngestSessionBody } from \"../generated/types\";\n\nexport class SessionsResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n listSessionMemories(\n patientId: string,\n sessionId: string,\n params?: {\n query?: { page?: number; perPage?: number; sort?: \"createdAt\"; order?: \"asc\" | \"desc\" };\n },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/sessions/{sessionId}/memories\", {\n params: {\n path: { patientId, sessionId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n createSession(patientId: string) {\n return this.#http.POST(\"/v1/patients/{patientId}/sessions\", {\n params: { path: { patientId } },\n });\n }\n\n getSession(patientId: string, sessionId: string) {\n return this.#http.GET(\"/v1/patients/{patientId}/sessions/{sessionId}\", {\n params: { path: { patientId, sessionId } },\n });\n }\n\n upsertSession(patientId: string, sessionId: string) {\n return this.#http.PUT(\"/v1/patients/{patientId}/sessions/{sessionId}\", {\n params: { path: { patientId, sessionId } },\n });\n }\n\n appendMessages(patientId: string, sessionId: string, body: AppendMessagesBody) {\n return this.#http.POST(\"/v1/patients/{patientId}/sessions/{sessionId}/messages\", {\n params: { path: { patientId, sessionId } },\n body,\n });\n }\n\n generateMemories(patientId: string, sessionId: string) {\n return this.#http.POST(\"/v1/patients/{patientId}/sessions/{sessionId}/memories\", {\n params: { path: { patientId, sessionId } },\n });\n }\n\n ingestSession(patientId: string, body: IngestSessionBody) {\n return this.#http.POST(\"/v1/patients/{patientId}/sessions/ingest\", {\n params: { path: { patientId } },\n body,\n });\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\n\nexport class VFSResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n browseVfs(patientId: string, params?: { query?: { path?: string } }) {\n return this.#http.GET(\"/v1/patients/{patientId}/vfs\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n readVfs(\n patientId: string,\n params?: {\n query?: {\n path?: string;\n format?: \"narrative\" | \"structured\" | \"compact\";\n token_budget?: number;\n };\n },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/read\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\nimport type { operations } from \"../generated/context-engine\";\n\nexport class GraphResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n listNodes(\n patientId: string,\n type:\n | \"extracted_fact\"\n | \"fact\"\n | \"extracted_narrative\"\n | \"narrative_passage\"\n | \"narrative\"\n | \"learned_memory\"\n | \"extracted_clinical_event\",\n params?: { query?: { page?: number; perPage?: number } },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/graph/nodes/{type}/items\", {\n params: {\n path: { patientId, type },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n listEdges(\n patientId: string,\n type: \"resolution_decision\" | \"resolves_to\" | \"chunked_into\" | \"relationship\",\n params?: { query?: { page?: number; perPage?: number; touching?: string | string[] } },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/graph/edges/{type}/items\", {\n params: {\n path: { patientId, type },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n getNode(\n patientId: string,\n type:\n | \"extracted_fact\"\n | \"fact\"\n | \"extracted_narrative\"\n | \"narrative_passage\"\n | \"narrative\"\n | \"learned_memory\"\n | \"extracted_clinical_event\",\n nodeId: string,\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/graph/nodes/{type}/items/{nodeId}\", {\n params: { path: { patientId, type, nodeId } },\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n getEdge(\n patientId: string,\n type: \"resolution_decision\" | \"resolves_to\" | \"chunked_into\" | \"relationship\",\n edgeId: string,\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/graph/edges/{type}/items/{edgeId}\", {\n params: { path: { patientId, type, edgeId } },\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryExtractedFactNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-extracted-fact-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/extracted_fact/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryFactNodes(\n patientId: string,\n body: NonNullable<operations[\"query-fact-nodes\"][\"requestBody\"]>[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/fact/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryExtractedNarrativeNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-extracted-narrative-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/extracted_narrative/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryNarrativePassageNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-narrative-passage-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/narrative_passage/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryNarrativeNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-narrative-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/narrative/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryLearnedMemoryNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-learned-memory-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/learned_memory/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryExtractedClinicalEventNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-extracted-clinical-event-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/extracted_clinical_event/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryResolutionDecisionEdges(\n patientId: string,\n body: NonNullable<\n operations[\"query-resolution-decision-edges\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/edges/resolution_decision/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryResolvesToEdges(\n patientId: string,\n body: NonNullable<\n operations[\"query-resolves-to-edges\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/edges/resolves_to/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryChunkedIntoEdges(\n patientId: string,\n body: NonNullable<\n operations[\"query-chunked-into-edges\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/edges/chunked_into/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryRelationshipEdges(\n patientId: string,\n body: NonNullable<\n operations[\"query-relationship-edges\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/edges/relationship/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\nimport { InfoResource } from \"./info\";\nimport { PatientsResource } from \"./patients\";\nimport { IngestResource } from \"./ingest\";\nimport { SessionsResource } from \"./sessions\";\nimport { VFSResource } from \"./vfs\";\nimport { GraphResource } from \"./graph\";\n\nexport { InfoResource } from \"./info\";\nexport { PatientsResource } from \"./patients\";\nexport { IngestResource } from \"./ingest\";\nexport { SessionsResource } from \"./sessions\";\nexport { VFSResource } from \"./vfs\";\nexport { GraphResource } from \"./graph\";\n\n/** Every resource, under the property it takes on `ContextEngineClient`. */\nexport interface Resources {\n readonly info: InfoResource;\n readonly patients: PatientsResource;\n readonly ingest: IngestResource;\n readonly sessions: SessionsResource;\n readonly vfs: VFSResource;\n readonly graph: GraphResource;\n}\n\n/**\n * Build one of each resource over a shared http client.\n *\n * Generated alongside the classes, so a new tag in the spec lands here on its own and\n * `ContextEngineClient` fails to compile until it names the new property.\n */\nexport function createResources(http: HttpClient): Resources {\n return {\n info: new InfoResource(http),\n patients: new PatientsResource(http),\n ingest: new IngestResource(http),\n sessions: new SessionsResource(http),\n vfs: new VFSResource(http),\n graph: new GraphResource(http),\n };\n}\n","import { HttpClient, type HttpClientOptions } from \"./http-client\";\nimport {\n createResources,\n GraphResource,\n InfoResource,\n IngestResource,\n PatientsResource,\n SessionsResource,\n VFSResource,\n type Resources,\n} from \"./resources\";\n\nexport type ContextEngineClientOptions = HttpClientOptions;\n\n/**\n * Client for the Clinia Context Engine API.\n *\n * Each area of the API is a resource property — `client.patients`, `client.ingest`,\n * `client.graph` — and `http` stays available underneath for anything a resource method does\n * not cover. Every resource shares that one http client, so authentication is configured once.\n *\n * `implements Resources` is what keeps this list honest: the resources are generated from the\n * API spec, and a new one is a compile error here until it is named.\n */\nexport class ContextEngineClient implements Resources {\n /**\n * Low-level http client. Use when a resource method does not cover your use case.\n */\n readonly http: HttpClient;\n\n readonly info: InfoResource;\n readonly patients: PatientsResource;\n readonly ingest: IngestResource;\n readonly sessions: SessionsResource;\n readonly vfs: VFSResource;\n readonly graph: GraphResource;\n\n constructor(options: ContextEngineClientOptions) {\n this.http = new HttpClient(options);\n\n const resources = createResources(this.http);\n this.info = resources.info;\n this.patients = resources.patients;\n this.ingest = resources.ingest;\n this.sessions = resources.sessions;\n this.vfs = resources.vfs;\n this.graph = resources.graph;\n }\n}\n"],"mappings":";AAAA,YAAY,WAAW;AAiCvB,IAAM,yBAAyB;AAC/B,IAAM,wBAAwB;AAiE9B,IAAM,2BAA2B;AAEjC,IAAM,iBAAiB,IAAI;AAG3B,SAAS,mBAAmB,KAAsB;AAChD,MAAI,eAAqB,yBAAmB;AAC1C,WAAO,GAAG,IAAI,MAAM,IAAI,IAAI,KAAK,GAAG,IAAI,oBAAoB,WAAM,IAAI,iBAAiB,KAAK,EAAE;AAAA,EAChG;AACA,MAAI,eAAqB,qCAA+B;AACtD,WAAO,GAAG,IAAI,MAAM,IAAI,IAAI,OAAO;AAAA,EACrC;AACA,SAAO,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AACxD;AAWO,SAAS,qCACd,QACe;AACf,QAAM,iBAAiB,OAAO,kBAAkB;AAKhD,QAAM,uBAAuB,CAAC,OAAO,YAAY,CAAC,OAAO;AACzD,QAAM,WAAW,OAAO,aAAa,uBAAuB,wBAAwB;AAEpF,QAAM,SAAuB,EAAE,WAAW,OAAO,SAAS;AAC1D,QAAM,aACJ,OAAO,eAAe,UACZ,wBAAkB,OAAO,YAAY,IACrC,uBAAiB,OAAO,YAAY;AAQhD,QAAM,YAAY,OAAO;AACzB,QAAM,aAAa,CAAC,QAClB,CAAC,CAAC,OAAO,IAAI,IAAI,GAAG,EAAE,aAAa;AACrC,WAAS,gBAAkC,MAAS,UAAsB;AACxE,UAAM,IAAI;AAIV,QAAI,WAAW;AACb,QAAQ,iBAAW,KAAK,CAAC,KAAa,YACpC,UAAU,KAAK,OAAO;AAAA,IAC1B;AACA,QAAI,SAAU,GAAQ,2BAAqB,IAAI;AAC/C,WAAO;AAAA,EACT;AAKA,MAAI,aAA+C;AACnD,MAAI,aAAwD;AAE5D,iBAAe,oBAAwD;AAIrE,QAAI,CAAC,OAAO,UAAU,OAAO,UAAU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AAM,UAAU;AACrB,SAAK,QAAQ,UAAU;AAAA,EACzB;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/auth.ts","../src/http-client.ts","../src/resources/info.ts","../src/resources/patients.ts","../src/form-data.ts","../src/resources/ingest.ts","../src/resources/sessions.ts","../src/resources/vfs.ts","../src/resources/graph.ts","../src/resources/index.ts","../src/context-engine-client.ts"],"sourcesContent":["import * as oauth from \"oauth4webapi\";\n\n/**\n * OAuth2 client-credentials helpers for authenticating against a secured\n * Context Engine workspace.\n *\n * The server validates a bearer JWT in the `Authorization` header against a\n * JWKS. This module provides the client half: a token provider that exchanges\n * a `client_id`/`client_secret` for an access token, caches it, and refreshes\n * it before expiry. The token exchange itself is delegated to `oauth4webapi`\n * (standards-compliant request building + response validation); this module\n * only adds caching, concurrent-request de-duplication, and a small config\n * surface. Pass the raw config as {@link HttpClientOptions.auth}, or — for full\n * control — pass the returned provider as the {@link HttpClientOptions.auth}\n * token function.\n */\n\n/**\n * Resolves to a currently-valid bearer access token. Called per request; a\n * well-behaved provider caches internally and only hits the network when the\n * cached token is missing or about to expire.\n */\nexport type TokenProvider = () => Promise<string>;\n\n/**\n * Clinia's authorization server, applied when a config names neither a\n * `tokenUrl` nor an `issuer` — so `{ clientId, clientSecret }` is a complete\n * config for a Clinia workspace, which is the overwhelmingly common case.\n *\n * `RESOURCE` is only defaulted alongside `TOKEN_URL`: it is an RFC 8707\n * indicator naming Clinia's protected resource, and sending it to somebody\n * else's authorization server would be wrong.\n */\nconst CLINIA_OAUTH_TOKEN_URL = \"https://console.clinia.cloud/api/auth/oauth2/token\";\nconst CLINIA_OAUTH_RESOURCE = \"https://console.clinia.cloud\";\n\n/** Fields common to both ways of locating the authorization server. */\ntype ClientCredentialsBase = {\n clientId: string;\n clientSecret: string;\n /**\n * Optional `resource` indicator (RFC 8707) naming the protected resource the\n * token is for. This is what the Clinia authorization server expects (e.g.\n * `https://console.clinia.cloud`).\n */\n resource?: string;\n /** Optional `audience` parameter (used by some IdPs, e.g. Auth0). */\n audience?: string;\n /** Optional space-delimited `scope`. */\n scope?: string;\n /**\n * How the client credentials are presented to the token endpoint. `post`\n * (the default) sends them in the request body — what the Clinia\n * authorization server expects; `basic` sends them in the `Authorization`\n * header (RFC 6749 §2.3.1) for IdPs that require it.\n */\n authMethod?: \"basic\" | \"post\";\n /**\n * Custom fetch implementation. Defaults to `globalThis.fetch`. Useful for\n * injecting a mock in tests.\n */\n fetch?: typeof globalThis.fetch;\n /**\n * Refresh the token this many milliseconds before it actually expires, to\n * avoid handing out a token that expires mid-flight. Defaults to 60_000.\n */\n expiryMarginMs?: number;\n};\n\n/**\n * Client-credentials configuration.\n *\n * For a Clinia workspace, `{ clientId, clientSecret }` is enough — the token\n * endpoint and `resource` indicator default to Clinia's authorization server.\n * Naming an {@link issuer} instead locates a different authorization server by\n * OIDC/OAuth2 discovery; naming a {@link tokenUrl} points at one explicitly.\n */\nexport type ClientCredentialsConfig =\n | (ClientCredentialsBase & {\n /**\n * Issuer identifier of the authorization server. Its metadata (token\n * endpoint, etc.) is resolved via discovery on first use.\n */\n issuer: string;\n /** Discovery transformation: `oidc` (default) or `oauth2` (RFC 8414). */\n discoveryAlgorithm?: \"oidc\" | \"oauth2\";\n tokenUrl?: never;\n })\n | (ClientCredentialsBase & {\n /**\n * Explicit OAuth2 token endpoint; discovery is skipped. Omit it — along\n * with `issuer` — to use Clinia's.\n */\n tokenUrl?: string;\n /** Issuer identifier for response validation; defaults to the token URL's origin. */\n issuer?: string;\n discoveryAlgorithm?: never;\n });\n\nconst DEFAULT_EXPIRY_MARGIN_MS = 60_000;\n/** Fallback lifetime when the token endpoint omits `expires_in`. */\nconst DEFAULT_TTL_MS = 5 * 60_000;\n\n/** Turns an `oauth4webapi` failure into a concise, stable error message. */\nfunction describeOAuthError(err: unknown): string {\n if (err instanceof oauth.ResponseBodyError) {\n return `${err.status} ${err.error}${err.error_description ? ` — ${err.error_description}` : \"\"}`;\n }\n if (err instanceof oauth.WWWAuthenticateChallengeError) {\n return `${err.status} ${err.message}`;\n }\n return err instanceof Error ? err.message : String(err);\n}\n\n/**\n * Builds a {@link TokenProvider} backed by the OAuth2 client-credentials grant.\n *\n * The provider caches the access token and reuses it until it is within\n * `expiryMarginMs` of expiry. Concurrent calls while a fetch is in flight share\n * the same request rather than each hitting the token endpoint. When configured\n * with an {@link ClientCredentialsConfig.issuer}, the authorization server\n * metadata is discovered once and memoized.\n */\nexport function createClientCredentialsTokenProvider(\n config: ClientCredentialsConfig,\n): TokenProvider {\n const expiryMarginMs = config.expiryMarginMs ?? DEFAULT_EXPIRY_MARGIN_MS;\n\n // Defaulted only when the token endpoint is also defaulted. `resource` names\n // Clinia's protected resource, so attaching it to a request aimed at somebody\n // else's authorization server would be both wrong and a small disclosure.\n const usesCliniaAuthServer = !config.tokenUrl && !config.issuer;\n const resource = config.resource ?? (usesCliniaAuthServer ? CLINIA_OAUTH_RESOURCE : undefined);\n\n const client: oauth.Client = { client_id: config.clientId };\n const clientAuth =\n config.authMethod === \"basic\"\n ? oauth.ClientSecretBasic(config.clientSecret)\n : oauth.ClientSecretPost(config.clientSecret);\n\n // Shared HTTP options (custom fetch + insecure opt-in) applied to every\n // oauth4webapi call. The `as never` bridges the customFetch signature, which\n // is generic over method/body per call site but is the same fn at runtime.\n // oauth4webapi rejects non-TLS endpoints by default; we relax that per call\n // when — and only when — the target URL is itself `http://` (local dev),\n // rather than exposing a separate flag.\n const fetchImpl = config.fetch;\n const isInsecure = (url: string | undefined): boolean =>\n !!url && new URL(url).protocol === \"http:\";\n function withHttpOptions<T extends object>(opts: T, insecure: boolean): T {\n const o = opts as T & {\n [oauth.customFetch]?: unknown;\n [oauth.allowInsecureRequests]?: boolean;\n };\n if (fetchImpl) {\n o[oauth.customFetch] = ((url: string, options: RequestInit) =>\n fetchImpl(url, options)) as never;\n }\n if (insecure) o[oauth.allowInsecureRequests] = true;\n return o;\n }\n\n // Authorization server metadata, resolved once. For an explicit tokenUrl it's\n // synchronous; for an issuer it requires a discovery request, so it's async\n // and memoized (with retry on failure — a rejected attempt isn't cached).\n let resolvedAs: oauth.AuthorizationServer | null = null;\n let asInFlight: Promise<oauth.AuthorizationServer> | null = null;\n\n async function resolveAuthServer(): Promise<oauth.AuthorizationServer> {\n // Discovery only when an issuer is named and no explicit endpoint overrides\n // it. There is no \"neither given\" case left to handle — that is the Clinia\n // default, which is why this no longer throws.\n if (!config.issuer || config.tokenUrl) {\n const tokenUrl = config.tokenUrl ?? CLINIA_OAUTH_TOKEN_URL;\n return {\n issuer: config.issuer ?? new URL(tokenUrl).origin,\n token_endpoint: tokenUrl,\n };\n }\n const issuerUrl = new URL(config.issuer);\n const response = await oauth.discoveryRequest(\n issuerUrl,\n withHttpOptions<oauth.DiscoveryRequestOptions>(\n { algorithm: config.discoveryAlgorithm ?? \"oidc\" },\n isInsecure(config.issuer),\n ),\n );\n return oauth.processDiscoveryResponse(issuerUrl, response);\n }\n\n function getAuthServer(): Promise<oauth.AuthorizationServer> {\n if (resolvedAs) return Promise.resolve(resolvedAs);\n if (!asInFlight) {\n asInFlight = resolveAuthServer()\n .then((as) => (resolvedAs = as))\n .finally(() => {\n asInFlight = null;\n });\n }\n return asInFlight;\n }\n\n let cachedToken: string | null = null;\n /** Absolute epoch ms at which the cached token should be considered stale. */\n let expiresAt = 0;\n /** In-flight fetch, shared across concurrent callers to dedupe requests. */\n let inFlight: Promise<string> | null = null;\n\n async function fetchToken(): Promise<string> {\n const params = new URLSearchParams();\n if (resource) params.set(\"resource\", resource);\n if (config.audience) params.set(\"audience\", config.audience);\n if (config.scope) params.set(\"scope\", config.scope);\n\n let result: oauth.TokenEndpointResponse;\n try {\n const as = await getAuthServer();\n const response = await oauth.clientCredentialsGrantRequest(\n as,\n client,\n clientAuth,\n params,\n withHttpOptions<oauth.ClientCredentialsGrantRequestOptions>(\n {},\n isInsecure(as.token_endpoint),\n ),\n );\n result = await oauth.processClientCredentialsResponse(as, client, response);\n } catch (err) {\n throw new Error(`client_credentials token request failed: ${describeOAuthError(err)}`, {\n cause: err,\n });\n }\n\n const ttlMs = result.expires_in ? result.expires_in * 1000 : DEFAULT_TTL_MS;\n cachedToken = result.access_token;\n expiresAt = Date.now() + Math.max(0, ttlMs - expiryMarginMs);\n return cachedToken;\n }\n\n return async function getAccessToken(): Promise<string> {\n if (cachedToken && Date.now() < expiresAt) return cachedToken;\n if (inFlight) return inFlight;\n\n inFlight = fetchToken().finally(() => {\n inFlight = null;\n });\n return inFlight;\n };\n}\n","import createFetchClient, { type Client, type Middleware } from \"openapi-fetch\";\n\nimport { createClientCredentialsTokenProvider, type ClientCredentialsConfig } from \"./auth\";\nimport type { paths } from \"./generated/context-engine\";\n\nexport type HttpClientOptions = {\n baseUrl: string;\n /**\n * Custom fetch implementation. Defaults to `globalThis.fetch`.\n * Works in Node 20+ and all modern browsers out of the box.\n * Useful for injecting a mock or a custom fetch in tests.\n */\n fetch?: typeof globalThis.fetch;\n /**\n * How to authenticate against a secured Context Engine server. Accepts either\n * shape:\n *\n * - A {@link ClientCredentialsConfig} — the common case. Pass just your OAuth2\n * client credentials and the client sets up token acquisition, caching, and\n * refresh for you.\n * - A token function `() => string | Promise<string>` — the escape hatch for\n * full control (a token from elsewhere, a different grant, or a custom\n * refresh strategy). Called per request, so a provider can cache and refresh\n * internally (e.g. {@link createClientCredentialsTokenProvider}); a falsy\n * return value leaves the header unset.\n *\n * Either way the resolved token is attached as `Authorization: Bearer <token>`\n * on every request. Omit for an unsecured server.\n */\n auth?: ClientCredentialsConfig | (() => string | Promise<string>);\n};\n\nexport class HttpClient {\n readonly #client: Client<paths>;\n\n constructor(options: HttpClientOptions) {\n this.#client = createFetchClient<paths>({\n baseUrl: options.baseUrl,\n fetch: options.fetch,\n });\n\n // A token function is used as-is; a config object builds a client-credentials\n // provider. The custom `fetch` is threaded into the token exchange too so\n // tests/proxies apply to both hops.\n const getAccessToken =\n typeof options.auth === \"function\"\n ? options.auth\n : options.auth\n ? createClientCredentialsTokenProvider({ fetch: options.fetch, ...options.auth })\n : undefined;\n\n if (getAccessToken) {\n const authMiddleware: Middleware = {\n async onRequest({ request }) {\n const token = await getAccessToken();\n if (token) request.headers.set(\"Authorization\", `Bearer ${token}`);\n return request;\n },\n };\n this.#client.use(authMiddleware);\n }\n }\n\n get GET(): Client<paths>[\"GET\"] {\n return this.#client.GET;\n }\n\n get POST(): Client<paths>[\"POST\"] {\n return this.#client.POST;\n }\n\n get PUT(): Client<paths>[\"PUT\"] {\n return this.#client.PUT;\n }\n\n get PATCH(): Client<paths>[\"PATCH\"] {\n return this.#client.PATCH;\n }\n\n get DELETE(): Client<paths>[\"DELETE\"] {\n return this.#client.DELETE;\n }\n\n use(...middleware: Middleware[]): this {\n this.#client.use(...middleware);\n return this;\n }\n\n eject(...middleware: Middleware[]): this {\n this.#client.eject(...middleware);\n return this;\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\n\nexport class InfoResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n getServiceInfo() {\n return this.#http.GET(\"/\", undefined);\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\n\nexport class PatientsResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n listPatients(params?: { query?: { page?: number; perPage?: number } }) {\n return this.#http.GET(\"/v1/patients\", params ? { params } : undefined);\n }\n\n getPatient(patientId: string) {\n return this.#http.GET(\"/v1/patients/{patientId}\", { params: { path: { patientId } } });\n }\n\n /**\n * @deprecated This endpoint will be removed in a future release.\n */\n getResolution(patientId: string, params?: { query?: { page?: number; perPage?: number } }) {\n return this.#http.GET(\"/v1/patients/{patientId}/resolution\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n /**\n * @deprecated This endpoint will be removed in a future release.\n */\n getReconciliation(patientId: string, params?: { query?: { format?: \"json\" | \"markdown\" } }) {\n return this.#http.GET(\"/v1/patients/{patientId}/reconciliation\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n deletePatient(patientId: string) {\n return this.#http.DELETE(\"/v1/patients/{patientId}\", { params: { path: { patientId } } });\n }\n\n upsertPatient(patientId: string) {\n return this.#http.PUT(\"/v1/patients/{patientId}\", { params: { path: { patientId } } });\n }\n}\n","/**\n * A `multipart/form-data` request body, built from the object form of the schema.\n *\n * An array-valued field becomes one part per item under the same field name — how a schema\n * declaring an array of items is sent — and every other field becomes a single part. A field\n * left `undefined` or `null` is omitted rather than sent as the string `\"undefined\"` or `\"null\"`.\n *\n * Values are appended as given, so a string is sent as text and a `Blob` or `File` keeps the\n * filename and content type it was created with.\n *\n * No `Content-Type` is set anywhere: the header carries the multipart boundary, which only\n * the runtime sending the request can know.\n */\nexport function toFormData(body: unknown): FormData {\n const form = new FormData();\n if (body === null || typeof body !== \"object\") return form;\n\n for (const [field, value] of Object.entries(body)) {\n if (value === undefined || value === null) continue;\n for (const part of Array.isArray(value) ? value : [value]) {\n form.append(field, part as string | Blob);\n }\n }\n return form;\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\nimport { toFormData } from \"../form-data\";\nimport type { operations } from \"../generated/context-engine\";\nimport type { IngestFhirBody } from \"../generated/types\";\n\nexport class IngestResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n listIngestions(\n patientId: string,\n params?: {\n query?: {\n page?: number;\n perPage?: number;\n sort?: \"receivedAt\";\n order?: \"asc\" | \"desc\";\n status?: (\"pending\" | \"processing\" | \"succeeded\" | \"partial\" | \"failed\")[];\n };\n },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/ingestions\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n getIngestion(patientId: string, ingestionId: string) {\n return this.#http.GET(\"/v1/patients/{patientId}/ingestions/{ingestionId}\", {\n params: { path: { patientId, ingestionId } },\n });\n }\n\n ingestFhirR4(patientId: string, body: IngestFhirBody) {\n return this.#http.POST(\"/v1/patients/{patientId}/ingestions/fhir/r4\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n ingestFhirR5(patientId: string, body: IngestFhirBody) {\n return this.#http.POST(\"/v1/patients/{patientId}/ingestions/fhir/r5\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n ingestCdaR2(\n patientId: string,\n body: NonNullable<operations[\"ingest-cda-r2\"][\"requestBody\"]>[\"content\"][\"application/cda+xml\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/ingestions/cda/r2\", {\n params: { path: { patientId } },\n body,\n bodySerializer: (b: unknown) => (typeof b === \"string\" ? b : JSON.stringify(b)),\n headers: { \"Content-Type\": \"application/cda+xml\" },\n });\n }\n\n ingestCdaR2Multipart(\n patientId: string,\n body: NonNullable<operations[\"ingest-cda-r2\"][\"requestBody\"]>[\"content\"][\"multipart/form-data\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/ingestions/cda/r2\", {\n params: { path: { patientId } },\n body,\n bodySerializer: (b: unknown) => toFormData(b),\n });\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\nimport type { AppendMessagesBody, IngestSessionBody } from \"../generated/types\";\n\nexport class SessionsResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n listSessionMemories(\n patientId: string,\n sessionId: string,\n params?: {\n query?: { page?: number; perPage?: number; sort?: \"createdAt\"; order?: \"asc\" | \"desc\" };\n },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/sessions/{sessionId}/memories\", {\n params: {\n path: { patientId, sessionId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n createSession(patientId: string) {\n return this.#http.POST(\"/v1/patients/{patientId}/sessions\", {\n params: { path: { patientId } },\n });\n }\n\n getSession(patientId: string, sessionId: string) {\n return this.#http.GET(\"/v1/patients/{patientId}/sessions/{sessionId}\", {\n params: { path: { patientId, sessionId } },\n });\n }\n\n upsertSession(patientId: string, sessionId: string) {\n return this.#http.PUT(\"/v1/patients/{patientId}/sessions/{sessionId}\", {\n params: { path: { patientId, sessionId } },\n });\n }\n\n appendMessages(patientId: string, sessionId: string, body: AppendMessagesBody) {\n return this.#http.POST(\"/v1/patients/{patientId}/sessions/{sessionId}/messages\", {\n params: { path: { patientId, sessionId } },\n body,\n });\n }\n\n generateMemories(patientId: string, sessionId: string) {\n return this.#http.POST(\"/v1/patients/{patientId}/sessions/{sessionId}/memories\", {\n params: { path: { patientId, sessionId } },\n });\n }\n\n ingestSession(patientId: string, body: IngestSessionBody) {\n return this.#http.POST(\"/v1/patients/{patientId}/sessions/ingest\", {\n params: { path: { patientId } },\n body,\n });\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\n\nexport class VFSResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n browseVfs(patientId: string, params?: { query?: { path?: string } }) {\n return this.#http.GET(\"/v1/patients/{patientId}/vfs\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n readVfs(\n patientId: string,\n params?: {\n query?: {\n path?: string;\n format?: \"narrative\" | \"structured\" | \"compact\";\n token_budget?: number;\n };\n },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/read\", {\n params: {\n path: { patientId },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\nimport type { operations } from \"../generated/context-engine\";\n\nexport class GraphResource {\n readonly #http: HttpClient;\n\n constructor(http: HttpClient) {\n this.#http = http;\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n listNodes(\n patientId: string,\n type:\n | \"extracted_fact\"\n | \"fact\"\n | \"extracted_narrative\"\n | \"narrative_passage\"\n | \"narrative\"\n | \"learned_memory\"\n | \"extracted_clinical_event\",\n params?: { query?: { page?: number; perPage?: number } },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/graph/nodes/{type}/items\", {\n params: {\n path: { patientId, type },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n listEdges(\n patientId: string,\n type: \"resolution_decision\" | \"resolves_to\" | \"chunked_into\" | \"relationship\",\n params?: { query?: { page?: number; perPage?: number; touching?: string | string[] } },\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/graph/edges/{type}/items\", {\n params: {\n path: { patientId, type },\n ...(params?.query !== undefined ? { query: params.query } : {}),\n },\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n getNode(\n patientId: string,\n type:\n | \"extracted_fact\"\n | \"fact\"\n | \"extracted_narrative\"\n | \"narrative_passage\"\n | \"narrative\"\n | \"learned_memory\"\n | \"extracted_clinical_event\",\n nodeId: string,\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/graph/nodes/{type}/items/{nodeId}\", {\n params: { path: { patientId, type, nodeId } },\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n getEdge(\n patientId: string,\n type: \"resolution_decision\" | \"resolves_to\" | \"chunked_into\" | \"relationship\",\n edgeId: string,\n ) {\n return this.#http.GET(\"/v1/patients/{patientId}/graph/edges/{type}/items/{edgeId}\", {\n params: { path: { patientId, type, edgeId } },\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryExtractedFactNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-extracted-fact-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/extracted_fact/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryFactNodes(\n patientId: string,\n body: NonNullable<operations[\"query-fact-nodes\"][\"requestBody\"]>[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/fact/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryExtractedNarrativeNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-extracted-narrative-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/extracted_narrative/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryNarrativePassageNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-narrative-passage-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/narrative_passage/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryNarrativeNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-narrative-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/narrative/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryLearnedMemoryNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-learned-memory-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/learned_memory/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryExtractedClinicalEventNodes(\n patientId: string,\n body: NonNullable<\n operations[\"query-extracted-clinical-event-nodes\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/nodes/extracted_clinical_event/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryResolutionDecisionEdges(\n patientId: string,\n body: NonNullable<\n operations[\"query-resolution-decision-edges\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/edges/resolution_decision/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryResolvesToEdges(\n patientId: string,\n body: NonNullable<\n operations[\"query-resolves-to-edges\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/edges/resolves_to/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryChunkedIntoEdges(\n patientId: string,\n body: NonNullable<\n operations[\"query-chunked-into-edges\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/edges/chunked_into/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n\n /**\n * Technical preview.\n *\n * @experimental\n */\n queryRelationshipEdges(\n patientId: string,\n body: NonNullable<\n operations[\"query-relationship-edges\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) {\n return this.#http.POST(\"/v1/patients/{patientId}/graph/edges/relationship/query\", {\n params: { path: { patientId } },\n body,\n });\n }\n}\n","// This file is auto-generated. Do not edit manually.\n// Re-generate by running: pnpm generate\n\nimport type { HttpClient } from \"../http-client\";\nimport { InfoResource } from \"./info\";\nimport { PatientsResource } from \"./patients\";\nimport { IngestResource } from \"./ingest\";\nimport { SessionsResource } from \"./sessions\";\nimport { VFSResource } from \"./vfs\";\nimport { GraphResource } from \"./graph\";\n\nexport { InfoResource } from \"./info\";\nexport { PatientsResource } from \"./patients\";\nexport { IngestResource } from \"./ingest\";\nexport { SessionsResource } from \"./sessions\";\nexport { VFSResource } from \"./vfs\";\nexport { GraphResource } from \"./graph\";\n\n/** Every resource, under the property it takes on `ContextEngineClient`. */\nexport interface Resources {\n readonly info: InfoResource;\n readonly patients: PatientsResource;\n readonly ingest: IngestResource;\n readonly sessions: SessionsResource;\n readonly vfs: VFSResource;\n readonly graph: GraphResource;\n}\n\n/**\n * Build one of each resource over a shared http client.\n *\n * Generated alongside the classes, so a new tag in the spec lands here on its own and\n * `ContextEngineClient` fails to compile until it names the new property.\n */\nexport function createResources(http: HttpClient): Resources {\n return {\n info: new InfoResource(http),\n patients: new PatientsResource(http),\n ingest: new IngestResource(http),\n sessions: new SessionsResource(http),\n vfs: new VFSResource(http),\n graph: new GraphResource(http),\n };\n}\n","import { HttpClient, type HttpClientOptions } from \"./http-client\";\nimport {\n createResources,\n GraphResource,\n InfoResource,\n IngestResource,\n PatientsResource,\n SessionsResource,\n VFSResource,\n type Resources,\n} from \"./resources\";\n\nexport type ContextEngineClientOptions = HttpClientOptions;\n\n/**\n * Client for the Clinia Context Engine API.\n *\n * Each area of the API is a resource property — `client.patients`, `client.ingest`,\n * `client.graph` — and `http` stays available underneath for anything a resource method does\n * not cover. Every resource shares that one http client, so authentication is configured once.\n *\n * `implements Resources` is what keeps this list honest: the resources are generated from the\n * API spec, and a new one is a compile error here until it is named.\n */\nexport class ContextEngineClient implements Resources {\n /**\n * Low-level http client. Use when a resource method does not cover your use case.\n */\n readonly http: HttpClient;\n\n readonly info: InfoResource;\n readonly patients: PatientsResource;\n readonly ingest: IngestResource;\n readonly sessions: SessionsResource;\n readonly vfs: VFSResource;\n readonly graph: GraphResource;\n\n constructor(options: ContextEngineClientOptions) {\n this.http = new HttpClient(options);\n\n const resources = createResources(this.http);\n this.info = resources.info;\n this.patients = resources.patients;\n this.ingest = resources.ingest;\n this.sessions = resources.sessions;\n this.vfs = resources.vfs;\n this.graph = resources.graph;\n }\n}\n"],"mapp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AAAA,EACzB;AACF;","names":[]}
|
|
@@ -2,9 +2,17 @@ import type { HttpClient } from "../http-client";
|
|
|
2
2
|
export declare class PatientsResource {
|
|
3
3
|
#private;
|
|
4
4
|
constructor(http: HttpClient);
|
|
5
|
-
listPatients(
|
|
5
|
+
listPatients(params?: {
|
|
6
|
+
query?: {
|
|
7
|
+
page?: number;
|
|
8
|
+
perPage?: number;
|
|
9
|
+
};
|
|
10
|
+
}): Promise<import("openapi-fetch").FetchResponse<{
|
|
6
11
|
parameters: {
|
|
7
|
-
query?:
|
|
12
|
+
query?: {
|
|
13
|
+
page?: number | null;
|
|
14
|
+
perPage?: number;
|
|
15
|
+
};
|
|
8
16
|
header?: never;
|
|
9
17
|
path?: never;
|
|
10
18
|
cookie?: never;
|
|
@@ -20,7 +28,14 @@ export declare class PatientsResource {
|
|
|
20
28
|
};
|
|
21
29
|
};
|
|
22
30
|
};
|
|
23
|
-
},
|
|
31
|
+
}, {
|
|
32
|
+
params: {
|
|
33
|
+
query?: {
|
|
34
|
+
page?: number;
|
|
35
|
+
perPage?: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
} | undefined, `${string}/${string}`>>;
|
|
24
39
|
getPatient(patientId: string): Promise<import("openapi-fetch").FetchResponse<{
|
|
25
40
|
parameters: {
|
|
26
41
|
query?: never;
|
|
@@ -56,6 +71,9 @@ export declare class PatientsResource {
|
|
|
56
71
|
};
|
|
57
72
|
};
|
|
58
73
|
}, `${string}/${string}`>>;
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated This endpoint will be removed in a future release.
|
|
76
|
+
*/
|
|
59
77
|
getResolution(patientId: string, params?: {
|
|
60
78
|
query?: {
|
|
61
79
|
page?: number;
|
|
@@ -103,6 +121,9 @@ export declare class PatientsResource {
|
|
|
103
121
|
};
|
|
104
122
|
};
|
|
105
123
|
}, `${string}/${string}`>>;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated This endpoint will be removed in a future release.
|
|
126
|
+
*/
|
|
106
127
|
getReconciliation(patientId: string, params?: {
|
|
107
128
|
query?: {
|
|
108
129
|
format?: "json" | "markdown";
|
|
@@ -200,6 +221,14 @@ export declare class PatientsResource {
|
|
|
200
221
|
"application/json": import("..").components["schemas"]["Patient"];
|
|
201
222
|
};
|
|
202
223
|
};
|
|
224
|
+
400: {
|
|
225
|
+
headers: {
|
|
226
|
+
[name: string]: unknown;
|
|
227
|
+
};
|
|
228
|
+
content: {
|
|
229
|
+
"application/json": import("..").components["schemas"]["ApiError"];
|
|
230
|
+
};
|
|
231
|
+
};
|
|
203
232
|
};
|
|
204
233
|
}, {
|
|
205
234
|
params: {
|
|
@@ -158,6 +158,14 @@ export declare class SessionsResource {
|
|
|
158
158
|
"application/json": import("..").components["schemas"]["Session"];
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
|
+
400: {
|
|
162
|
+
headers: {
|
|
163
|
+
[name: string]: unknown;
|
|
164
|
+
};
|
|
165
|
+
content: {
|
|
166
|
+
"application/json": import("..").components["schemas"]["ApiError"];
|
|
167
|
+
};
|
|
168
|
+
};
|
|
161
169
|
404: {
|
|
162
170
|
headers: {
|
|
163
171
|
[name: string]: unknown;
|