@clinia/context-engine-js 0.6.0-rc.1 → 0.6.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.
@@ -1,6 +1,29 @@
1
+ import type { HttpClient } from "../http-client";
2
+ import { InfoResource } from "./info";
3
+ import { PatientsResource } from "./patients";
4
+ import { IngestResource } from "./ingest";
5
+ import { SessionsResource } from "./sessions";
6
+ import { VFSResource } from "./vfs";
7
+ import { GraphResource } from "./graph";
1
8
  export { InfoResource } from "./info";
2
9
  export { PatientsResource } from "./patients";
3
10
  export { IngestResource } from "./ingest";
4
11
  export { SessionsResource } from "./sessions";
5
12
  export { VFSResource } from "./vfs";
6
13
  export { GraphResource } from "./graph";
14
+ /** Every resource, under the property it takes on `ContextEngineClient`. */
15
+ export interface Resources {
16
+ readonly info: InfoResource;
17
+ readonly patients: PatientsResource;
18
+ readonly ingest: IngestResource;
19
+ readonly sessions: SessionsResource;
20
+ readonly vfs: VFSResource;
21
+ readonly graph: GraphResource;
22
+ }
23
+ /**
24
+ * Build one of each resource over a shared http client.
25
+ *
26
+ * Generated alongside the classes, so a new tag in the spec lands here on its own and
27
+ * `ContextEngineClient` fails to compile until it names the new property.
28
+ */
29
+ export declare function createResources(http: HttpClient): Resources;
@@ -1,48 +1,9 @@
1
1
  import type { HttpClient } from "../http-client";
2
2
  import type { operations } from "../generated/context-engine";
3
- import type { IngestDocumentBody, IngestBatchBody, IngestFhirBody } from "../generated/types";
3
+ import type { IngestFhirBody } from "../generated/types";
4
4
  export declare class IngestResource {
5
5
  #private;
6
6
  constructor(http: HttpClient);
7
- listExecutions(patientId: string, params?: {
8
- query?: {
9
- limit?: number;
10
- cursor?: number;
11
- };
12
- }): Promise<import("openapi-fetch").FetchResponse<{
13
- parameters: {
14
- query?: {
15
- limit?: number;
16
- cursor?: number | null;
17
- };
18
- header?: never;
19
- path: {
20
- patientId: string;
21
- };
22
- cookie?: never;
23
- };
24
- requestBody?: never;
25
- responses: {
26
- 200: {
27
- headers: {
28
- [name: string]: unknown;
29
- };
30
- content: {
31
- "application/json": import("..").components["schemas"]["IngestExecutionList"];
32
- };
33
- };
34
- };
35
- }, {
36
- params: {
37
- query?: {
38
- limit?: number;
39
- cursor?: number;
40
- } | undefined;
41
- path: {
42
- patientId: string;
43
- };
44
- };
45
- }, `${string}/${string}`>>;
46
7
  listIngestions(patientId: string, params?: {
47
8
  query?: {
48
9
  page?: number;
@@ -91,70 +52,6 @@ export declare class IngestResource {
91
52
  };
92
53
  };
93
54
  }, `${string}/${string}`>>;
94
- getIngestStatus(patientId: string): Promise<import("openapi-fetch").FetchResponse<{
95
- parameters: {
96
- query?: never;
97
- header?: never;
98
- path: {
99
- patientId: string;
100
- };
101
- cookie?: never;
102
- };
103
- requestBody?: never;
104
- responses: {
105
- 200: {
106
- headers: {
107
- [name: string]: unknown;
108
- };
109
- content: {
110
- "application/json": import("..").components["schemas"]["IngestStatusResponse"];
111
- };
112
- };
113
- };
114
- }, {
115
- params: {
116
- path: {
117
- patientId: string;
118
- };
119
- };
120
- }, `${string}/${string}`>>;
121
- getExecution(patientId: string, executionId: string): Promise<import("openapi-fetch").FetchResponse<{
122
- parameters: {
123
- query?: never;
124
- header?: never;
125
- path: {
126
- patientId: string;
127
- executionId: string;
128
- };
129
- cookie?: never;
130
- };
131
- requestBody?: never;
132
- responses: {
133
- 200: {
134
- headers: {
135
- [name: string]: unknown;
136
- };
137
- content: {
138
- "application/json": import("..").components["schemas"]["IngestExecutionDetail"];
139
- };
140
- };
141
- 404: {
142
- headers: {
143
- [name: string]: unknown;
144
- };
145
- content: {
146
- "application/json": import("..").components["schemas"]["ApiError"];
147
- };
148
- };
149
- };
150
- }, {
151
- params: {
152
- path: {
153
- patientId: string;
154
- executionId: string;
155
- };
156
- };
157
- }, `${string}/${string}`>>;
158
55
  getIngestion(patientId: string, ingestionId: string): Promise<import("openapi-fetch").FetchResponse<{
159
56
  parameters: {
160
57
  query?: never;
@@ -192,68 +89,9 @@ export declare class IngestResource {
192
89
  };
193
90
  };
194
91
  }, `${string}/${string}`>>;
195
- ingestFhir(patientId: string, body: NonNullable<operations["ingest-fhir"]["requestBody"]>["content"]["application/json"], params?: {
196
- query?: {
197
- wait?: number;
198
- };
199
- }): Promise<import("openapi-fetch").FetchResponse<{
200
- parameters: {
201
- query?: {
202
- wait?: number | null;
203
- };
204
- header?: never;
205
- path: {
206
- patientId: string;
207
- };
208
- cookie?: never;
209
- };
210
- requestBody: {
211
- content: {
212
- "application/json": {
213
- [key: string]: unknown;
214
- };
215
- };
216
- };
217
- responses: {
218
- 202: {
219
- headers: {
220
- [name: string]: unknown;
221
- };
222
- content: {
223
- "application/json": import("..").components["schemas"]["IngestExecutionEnvelope"];
224
- };
225
- };
226
- 422: {
227
- headers: {
228
- [name: string]: unknown;
229
- };
230
- content: {
231
- "application/json": import("..").components["schemas"]["ApiError"];
232
- };
233
- };
234
- };
235
- }, {
236
- params: {
237
- query?: {
238
- wait?: number;
239
- } | undefined;
240
- path: {
241
- patientId: string;
242
- };
243
- };
244
- body: {
245
- [key: string]: unknown;
246
- };
247
- }, `${string}/${string}`>>;
248
- ingestCda(patientId: string, body: NonNullable<operations["ingest-cda"]["requestBody"]>["content"]["text/plain"], params?: {
249
- query?: {
250
- wait?: number;
251
- };
252
- }): Promise<import("openapi-fetch").FetchResponse<{
92
+ ingestFhirR4(patientId: string, body: IngestFhirBody): Promise<import("openapi-fetch").FetchResponse<{
253
93
  parameters: {
254
- query?: {
255
- wait?: number | null;
256
- };
94
+ query?: never;
257
95
  header?: never;
258
96
  path: {
259
97
  patientId: string;
@@ -262,7 +100,7 @@ export declare class IngestResource {
262
100
  };
263
101
  requestBody: {
264
102
  content: {
265
- "text/plain": string;
103
+ "application/json": import("..").components["schemas"]["IngestFhirBody"];
266
104
  };
267
105
  };
268
106
  responses: {
@@ -271,7 +109,7 @@ export declare class IngestResource {
271
109
  [name: string]: unknown;
272
110
  };
273
111
  content: {
274
- "application/json": import("..").components["schemas"]["IngestExecutionEnvelope"];
112
+ "application/json": import("..").components["schemas"]["Ingestion"];
275
113
  };
276
114
  };
277
115
  400: {
@@ -282,7 +120,7 @@ export declare class IngestResource {
282
120
  "application/json": import("..").components["schemas"]["ApiError"];
283
121
  };
284
122
  };
285
- 422: {
123
+ 404: {
286
124
  headers: {
287
125
  [name: string]: unknown;
288
126
  };
@@ -290,96 +128,7 @@ export declare class IngestResource {
290
128
  "application/json": import("..").components["schemas"]["ApiError"];
291
129
  };
292
130
  };
293
- };
294
- }, {
295
- params: {
296
- query?: {
297
- wait?: number;
298
- } | undefined;
299
- path: {
300
- patientId: string;
301
- };
302
- };
303
- body: string;
304
- bodySerializer: (b: unknown) => string;
305
- headers: {
306
- "Content-Type": string;
307
- };
308
- }, `${string}/${string}`>>;
309
- ingestDocument(patientId: string, body: IngestDocumentBody, params?: {
310
- query?: {
311
- wait?: number;
312
- };
313
- }): Promise<import("openapi-fetch").FetchResponse<{
314
- parameters: {
315
- query?: {
316
- wait?: number | null;
317
- };
318
- header?: never;
319
- path: {
320
- patientId: string;
321
- };
322
- cookie?: never;
323
- };
324
- requestBody: {
325
- content: {
326
- "application/json": import("..").components["schemas"]["IngestDocumentBody"];
327
- };
328
- };
329
- responses: {
330
- 202: {
331
- headers: {
332
- [name: string]: unknown;
333
- };
334
- content: {
335
- "application/json": import("..").components["schemas"]["IngestExecutionEnvelope"];
336
- };
337
- };
338
- };
339
- }, {
340
- params: {
341
- query?: {
342
- wait?: number;
343
- } | undefined;
344
- path: {
345
- patientId: string;
346
- };
347
- };
348
- body: {
349
- name: string;
350
- mimeType?: string;
351
- };
352
- }, `${string}/${string}`>>;
353
- ingestBatch(patientId: string, body: IngestBatchBody, params?: {
354
- query?: {
355
- wait?: number;
356
- };
357
- }): Promise<import("openapi-fetch").FetchResponse<{
358
- parameters: {
359
- query?: {
360
- wait?: number | null;
361
- };
362
- header?: never;
363
- path: {
364
- patientId: string;
365
- };
366
- cookie?: never;
367
- };
368
- requestBody: {
369
- content: {
370
- "application/json": import("..").components["schemas"]["IngestBatchBody"];
371
- };
372
- };
373
- responses: {
374
- 202: {
375
- headers: {
376
- [name: string]: unknown;
377
- };
378
- content: {
379
- "application/json": import("..").components["schemas"]["IngestExecutionEnvelope"];
380
- };
381
- };
382
- 400: {
131
+ 422: {
383
132
  headers: {
384
133
  [name: string]: unknown;
385
134
  };
@@ -390,22 +139,18 @@ export declare class IngestResource {
390
139
  };
391
140
  }, {
392
141
  params: {
393
- query?: {
394
- wait?: number;
395
- } | undefined;
396
142
  path: {
397
143
  patientId: string;
398
144
  };
399
145
  };
400
146
  body: {
401
- fhir?: {
402
- [key: string]: unknown;
403
- }[];
404
- cda?: string[];
405
- documents?: import("..").components["schemas"]["IngestDocumentBody"][];
147
+ resourceType: string;
148
+ entry?: unknown[];
149
+ } & {
150
+ [key: string]: unknown;
406
151
  };
407
152
  }, `${string}/${string}`>>;
408
- ingestFhirR4(patientId: string, body: IngestFhirBody): Promise<import("openapi-fetch").FetchResponse<{
153
+ ingestFhirR5(patientId: string, body: IngestFhirBody): Promise<import("openapi-fetch").FetchResponse<{
409
154
  parameters: {
410
155
  query?: never;
411
156
  header?: never;
@@ -466,7 +211,7 @@ export declare class IngestResource {
466
211
  [key: string]: unknown;
467
212
  };
468
213
  }, `${string}/${string}`>>;
469
- ingestFhirR5(patientId: string, body: IngestFhirBody): Promise<import("openapi-fetch").FetchResponse<{
214
+ ingestCdaR2(patientId: string, body: NonNullable<operations["ingest-cda-r2"]["requestBody"]>["content"]["application/cda+xml"]): Promise<import("openapi-fetch").FetchResponse<{
470
215
  parameters: {
471
216
  query?: never;
472
217
  header?: never;
@@ -477,7 +222,10 @@ export declare class IngestResource {
477
222
  };
478
223
  requestBody: {
479
224
  content: {
480
- "application/json": import("..").components["schemas"]["IngestFhirBody"];
225
+ "application/cda+xml": string;
226
+ "multipart/form-data": {
227
+ documents?: string[];
228
+ };
481
229
  };
482
230
  };
483
231
  responses: {
@@ -520,14 +268,13 @@ export declare class IngestResource {
520
268
  patientId: string;
521
269
  };
522
270
  };
523
- body: {
524
- resourceType: string;
525
- entry?: unknown[];
526
- } & {
527
- [key: string]: unknown;
271
+ body: string;
272
+ bodySerializer: (b: unknown) => string;
273
+ headers: {
274
+ "Content-Type": string;
528
275
  };
529
276
  }, `${string}/${string}`>>;
530
- ingestCdaR2(patientId: string, body: NonNullable<operations["ingest-cda-r2"]["requestBody"]>["content"]["application/cda+xml"]): Promise<import("openapi-fetch").FetchResponse<{
277
+ ingestCdaR2Multipart(patientId: string, body: NonNullable<operations["ingest-cda-r2"]["requestBody"]>["content"]["multipart/form-data"]): Promise<import("openapi-fetch").FetchResponse<{
531
278
  parameters: {
532
279
  query?: never;
533
280
  header?: never;
@@ -584,10 +331,9 @@ export declare class IngestResource {
584
331
  patientId: string;
585
332
  };
586
333
  };
587
- body: string;
588
- bodySerializer: (b: unknown) => string;
589
- headers: {
590
- "Content-Type": string;
334
+ body: {
335
+ documents?: string[];
591
336
  };
337
+ bodySerializer: (b: unknown) => FormData;
592
338
  }, `${string}/${string}`>>;
593
339
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clinia/context-engine-js",
3
- "version": "0.6.0-rc.1",
3
+ "version": "0.6.0",
4
4
  "description": "TypeScript client for the Clinia Context Engine",
5
5
  "keywords": [
6
6
  "clinia",
@@ -46,7 +46,7 @@
46
46
  "yaml": "^2.8.3"
47
47
  },
48
48
  "scripts": {
49
- "generate": "openapi-typescript ../../openapi/context-engine.yaml -o src/generated/context-engine.ts && tsx scripts/generate-resources.ts",
49
+ "generate": "openapi-typescript ../../openapi/context-engine.yaml -o src/generated/context-engine.ts && tsx scripts/generate-resources.ts && prettier --write src/generated src/resources",
50
50
  "build": "tsup && tsc6 -p tsconfig.build.json",
51
51
  "typecheck": "tsc6 --noEmit"
52
52
  }