@haau3/sdk 0.2.1 → 0.2.2

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/dist/index.d.cts CHANGED
@@ -5,6 +5,11 @@ import { Bundle, OperationOutcome } from "fhir/r4.js";
5
5
  interface ResponseMeta {
6
6
  /** The `X-Request-Id` the API sent. Quote it when you ask for help. */
7
7
  requestId: string | undefined;
8
+ /**
9
+ * The `correlationId` you sent, as the API returned it in `X-Correlation-Id`: proof it was kept
10
+ * with the API's record of the request. Unset when you sent none.
11
+ */
12
+ correlationId: string | undefined;
8
13
  /** Milliseconds from the first attempt to the answer, waits between attempts included. */
9
14
  durationMs: number;
10
15
  /** How many attempts were made. */
@@ -3966,6 +3971,396 @@ type ResponseOf<Op extends OperationId> = operations[Op]["responses"] extends {
3966
3971
  };
3967
3972
  } ? Content[keyof Content] : never;
3968
3973
  //#endregion
3974
+ //#region src/generated/types.d.ts
3975
+ type ListPublishersResponse = components["schemas"]["ListPublishersResponse"];
3976
+ type ListServiceTypesResponse = components["schemas"]["ListServiceTypesResponse"];
3977
+ type ListSpecialtiesResponse = components["schemas"]["ListSpecialtiesResponse"];
3978
+ type Problem = components["schemas"]["Problem"];
3979
+ type ProblemIssue = components["schemas"]["ProblemIssue"];
3980
+ type SchedulingProviderLocation = components["schemas"]["SchedulingProviderLocation"];
3981
+ type SchedulingPublisher = components["schemas"]["SchedulingPublisher"];
3982
+ type SchedulingServiceType = components["schemas"]["SchedulingServiceType"];
3983
+ type SchedulingSlot = components["schemas"]["SchedulingSlot"];
3984
+ type SchedulingSpecialty = components["schemas"]["SchedulingSpecialty"];
3985
+ type SearchProviderLocationsResponse = components["schemas"]["SearchProviderLocationsResponse"];
3986
+ type SearchSlotsResponse = components["schemas"]["SearchSlotsResponse"];
3987
+ /** The query parameters of `checkInsurancePlanNetwork`. */
3988
+ type CheckInsurancePlanNetworkParams = QueryOf<"checkInsurancePlanNetwork">;
3989
+ /** The query parameters of `codeSystemLookup`. */
3990
+ type CodeSystemLookupParams = QueryOf<"codeSystemLookup">;
3991
+ /** The query parameters of `codeSystemValidateCode`. */
3992
+ type CodeSystemValidateCodeParams = QueryOf<"codeSystemValidateCode">;
3993
+ /** The query parameters of `fhirMetadata`. */
3994
+ type FhirMetadataParams = QueryOf<"fhirMetadata">;
3995
+ /** The query parameters of `listInsurancePlanCounties`. */
3996
+ type ListInsurancePlanCountiesParams = QueryOf<"listInsurancePlanCounties">;
3997
+ /** The query parameters of `listServiceTypes`. */
3998
+ type ListServiceTypesParams = QueryOf<"listServiceTypes">;
3999
+ /** The query parameters of `listSpecialties`. */
4000
+ type ListSpecialtiesParams = QueryOf<"listSpecialties">;
4001
+ /** The query parameters of `searchEndpoint`. */
4002
+ type SearchEndpointParams = QueryOf<"searchEndpoint">;
4003
+ /** The query parameters of `searchHealthcareService`. */
4004
+ type SearchHealthcareServiceParams = QueryOf<"searchHealthcareService">;
4005
+ /** The query parameters of `searchInsurancePlan`. */
4006
+ type SearchInsurancePlanParams = QueryOf<"searchInsurancePlan">;
4007
+ /** The query parameters of `searchLocation`. */
4008
+ type SearchLocationParams = QueryOf<"searchLocation">;
4009
+ /** The query parameters of `searchOrganization`. */
4010
+ type SearchOrganizationParams = QueryOf<"searchOrganization">;
4011
+ /** The query parameters of `searchOrganizationAffiliation`. */
4012
+ type SearchOrganizationAffiliationParams = QueryOf<"searchOrganizationAffiliation">;
4013
+ /** The query parameters of `searchPractitioner`. */
4014
+ type SearchPractitionerParams = QueryOf<"searchPractitioner">;
4015
+ /** The query parameters of `searchPractitionerRole`. */
4016
+ type SearchPractitionerRoleParams = QueryOf<"searchPractitionerRole">;
4017
+ /** The query parameters of `searchProviderLocations`. */
4018
+ type SearchProviderLocationsParams = QueryOf<"searchProviderLocations">;
4019
+ /** The query parameters of `searchQuestionnaire`. */
4020
+ type SearchQuestionnaireParams = QueryOf<"searchQuestionnaire">;
4021
+ /** The query parameters of `searchSlots`. */
4022
+ type SearchSlotsParams = QueryOf<"searchSlots">;
4023
+ /** The query parameters of `valueSetExpand`. */
4024
+ type ValueSetExpandParams = QueryOf<"valueSetExpand">;
4025
+ /** The query parameters of `valueSetValidateCode`. */
4026
+ type ValueSetValidateCodeParams = QueryOf<"valueSetValidateCode">;
4027
+ //#endregion
4028
+ //#region src/errors.d.ts
4029
+ /**
4030
+ * Why a request got no answer:
4031
+ *
4032
+ * - `timeout`: an attempt ran past its timeout, or the API answered 504.
4033
+ * - `network`: the request never reached the API, or the connection failed.
4034
+ * - `rate-limited`: the API answered 429. `retryAfter` says when to try again.
4035
+ * - `unavailable`: the API, or a source it reads, could not answer (502, 503).
4036
+ * - `server-error`: the API failed (500).
4037
+ * - `unreadable`: the API answered with something that is not an answer: a body that is not JSON,
4038
+ * or a FHIR resource of another type than the operation answers with.
4039
+ */
4040
+ type NoAnswerReason = "timeout" | "network" | "rate-limited" | "unavailable" | "server-error" | "unreadable";
4041
+ /**
4042
+ * What {@link Haau3Error.toJSON} gives: the fields that are safe to log. Never a body the API
4043
+ * answered with, never the error's `cause`. A message names the request by its method and the
4044
+ * operation's path, never by a value you sent.
4045
+ */
4046
+ interface Haau3ErrorJSON {
4047
+ name: string;
4048
+ message: string;
4049
+ status?: number;
4050
+ reason?: NoAnswerReason;
4051
+ retryAfter?: number;
4052
+ attempts?: number;
4053
+ durationMs?: number;
4054
+ requestId?: string;
4055
+ correlationId?: string;
4056
+ }
4057
+ /** What every error this package throws has. */
4058
+ export declare class Haau3Error extends Error {
4059
+ name: string;
4060
+ /** The `X-Request-Id` the API sent, when it answered. Quote it when you ask for help. */
4061
+ readonly requestId: string | undefined;
4062
+ /** The `correlationId` you sent, as the API returned it in `X-Correlation-Id`, when it answered. */
4063
+ readonly correlationId: string | undefined;
4064
+ constructor(message: string, requestId?: string, options?: ErrorOptions & {
4065
+ correlationId?: string | undefined;
4066
+ });
4067
+ /**
4068
+ * The error as a plain object that is safe to log: its name, its message and every field that is
4069
+ * set, and never the body the API answered with (`outcome`, `problem`) or the `cause`.
4070
+ * `JSON.stringify(error)` and loggers that call `toJSON` print this.
4071
+ *
4072
+ * ```ts
4073
+ * logger.warn({ error: error.toJSON() }, "the plan read failed");
4074
+ * ```
4075
+ */
4076
+ toJSON(): Haau3ErrorJSON;
4077
+ }
4078
+ /** An error body as the SDK read it: an OperationOutcome under the FHIR base, a Problem elsewhere. */
4079
+ type AnswerBody = {
4080
+ kind: "outcome";
4081
+ value: OperationOutcome;
4082
+ } | {
4083
+ kind: "problem";
4084
+ value: Problem;
4085
+ };
4086
+ /** How long an answered request took, in how many attempts, and the correlation id it came back with. */
4087
+ interface Timing {
4088
+ attempts: number;
4089
+ durationMs: number;
4090
+ correlationId?: string | undefined;
4091
+ }
4092
+ /** The API refused the key: none was sent, it is not one the API knows, or it was revoked (401, 403). */
4093
+ export declare class AuthError extends Haau3Error {
4094
+ name: string;
4095
+ readonly status: number;
4096
+ /** How many attempts were made. */
4097
+ readonly attempts: number;
4098
+ /** Milliseconds from the first attempt to the answer. */
4099
+ readonly durationMs: number | undefined;
4100
+ /** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
4101
+ readonly outcome?: OperationOutcome;
4102
+ /** The problem the other services answered with. Not enumerable, so it is never printed. */
4103
+ readonly problem?: Problem;
4104
+ constructor(message: string, status: number, requestId?: string, body?: AnswerBody, timing?: Timing);
4105
+ }
4106
+ /**
4107
+ * The API answered and refused the request: a parameter it does not take, a record that does not
4108
+ * exist (404), a page that no longer exists (410), a body that is too large (413). `status` says
4109
+ * which, and the body says why.
4110
+ */
4111
+ export declare class RefusedError extends Haau3Error {
4112
+ name: string;
4113
+ readonly status: number;
4114
+ /** How many attempts were made. */
4115
+ readonly attempts: number;
4116
+ /** Milliseconds from the first attempt to the answer. */
4117
+ readonly durationMs: number | undefined;
4118
+ /** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
4119
+ readonly outcome?: OperationOutcome;
4120
+ /** The problem the other services answered with. Not enumerable, so it is never printed. */
4121
+ readonly problem?: Problem;
4122
+ constructor(message: string, status: number, requestId?: string, body?: AnswerBody, timing?: Timing);
4123
+ }
4124
+ /**
4125
+ * The request got no answer, after every attempt the client was allowed. This never means "no
4126
+ * results": an empty search answers with an empty Bundle or list, not with this error.
4127
+ */
4128
+ export declare class NoAnswerError extends Haau3Error {
4129
+ name: string;
4130
+ readonly reason: NoAnswerReason;
4131
+ /** The last status the API answered with, when it answered at all. */
4132
+ readonly status: number | undefined;
4133
+ /** Seconds to wait before trying again, when the API said. */
4134
+ readonly retryAfter: number | undefined;
4135
+ /** How many attempts were made. */
4136
+ readonly attempts: number;
4137
+ /** Milliseconds from the first attempt to the last failure, waits between attempts included. */
4138
+ readonly durationMs: number | undefined;
4139
+ /** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
4140
+ readonly outcome?: OperationOutcome;
4141
+ /** The problem the other services answered with. Not enumerable, so it is never printed. */
4142
+ readonly problem?: Problem;
4143
+ constructor(message: string, details: {
4144
+ reason: NoAnswerReason;
4145
+ attempts: number;
4146
+ durationMs?: number;
4147
+ status?: number;
4148
+ retryAfter?: number;
4149
+ requestId?: string;
4150
+ correlationId?: string | undefined;
4151
+ body?: AnswerBody;
4152
+ cause?: unknown;
4153
+ });
4154
+ }
4155
+ //#endregion
4156
+ //#region src/batch.d.ts
4157
+ declare const answerType: unique symbol;
4158
+ /**
4159
+ * One operation, ready to go in a batch. Made by the builder {@link Haau3.batch} hands you, and
4160
+ * sent only as part of that batch. `T` is what the operation answers with.
4161
+ */
4162
+ interface BatchEntry<T> {
4163
+ readonly method: "GET" | "POST";
4164
+ /** Where the entry goes, relative to the FHIR base, as the batch sends it. */
4165
+ readonly url: string;
4166
+ /** Carries the answer's type. Never set. */
4167
+ readonly [answerType]?: T;
4168
+ }
4169
+ /** One entry's outcome: its answer, or the error a single call would have thrown. */
4170
+ type BatchResult<T> = {
4171
+ ok: true;
4172
+ data: T;
4173
+ status: number;
4174
+ } | {
4175
+ ok: false;
4176
+ error: RefusedError | NoAnswerError;
4177
+ };
4178
+ /** One {@link BatchResult} per entry, in the order the entries were given. */
4179
+ type BatchResults<E extends readonly BatchEntry<unknown>[]> = { -readonly [K in keyof E]: BatchResult<E[K] extends BatchEntry<infer T> ? T : never>; };
4180
+ //#endregion
4181
+ //#region src/generated/batch.d.ts
4182
+ /**
4183
+ * Every operation a batch can carry, each called as on {@link Haau3} and returning an entry for the
4184
+ * batch instead of sending. Everything on the FHIR base but the batch itself and
4185
+ * `reconcileMedications`.
4186
+ */
4187
+ declare class BatchBuilder {
4188
+ /**
4189
+ * Check providers against a plan's network, as one entry of a batch. Called as `Haau3.checkInsurancePlanNetwork` is.
4190
+ *
4191
+ * `GET /v1/fhir/r4/InsurancePlan/{id}/$in-network`
4192
+ */
4193
+ checkInsurancePlanNetwork(id: string, params: CheckInsurancePlanNetworkParams): BatchEntry<ResponseOf<"checkInsurancePlanNetwork">>;
4194
+ /**
4195
+ * Look up a code, as one entry of a batch. Called as `Haau3.codeSystemLookup` is.
4196
+ *
4197
+ * `GET /v1/fhir/r4/CodeSystem/$lookup`
4198
+ */
4199
+ codeSystemLookup(params: CodeSystemLookupParams): BatchEntry<ResponseOf<"codeSystemLookup">>;
4200
+ /**
4201
+ * Look up a code, as one entry of a batch. Called as `Haau3.codeSystemLookupPost` is.
4202
+ *
4203
+ * `POST /v1/fhir/r4/CodeSystem/$lookup`
4204
+ */
4205
+ codeSystemLookupPost(body: BodyOf<"codeSystemLookupPost">): BatchEntry<ResponseOf<"codeSystemLookupPost">>;
4206
+ /**
4207
+ * Validate a code in a code system, as one entry of a batch. Called as `Haau3.codeSystemValidateCode` is.
4208
+ *
4209
+ * `GET /v1/fhir/r4/CodeSystem/$validate-code`
4210
+ */
4211
+ codeSystemValidateCode(params: CodeSystemValidateCodeParams): BatchEntry<ResponseOf<"codeSystemValidateCode">>;
4212
+ /**
4213
+ * Validate a code in a code system, as one entry of a batch. Called as `Haau3.codeSystemValidateCodePost` is.
4214
+ *
4215
+ * `POST /v1/fhir/r4/CodeSystem/$validate-code`
4216
+ */
4217
+ codeSystemValidateCodePost(body: BodyOf<"codeSystemValidateCodePost">): BatchEntry<ResponseOf<"codeSystemValidateCodePost">>;
4218
+ /**
4219
+ * Capability statement, as one entry of a batch. Called as `Haau3.fhirMetadata` is.
4220
+ *
4221
+ * `GET /v1/fhir/r4/metadata`
4222
+ */
4223
+ fhirMetadata(params?: FhirMetadataParams): BatchEntry<ResponseOf<"fhirMetadata">>;
4224
+ /**
4225
+ * List a state's counties, as one entry of a batch. Called as `Haau3.listInsurancePlanCounties` is.
4226
+ *
4227
+ * `GET /v1/fhir/r4/InsurancePlan/$counties`
4228
+ */
4229
+ listInsurancePlanCounties(params: ListInsurancePlanCountiesParams): BatchEntry<ResponseOf<"listInsurancePlanCounties">>;
4230
+ /**
4231
+ * Read an Endpoint, as one entry of a batch. Called as `Haau3.readEndpoint` is.
4232
+ *
4233
+ * `GET /v1/fhir/r4/Endpoint/{id}`
4234
+ */
4235
+ readEndpoint(id: string): BatchEntry<ResponseOf<"readEndpoint">>;
4236
+ /**
4237
+ * Read a HealthcareService, as one entry of a batch. Called as `Haau3.readHealthcareService` is.
4238
+ *
4239
+ * `GET /v1/fhir/r4/HealthcareService/{id}`
4240
+ */
4241
+ readHealthcareService(id: string): BatchEntry<ResponseOf<"readHealthcareService">>;
4242
+ /**
4243
+ * Read a plan, as one entry of a batch. Called as `Haau3.readInsurancePlan` is.
4244
+ *
4245
+ * `GET /v1/fhir/r4/InsurancePlan/{id}`
4246
+ */
4247
+ readInsurancePlan(id: string): BatchEntry<ResponseOf<"readInsurancePlan">>;
4248
+ /**
4249
+ * Read a Location, as one entry of a batch. Called as `Haau3.readLocation` is.
4250
+ *
4251
+ * `GET /v1/fhir/r4/Location/{id}`
4252
+ */
4253
+ readLocation(id: string): BatchEntry<ResponseOf<"readLocation">>;
4254
+ /**
4255
+ * Read an Organization, as one entry of a batch. Called as `Haau3.readOrganization` is.
4256
+ *
4257
+ * `GET /v1/fhir/r4/Organization/{id}`
4258
+ */
4259
+ readOrganization(id: string): BatchEntry<ResponseOf<"readOrganization">>;
4260
+ /**
4261
+ * Read an OrganizationAffiliation, as one entry of a batch. Called as `Haau3.readOrganizationAffiliation` is.
4262
+ *
4263
+ * `GET /v1/fhir/r4/OrganizationAffiliation/{id}`
4264
+ */
4265
+ readOrganizationAffiliation(id: string): BatchEntry<ResponseOf<"readOrganizationAffiliation">>;
4266
+ /**
4267
+ * Read a Practitioner, as one entry of a batch. Called as `Haau3.readPractitioner` is.
4268
+ *
4269
+ * `GET /v1/fhir/r4/Practitioner/{id}`
4270
+ */
4271
+ readPractitioner(id: string): BatchEntry<ResponseOf<"readPractitioner">>;
4272
+ /**
4273
+ * Read a PractitionerRole, as one entry of a batch. Called as `Haau3.readPractitionerRole` is.
4274
+ *
4275
+ * `GET /v1/fhir/r4/PractitionerRole/{id}`
4276
+ */
4277
+ readPractitionerRole(id: string): BatchEntry<ResponseOf<"readPractitionerRole">>;
4278
+ /**
4279
+ * Read a questionnaire, as one entry of a batch. Called as `Haau3.readQuestionnaire` is.
4280
+ *
4281
+ * `GET /v1/fhir/r4/Questionnaire/{id}`
4282
+ */
4283
+ readQuestionnaire(id: string): BatchEntry<ResponseOf<"readQuestionnaire">>;
4284
+ /**
4285
+ * Find endpoints, as one entry of a batch. Called as `Haau3.searchEndpoint` is.
4286
+ *
4287
+ * `GET /v1/fhir/r4/Endpoint`
4288
+ */
4289
+ searchEndpoint(params?: SearchEndpointParams): BatchEntry<ResponseOf<"searchEndpoint">>;
4290
+ /**
4291
+ * Find healthcare services, as one entry of a batch. Called as `Haau3.searchHealthcareService` is.
4292
+ *
4293
+ * `GET /v1/fhir/r4/HealthcareService`
4294
+ */
4295
+ searchHealthcareService(params?: SearchHealthcareServiceParams): BatchEntry<ResponseOf<"searchHealthcareService">>;
4296
+ /**
4297
+ * Find a plan, as one entry of a batch. Called as `Haau3.searchInsurancePlan` is.
4298
+ *
4299
+ * `GET /v1/fhir/r4/InsurancePlan`
4300
+ */
4301
+ searchInsurancePlan(params?: SearchInsurancePlanParams): BatchEntry<ResponseOf<"searchInsurancePlan">>;
4302
+ /**
4303
+ * Find practice locations, as one entry of a batch. Called as `Haau3.searchLocation` is.
4304
+ *
4305
+ * `GET /v1/fhir/r4/Location`
4306
+ */
4307
+ searchLocation(params?: SearchLocationParams): BatchEntry<ResponseOf<"searchLocation">>;
4308
+ /**
4309
+ * Find organizations, payers and networks, as one entry of a batch. Called as `Haau3.searchOrganization` is.
4310
+ *
4311
+ * `GET /v1/fhir/r4/Organization`
4312
+ */
4313
+ searchOrganization(params?: SearchOrganizationParams): BatchEntry<ResponseOf<"searchOrganization">>;
4314
+ /**
4315
+ * Find the organizations in a network, as one entry of a batch. Called as `Haau3.searchOrganizationAffiliation` is.
4316
+ *
4317
+ * `GET /v1/fhir/r4/OrganizationAffiliation`
4318
+ */
4319
+ searchOrganizationAffiliation(params?: SearchOrganizationAffiliationParams): BatchEntry<ResponseOf<"searchOrganizationAffiliation">>;
4320
+ /**
4321
+ * Find a practitioner by NPI or name, as one entry of a batch. Called as `Haau3.searchPractitioner` is.
4322
+ *
4323
+ * `GET /v1/fhir/r4/Practitioner`
4324
+ */
4325
+ searchPractitioner(params?: SearchPractitionerParams): BatchEntry<ResponseOf<"searchPractitioner">>;
4326
+ /**
4327
+ * Find practitioner roles, as one entry of a batch. Called as `Haau3.searchPractitionerRole` is.
4328
+ *
4329
+ * `GET /v1/fhir/r4/PractitionerRole`
4330
+ */
4331
+ searchPractitionerRole(params?: SearchPractitionerRoleParams): BatchEntry<ResponseOf<"searchPractitionerRole">>;
4332
+ /**
4333
+ * List or find a questionnaire, as one entry of a batch. Called as `Haau3.searchQuestionnaire` is.
4334
+ *
4335
+ * `GET /v1/fhir/r4/Questionnaire`
4336
+ */
4337
+ searchQuestionnaire(params?: SearchQuestionnaireParams): BatchEntry<ResponseOf<"searchQuestionnaire">>;
4338
+ /**
4339
+ * Expand a value set, as one entry of a batch. Called as `Haau3.valueSetExpand` is.
4340
+ *
4341
+ * `GET /v1/fhir/r4/ValueSet/$expand`
4342
+ */
4343
+ valueSetExpand(params?: ValueSetExpandParams): BatchEntry<ResponseOf<"valueSetExpand">>;
4344
+ /**
4345
+ * Expand a value set, as one entry of a batch. Called as `Haau3.valueSetExpandPost` is.
4346
+ *
4347
+ * `POST /v1/fhir/r4/ValueSet/$expand`
4348
+ */
4349
+ valueSetExpandPost(body: BodyOf<"valueSetExpandPost">): BatchEntry<ResponseOf<"valueSetExpandPost">>;
4350
+ /**
4351
+ * Validate a code against a value set, as one entry of a batch. Called as `Haau3.valueSetValidateCode` is.
4352
+ *
4353
+ * `GET /v1/fhir/r4/ValueSet/$validate-code`
4354
+ */
4355
+ valueSetValidateCode(params: ValueSetValidateCodeParams): BatchEntry<ResponseOf<"valueSetValidateCode">>;
4356
+ /**
4357
+ * Validate a code against a value set, as one entry of a batch. Called as `Haau3.valueSetValidateCodePost` is.
4358
+ *
4359
+ * `POST /v1/fhir/r4/ValueSet/$validate-code`
4360
+ */
4361
+ valueSetValidateCodePost(body: BodyOf<"valueSetValidateCodePost">): BatchEntry<ResponseOf<"valueSetValidateCodePost">>;
4362
+ }
4363
+ //#endregion
3969
4364
  //#region src/transport.d.ts
3970
4365
  /**
3971
4366
  * Options passed on to `fetch` with every request: anything the runtime's `RequestInit` takes, such
@@ -4005,7 +4400,15 @@ interface RequestOptions {
4005
4400
  maxRetries?: number;
4006
4401
  /** Ends the call when it aborts. The abort's reason is thrown as it is. */
4007
4402
  signal?: AbortSignal;
4008
- /** Extra headers for this call, such as `X-Request-Id` with your own UUID. */
4403
+ /**
4404
+ * An id of your own for this call, a UUID, such as your job's or your trace's. Sent as
4405
+ * `X-Request-Id`; the API keeps it with its record of the request and returns it in
4406
+ * `X-Correlation-Id`, which `.withResponse()` and every error the API answered give back as
4407
+ * `correlationId`. The API takes only a UUID and drops anything else without a word, so the SDK
4408
+ * refuses anything else before sending.
4409
+ */
4410
+ correlationId?: string;
4411
+ /** Extra headers for this call. `correlationId` is the way to send your own `X-Request-Id`. */
4009
4412
  headers?: Record<string, string>;
4010
4413
  /** Passed on to `fetch` for this call, over the client's own `fetchOptions`. */
4011
4414
  fetchOptions?: FetchOptions;
@@ -4068,60 +4471,6 @@ declare abstract class Transport {
4068
4471
  protected url(pathOrUrl: string): URL;
4069
4472
  }
4070
4473
  //#endregion
4071
- //#region src/generated/types.d.ts
4072
- type ListPublishersResponse = components["schemas"]["ListPublishersResponse"];
4073
- type ListServiceTypesResponse = components["schemas"]["ListServiceTypesResponse"];
4074
- type ListSpecialtiesResponse = components["schemas"]["ListSpecialtiesResponse"];
4075
- type Problem = components["schemas"]["Problem"];
4076
- type ProblemIssue = components["schemas"]["ProblemIssue"];
4077
- type SchedulingProviderLocation = components["schemas"]["SchedulingProviderLocation"];
4078
- type SchedulingPublisher = components["schemas"]["SchedulingPublisher"];
4079
- type SchedulingServiceType = components["schemas"]["SchedulingServiceType"];
4080
- type SchedulingSlot = components["schemas"]["SchedulingSlot"];
4081
- type SchedulingSpecialty = components["schemas"]["SchedulingSpecialty"];
4082
- type SearchProviderLocationsResponse = components["schemas"]["SearchProviderLocationsResponse"];
4083
- type SearchSlotsResponse = components["schemas"]["SearchSlotsResponse"];
4084
- /** The query parameters of `checkInsurancePlanNetwork`. */
4085
- type CheckInsurancePlanNetworkParams = QueryOf<"checkInsurancePlanNetwork">;
4086
- /** The query parameters of `codeSystemLookup`. */
4087
- type CodeSystemLookupParams = QueryOf<"codeSystemLookup">;
4088
- /** The query parameters of `codeSystemValidateCode`. */
4089
- type CodeSystemValidateCodeParams = QueryOf<"codeSystemValidateCode">;
4090
- /** The query parameters of `fhirMetadata`. */
4091
- type FhirMetadataParams = QueryOf<"fhirMetadata">;
4092
- /** The query parameters of `listInsurancePlanCounties`. */
4093
- type ListInsurancePlanCountiesParams = QueryOf<"listInsurancePlanCounties">;
4094
- /** The query parameters of `listServiceTypes`. */
4095
- type ListServiceTypesParams = QueryOf<"listServiceTypes">;
4096
- /** The query parameters of `listSpecialties`. */
4097
- type ListSpecialtiesParams = QueryOf<"listSpecialties">;
4098
- /** The query parameters of `searchEndpoint`. */
4099
- type SearchEndpointParams = QueryOf<"searchEndpoint">;
4100
- /** The query parameters of `searchHealthcareService`. */
4101
- type SearchHealthcareServiceParams = QueryOf<"searchHealthcareService">;
4102
- /** The query parameters of `searchInsurancePlan`. */
4103
- type SearchInsurancePlanParams = QueryOf<"searchInsurancePlan">;
4104
- /** The query parameters of `searchLocation`. */
4105
- type SearchLocationParams = QueryOf<"searchLocation">;
4106
- /** The query parameters of `searchOrganization`. */
4107
- type SearchOrganizationParams = QueryOf<"searchOrganization">;
4108
- /** The query parameters of `searchOrganizationAffiliation`. */
4109
- type SearchOrganizationAffiliationParams = QueryOf<"searchOrganizationAffiliation">;
4110
- /** The query parameters of `searchPractitioner`. */
4111
- type SearchPractitionerParams = QueryOf<"searchPractitioner">;
4112
- /** The query parameters of `searchPractitionerRole`. */
4113
- type SearchPractitionerRoleParams = QueryOf<"searchPractitionerRole">;
4114
- /** The query parameters of `searchProviderLocations`. */
4115
- type SearchProviderLocationsParams = QueryOf<"searchProviderLocations">;
4116
- /** The query parameters of `searchQuestionnaire`. */
4117
- type SearchQuestionnaireParams = QueryOf<"searchQuestionnaire">;
4118
- /** The query parameters of `searchSlots`. */
4119
- type SearchSlotsParams = QueryOf<"searchSlots">;
4120
- /** The query parameters of `valueSetExpand`. */
4121
- type ValueSetExpandParams = QueryOf<"valueSetExpand">;
4122
- /** The query parameters of `valueSetValidateCode`. */
4123
- type ValueSetValidateCodeParams = QueryOf<"valueSetValidateCode">;
4124
- //#endregion
4125
4474
  //#region src/generated/methods.d.ts
4126
4475
  /** Every operation of the haau3 platform API. {@link Haau3} is the class to construct. */
4127
4476
  declare abstract class Operations extends Transport {
@@ -4458,6 +4807,7 @@ declare abstract class Operations extends Transport {
4458
4807
  * constructor refuses to run in a browser, where a key would be public.
4459
4808
  */
4460
4809
  export declare class Haau3 extends Operations {
4810
+ #private;
4461
4811
  constructor(options?: ClientOptions);
4462
4812
  /**
4463
4813
  * Every page of a FHIR search, starting with the one you have, following each `next` link
@@ -4472,106 +4822,32 @@ export declare class Haau3 extends Operations {
4472
4822
  * ```
4473
4823
  */
4474
4824
  pages(first: Bundle, options?: RequestOptions): AsyncGenerator<Bundle, void, undefined>;
4475
- }
4476
- //#endregion
4477
- //#region src/errors.d.ts
4478
- /**
4479
- * Why a request got no answer:
4480
- *
4481
- * - `timeout`: an attempt ran past its timeout, or the API answered 504.
4482
- * - `network`: the request never reached the API, or the connection failed.
4483
- * - `rate-limited`: the API answered 429. `retryAfter` says when to try again.
4484
- * - `unavailable`: the API, or a source it reads, could not answer (502, 503).
4485
- * - `server-error`: the API failed (500).
4486
- * - `unreadable`: the API answered with something that is not an answer: a body that is not JSON,
4487
- * or a FHIR resource of another type than the operation answers with.
4488
- */
4489
- type NoAnswerReason = "timeout" | "network" | "rate-limited" | "unavailable" | "server-error" | "unreadable";
4490
- /** What every error this package throws has. */
4491
- export declare class Haau3Error extends Error {
4492
- name: string;
4493
- /** The `X-Request-Id` the API sent, when it answered. Quote it when you ask for help. */
4494
- readonly requestId: string | undefined;
4495
- constructor(message: string, requestId?: string, options?: ErrorOptions);
4496
- }
4497
- /** An error body as the SDK read it: an OperationOutcome under the FHIR base, a Problem elsewhere. */
4498
- type AnswerBody = {
4499
- kind: "outcome";
4500
- value: OperationOutcome;
4501
- } | {
4502
- kind: "problem";
4503
- value: Problem;
4504
- };
4505
- /** How long an answered request took, and in how many attempts. */
4506
- interface Timing {
4507
- attempts: number;
4508
- durationMs: number;
4509
- }
4510
- /** The API refused the key: none was sent, it is not one the API knows, or it was revoked (401, 403). */
4511
- export declare class AuthError extends Haau3Error {
4512
- name: string;
4513
- readonly status: number;
4514
- /** How many attempts were made. */
4515
- readonly attempts: number;
4516
- /** Milliseconds from the first attempt to the answer. */
4517
- readonly durationMs: number | undefined;
4518
- /** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
4519
- readonly outcome?: OperationOutcome;
4520
- /** The problem the other services answered with. Not enumerable, so it is never printed. */
4521
- readonly problem?: Problem;
4522
- constructor(message: string, status: number, requestId?: string, body?: AnswerBody, timing?: Timing);
4523
- }
4524
- /**
4525
- * The API answered and refused the request: a parameter it does not take, a record that does not
4526
- * exist (404), a page that no longer exists (410), a body that is too large (413). `status` says
4527
- * which, and the body says why.
4528
- */
4529
- export declare class RefusedError extends Haau3Error {
4530
- name: string;
4531
- readonly status: number;
4532
- /** How many attempts were made. */
4533
- readonly attempts: number;
4534
- /** Milliseconds from the first attempt to the answer. */
4535
- readonly durationMs: number | undefined;
4536
- /** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
4537
- readonly outcome?: OperationOutcome;
4538
- /** The problem the other services answered with. Not enumerable, so it is never printed. */
4539
- readonly problem?: Problem;
4540
- constructor(message: string, status: number, requestId?: string, body?: AnswerBody, timing?: Timing);
4541
- }
4542
- /**
4543
- * The request got no answer, after every attempt the client was allowed. This never means "no
4544
- * results": an empty search answers with an empty Bundle or list, not with this error.
4545
- */
4546
- export declare class NoAnswerError extends Haau3Error {
4547
- name: string;
4548
- readonly reason: NoAnswerReason;
4549
- /** The last status the API answered with, when it answered at all. */
4550
- readonly status: number | undefined;
4551
- /** Seconds to wait before trying again, when the API said. */
4552
- readonly retryAfter: number | undefined;
4553
- /** How many attempts were made. */
4554
- readonly attempts: number;
4555
- /** Milliseconds from the first attempt to the last failure, waits between attempts included. */
4556
- readonly durationMs: number | undefined;
4557
- /** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
4558
- readonly outcome?: OperationOutcome;
4559
- /** The problem the other services answered with. Not enumerable, so it is never printed. */
4560
- readonly problem?: Problem;
4561
- constructor(message: string, details: {
4562
- reason: NoAnswerReason;
4563
- attempts: number;
4564
- durationMs?: number;
4565
- status?: number;
4566
- retryAfter?: number;
4567
- requestId?: string;
4568
- body?: AnswerBody;
4569
- cause?: unknown;
4570
- });
4825
+ /**
4826
+ * Several operations of the FHIR base in one request, each with its own answer or error, in the
4827
+ * order given. The function you pass gets a builder with every operation a batch can carry, called
4828
+ * as on this client; what it returns is sent.
4829
+ *
4830
+ * ```ts
4831
+ * const [plan, counties] = await haau3.batch((b) => [
4832
+ * b.readInsurancePlan("H2406-013-000"),
4833
+ * b.listInsurancePlanCounties({ state: "NC" }),
4834
+ * ]);
4835
+ * if (plan.ok) plan.data; // fhir4.InsurancePlan
4836
+ * else plan.error; // RefusedError or NoAnswerError, as the call alone would have thrown
4837
+ * ```
4838
+ *
4839
+ * Each entry is checked as the call alone is, and fails alone: its result is `{ ok: false, error }`
4840
+ * and the others still answer. An entry that fails is not retried. The batch itself is retried,
4841
+ * and throws, as any call does: an {@link AuthError}, a {@link NoAnswerError} when no answer came
4842
+ * back, a {@link RefusedError} when the API refused the whole batch. The API takes up to 100
4843
+ * entries in up to 1 MiB, and gives a batch 60 seconds; a larger batch is refused, so send several.
4844
+ * `reconcileMedications` cannot go in a batch.
4845
+ */
4846
+ batch<const E extends readonly BatchEntry<unknown>[]>(build: (b: BatchBuilder) => E, options?: RequestOptions): APIPromise<BatchResults<E>>;
4571
4847
  }
4572
4848
  //#endregion
4573
4849
  //#region src/version.d.ts
4574
4850
  /** This package's version, sent in the `User-Agent` header. A test holds it to package.json. */
4575
- export declare const VERSION = "0.2.1";
4851
+ export declare const VERSION = "0.2.2";
4576
4852
  //#endregion
4577
- export type { CheckInsurancePlanNetworkParams, ClientOptions, CodeSystemLookupParams, CodeSystemValidateCodeParams, FetchOptions, FhirMetadataParams, ListInsurancePlanCountiesParams, ListPublishersResponse, ListServiceTypesParams, ListServiceTypesResponse, ListSpecialtiesParams, ListSpecialtiesResponse, NoAnswerReason, OperationId, Problem, ProblemIssue, QueryValue, RawRequest, RawResponse, RequestOptions, ResponseMeta, SchedulingProviderLocation, SchedulingPublisher, SchedulingServiceType, SchedulingSlot, SchedulingSpecialty, SearchEndpointParams, SearchHealthcareServiceParams, SearchInsurancePlanParams, SearchLocationParams, SearchOrganizationAffiliationParams, SearchOrganizationParams, SearchPractitionerParams, SearchPractitionerRoleParams, SearchProviderLocationsParams, SearchProviderLocationsResponse, SearchQuestionnaireParams, SearchSlotsParams, SearchSlotsResponse, ValueSetExpandParams, ValueSetValidateCodeParams, WithResponse, fhir4 };
4853
+ export type { BatchBuilder, BatchEntry, BatchResult, BatchResults, BodyOf, CheckInsurancePlanNetworkParams, ClientOptions, CodeSystemLookupParams, CodeSystemValidateCodeParams, FetchOptions, FhirMetadataParams, Haau3ErrorJSON, ListInsurancePlanCountiesParams, ListPublishersResponse, ListServiceTypesParams, ListServiceTypesResponse, ListSpecialtiesParams, ListSpecialtiesResponse, NoAnswerReason, OperationId, Problem, ProblemIssue, QueryOf, QueryValue, RawRequest, RawResponse, RequestOptions, ResponseMeta, ResponseOf, SchedulingProviderLocation, SchedulingPublisher, SchedulingServiceType, SchedulingSlot, SchedulingSpecialty, SearchEndpointParams, SearchHealthcareServiceParams, SearchInsurancePlanParams, SearchLocationParams, SearchOrganizationAffiliationParams, SearchOrganizationParams, SearchPractitionerParams, SearchPractitionerRoleParams, SearchProviderLocationsParams, SearchProviderLocationsResponse, SearchQuestionnaireParams, SearchSlotsParams, SearchSlotsResponse, ValueSetExpandParams, ValueSetValidateCodeParams, WithResponse, fhir4 };